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/dist/index.js
CHANGED
|
@@ -2086,10 +2086,13 @@ function findTextInFragment(frag, text, from, to) {
|
|
|
2086
2086
|
if (!next.isText) { break }
|
|
2087
2087
|
str += next.text;
|
|
2088
2088
|
}
|
|
2089
|
-
if (pos >= from
|
|
2090
|
-
var found = str.lastIndexOf(text, to - childStart - 1);
|
|
2089
|
+
if (pos >= from) {
|
|
2090
|
+
var found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
|
|
2091
2091
|
if (found >= 0 && found + text.length + childStart >= from)
|
|
2092
2092
|
{ return childStart + found }
|
|
2093
|
+
if (from == to && str.length >= (to + text.length) - childStart &&
|
|
2094
|
+
str.slice(to - childStart, to - childStart + text.length) == text)
|
|
2095
|
+
{ return to }
|
|
2093
2096
|
}
|
|
2094
2097
|
}
|
|
2095
2098
|
return -1
|
|
@@ -2686,6 +2689,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2686
2689
|
|
|
2687
2690
|
var sel = view.state.selection;
|
|
2688
2691
|
var parse = parseBetween(view, from, to);
|
|
2692
|
+
|
|
2689
2693
|
// Chrome sometimes leaves the cursor before the inserted text when
|
|
2690
2694
|
// composing after a cursor wrapper. This moves it forward.
|
|
2691
2695
|
if (result.chrome && view.cursorWrapper && parse.sel && parse.sel.anchor == view.cursorWrapper.deco.from) {
|
|
@@ -2731,9 +2735,11 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2731
2735
|
if (view.state.selection.from < view.state.selection.to &&
|
|
2732
2736
|
change.start == change.endB &&
|
|
2733
2737
|
view.state.selection instanceof prosemirrorState.TextSelection) {
|
|
2734
|
-
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2
|
|
2738
|
+
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&
|
|
2739
|
+
view.state.selection.from >= parse.from) {
|
|
2735
2740
|
change.start = view.state.selection.from;
|
|
2736
|
-
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2
|
|
2741
|
+
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&
|
|
2742
|
+
view.state.selection.to <= parse.to) {
|
|
2737
2743
|
change.endB += (view.state.selection.to - change.endA);
|
|
2738
2744
|
change.endA = view.state.selection.to;
|
|
2739
2745
|
}
|