prosemirror-view 1.23.7 → 1.23.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.es.js +10 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/domchange.js +5 -2
- package/src/viewdesc.js +5 -2
package/CHANGELOG.md
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -2082,10 +2082,13 @@ function findTextInFragment(frag, text, from, to) {
|
|
|
2082
2082
|
if (!next.isText) { break }
|
|
2083
2083
|
str += next.text;
|
|
2084
2084
|
}
|
|
2085
|
-
if (pos >= from
|
|
2086
|
-
var found = str.lastIndexOf(text, to - childStart - 1);
|
|
2085
|
+
if (pos >= from) {
|
|
2086
|
+
var found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
|
|
2087
2087
|
if (found >= 0 && found + text.length + childStart >= from)
|
|
2088
2088
|
{ return childStart + found }
|
|
2089
|
+
if (from == to && str.length >= (to + text.length) - childStart &&
|
|
2090
|
+
str.slice(to - childStart, to - childStart + text.length) == text)
|
|
2091
|
+
{ return to }
|
|
2089
2092
|
}
|
|
2090
2093
|
}
|
|
2091
2094
|
return -1
|
|
@@ -2682,6 +2685,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2682
2685
|
|
|
2683
2686
|
var sel = view.state.selection;
|
|
2684
2687
|
var parse = parseBetween(view, from, to);
|
|
2688
|
+
|
|
2685
2689
|
// Chrome sometimes leaves the cursor before the inserted text when
|
|
2686
2690
|
// composing after a cursor wrapper. This moves it forward.
|
|
2687
2691
|
if (result.chrome && view.cursorWrapper && parse.sel && parse.sel.anchor == view.cursorWrapper.deco.from) {
|
|
@@ -2727,9 +2731,11 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2727
2731
|
if (view.state.selection.from < view.state.selection.to &&
|
|
2728
2732
|
change.start == change.endB &&
|
|
2729
2733
|
view.state.selection instanceof TextSelection) {
|
|
2730
|
-
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2
|
|
2734
|
+
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&
|
|
2735
|
+
view.state.selection.from >= parse.from) {
|
|
2731
2736
|
change.start = view.state.selection.from;
|
|
2732
|
-
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2
|
|
2737
|
+
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&
|
|
2738
|
+
view.state.selection.to <= parse.to) {
|
|
2733
2739
|
change.endB += (view.state.selection.to - change.endA);
|
|
2734
2740
|
change.endA = view.state.selection.to;
|
|
2735
2741
|
}
|