prosemirror-view 1.23.7 → 1.23.10
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 +18 -0
- package/dist/index.es.js +25 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +25 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decoration.js +10 -4
- package/src/domchange.js +5 -2
- package/src/index.js +1 -0
- package/src/viewdesc.js +9 -3
package/dist/index.js
CHANGED
|
@@ -1928,7 +1928,10 @@ ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
|
|
|
1928
1928
|
this.index++;
|
|
1929
1929
|
} else {
|
|
1930
1930
|
var dom = document.createElement(nodeName);
|
|
1931
|
-
if (nodeName == "IMG") {
|
|
1931
|
+
if (nodeName == "IMG") {
|
|
1932
|
+
dom.className = "ProseMirror-separator";
|
|
1933
|
+
dom.alt = "";
|
|
1934
|
+
}
|
|
1932
1935
|
if (nodeName == "BR") { dom.className = "ProseMirror-trailingBreak"; }
|
|
1933
1936
|
this.top.children.splice(this.index++, 0, new TrailingHackViewDesc(this.top, nothing, dom, null));
|
|
1934
1937
|
this.changed = true;
|
|
@@ -2086,10 +2089,13 @@ function findTextInFragment(frag, text, from, to) {
|
|
|
2086
2089
|
if (!next.isText) { break }
|
|
2087
2090
|
str += next.text;
|
|
2088
2091
|
}
|
|
2089
|
-
if (pos >= from
|
|
2090
|
-
var found = str.lastIndexOf(text, to - childStart - 1);
|
|
2092
|
+
if (pos >= from) {
|
|
2093
|
+
var found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
|
|
2091
2094
|
if (found >= 0 && found + text.length + childStart >= from)
|
|
2092
2095
|
{ return childStart + found }
|
|
2096
|
+
if (from == to && str.length >= (to + text.length) - childStart &&
|
|
2097
|
+
str.slice(to - childStart, to - childStart + text.length) == text)
|
|
2098
|
+
{ return to }
|
|
2093
2099
|
}
|
|
2094
2100
|
}
|
|
2095
2101
|
return -1
|
|
@@ -2686,6 +2692,7 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2686
2692
|
|
|
2687
2693
|
var sel = view.state.selection;
|
|
2688
2694
|
var parse = parseBetween(view, from, to);
|
|
2695
|
+
|
|
2689
2696
|
// Chrome sometimes leaves the cursor before the inserted text when
|
|
2690
2697
|
// composing after a cursor wrapper. This moves it forward.
|
|
2691
2698
|
if (result.chrome && view.cursorWrapper && parse.sel && parse.sel.anchor == view.cursorWrapper.deco.from) {
|
|
@@ -2731,9 +2738,11 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2731
2738
|
if (view.state.selection.from < view.state.selection.to &&
|
|
2732
2739
|
change.start == change.endB &&
|
|
2733
2740
|
view.state.selection instanceof prosemirrorState.TextSelection) {
|
|
2734
|
-
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2
|
|
2741
|
+
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&
|
|
2742
|
+
view.state.selection.from >= parse.from) {
|
|
2735
2743
|
change.start = view.state.selection.from;
|
|
2736
|
-
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2
|
|
2744
|
+
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&
|
|
2745
|
+
view.state.selection.to <= parse.to) {
|
|
2737
2746
|
change.endB += (view.state.selection.to - change.endA);
|
|
2738
2747
|
change.endA = view.state.selection.to;
|
|
2739
2748
|
}
|
|
@@ -4672,9 +4681,10 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4672
4681
|
var shift = function (oldStart, oldEnd, newStart, newEnd) {
|
|
4673
4682
|
for (var i = 0; i < children.length; i += 3) {
|
|
4674
4683
|
var end = children[i + 1], dSize = (void 0);
|
|
4675
|
-
if (end
|
|
4676
|
-
|
|
4677
|
-
|
|
4684
|
+
if (end < 0 || oldStart > end + oldOffset) { continue }
|
|
4685
|
+
var start = children[i] + oldOffset;
|
|
4686
|
+
if (oldEnd >= start) {
|
|
4687
|
+
children[i + 1] = oldStart <= start ? -2 : -1;
|
|
4678
4688
|
} else if (newStart >= offset && (dSize = (newEnd - newStart) - (oldEnd - oldStart))) {
|
|
4679
4689
|
children[i] += dSize;
|
|
4680
4690
|
children[i + 1] += dSize;
|
|
@@ -4686,7 +4696,12 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4686
4696
|
// Find the child nodes that still correspond to a single node,
|
|
4687
4697
|
// recursively call mapInner on them and update their positions.
|
|
4688
4698
|
var mustRebuild = false;
|
|
4689
|
-
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1]
|
|
4699
|
+
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] < 0) { // Touched nodes
|
|
4700
|
+
if (children[i$1 + 1] == -2) {
|
|
4701
|
+
mustRebuild = true;
|
|
4702
|
+
children[i$1 + 1] = -1;
|
|
4703
|
+
continue
|
|
4704
|
+
}
|
|
4690
4705
|
var from = mapping.map(oldChildren[i$1] + oldOffset), fromLocal = from - offset;
|
|
4691
4706
|
if (fromLocal < 0 || fromLocal >= node.content.size) {
|
|
4692
4707
|
mustRebuild = true;
|
|
@@ -5282,6 +5297,7 @@ function updateCursorWrapper(view) {
|
|
|
5282
5297
|
var dom = document.createElement("img");
|
|
5283
5298
|
dom.className = "ProseMirror-separator";
|
|
5284
5299
|
dom.setAttribute("mark-placeholder", "true");
|
|
5300
|
+
dom.setAttribute("alt", "");
|
|
5285
5301
|
view.cursorWrapper = {dom: dom, deco: Decoration.widget(view.state.selection.head, dom, {raw: true, marks: view.markCursor})};
|
|
5286
5302
|
} else {
|
|
5287
5303
|
view.cursorWrapper = null;
|