prosemirror-view
Advanced tools
Comparing version 1.23.3 to 1.23.4
{ | ||
"name": "prosemirror-view", | ||
"version": "1.23.3", | ||
"version": "1.23.4", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -103,5 +103,10 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state" | ||
if (inOrNearComposition(view, event)) return | ||
if (event.keyCode != 229) view.domObserver.forceFlush() | ||
view.lastKeyCode = event.keyCode | ||
view.lastKeyCodeTime = Date.now() | ||
// Suppress enter key events on Chrome Android, because those tend | ||
// to be part of a confused sequence of composition events fired, | ||
// and handling them eagerly tends to corrupt the input. | ||
if (browser.android && browser.chrome && event.keyCode == 13) return | ||
if (event.keyCode != 229) view.domObserver.forceFlush() | ||
// On iOS, if we preventDefault enter key presses, the virtual | ||
@@ -481,2 +486,3 @@ // keyboard gets confused. So the hack here is to set a flag that | ||
export function endComposition(view, forceUpdate) { | ||
if (browser.android && view.domObserver.flushingSoon >= 0) return | ||
view.domObserver.forceFlush() | ||
@@ -569,2 +575,7 @@ clearComposition(view) | ||
editHandlers.paste = (view, e) => { | ||
// Handling paste from JavaScript during composition is very poorly | ||
// handled by browsers, so as a dodgy but preferable kludge, we just | ||
// let the browser do its native thing there, except on Android, | ||
// where the editor is almost always composing. | ||
if (view.composing && !browser.android) return | ||
let data = brokenClipboardAPI ? null : e.clipboardData | ||
@@ -702,2 +713,3 @@ if (data && doPaste(view, data.getData("text/plain"), data.getData("text/html"), e)) e.preventDefault() | ||
if (browser.chrome && browser.android && event.inputType == "deleteContentBackward") { | ||
view.domObserver.flushSoon() | ||
let {domChangeCount} = view | ||
@@ -704,0 +716,0 @@ setTimeout(() => { |
@@ -46,5 +46,9 @@ import {TextSelection, NodeSelection} from "prosemirror-state" | ||
if (!force && view.mouseDown && view.mouseDown.allowDefault) { | ||
view.mouseDown.delayedSelectionSync = true | ||
view.domObserver.setCurSelection() | ||
return | ||
let domSel = view.root.getSelection(), curSel = view.domObserver.currentSelection | ||
if (domSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, | ||
curSel.anchorNode, curSel.anchorOffset)) { | ||
view.mouseDown.delayedSelectionSync = true | ||
view.domObserver.setCurSelection() | ||
return | ||
} | ||
} | ||
@@ -51,0 +55,0 @@ |
@@ -1425,4 +1425,4 @@ import {DOMSerializer, Fragment, Mark} from "prosemirror-model" | ||
} | ||
if (pos >= from) { | ||
let found = str.lastIndexOf(text, to - childStart) | ||
if (pos >= from && childStart < to) { | ||
let found = str.lastIndexOf(text, to - childStart - 1) | ||
if (found >= 0 && found + text.length + childStart >= from) | ||
@@ -1429,0 +1429,0 @@ return childStart + found |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
1598276
14862