prosemirror-safari-ime-span
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -11,4 +11,4 @@ import { Plugin } from 'prosemirror-state'; | ||
*/ | ||
declare const imeSpan: Plugin<boolean>; | ||
declare const imeSpan: Plugin<undefined>; | ||
export { imeSpan }; |
@@ -19,21 +19,13 @@ // src/index.ts | ||
var key = new PluginKey("safari-ime-span"); | ||
var isComposing = false; | ||
var spec = { | ||
key, | ||
state: { | ||
init: () => { | ||
return false; | ||
}, | ||
apply: (tr, value) => { | ||
const composing = tr.getMeta(key); | ||
return composing != null ? composing : value; | ||
} | ||
}, | ||
props: { | ||
decorations: createDecorations, | ||
handleDOMEvents: { | ||
compositionstart: (view) => { | ||
view.dispatch(view.state.tr.setMeta(key, true)); | ||
compositionstart: () => { | ||
isComposing = true; | ||
}, | ||
compositionend: (view) => { | ||
view.dispatch(view.state.tr.setMeta(key, false)); | ||
compositionend: () => { | ||
isComposing = false; | ||
} | ||
@@ -45,4 +37,3 @@ } | ||
const { $from, $to, to } = state.selection; | ||
const composing = key.getState(state); | ||
if (composing && $from.sameParent($to)) { | ||
if (isComposing && $from.sameParent($to)) { | ||
const deco = Decoration.widget(to, createSpan, { | ||
@@ -49,0 +40,0 @@ ignoreSelection: true, |
{ | ||
"name": "prosemirror-safari-ime-span", | ||
"type": "module", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"packageManager": "pnpm@8.15.8", | ||
@@ -6,0 +6,0 @@ "description": "", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7803
132