prosemirror-view 1.23.8 → 1.23.11
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 +32 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decoration.js +10 -4
- package/src/index.js +1 -0
- package/src/viewdesc.js +21 -3
package/dist/index.js
CHANGED
|
@@ -1300,8 +1300,23 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
|
|
|
1300
1300
|
// whether this is a problem
|
|
1301
1301
|
var rule = {node: this.node.type.name, attrs: this.node.attrs};
|
|
1302
1302
|
if (this.node.type.whitespace == "pre") { rule.preserveWhitespace = "full"; }
|
|
1303
|
-
if (this.contentDOM
|
|
1304
|
-
|
|
1303
|
+
if (!this.contentDOM) {
|
|
1304
|
+
rule.getContent = function () { return this$1.node.content; };
|
|
1305
|
+
} else if (!this.contentLost) {
|
|
1306
|
+
rule.contentElement = this.contentDOM;
|
|
1307
|
+
} else {
|
|
1308
|
+
// Chrome likes to randomly recreate parent nodes when
|
|
1309
|
+
// backspacing things. When that happens, this tries to find the
|
|
1310
|
+
// new parent.
|
|
1311
|
+
for (var i = this.children.length - 1; i >= 0; i--) {
|
|
1312
|
+
var child = this.children[i];
|
|
1313
|
+
if (this.dom.contains(child.dom.parentNode)) {
|
|
1314
|
+
rule.contentElement = child.dom.parentNode;
|
|
1315
|
+
break
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
if (!rule.contentElement) { rule.getContent = function () { return prosemirrorModel.Fragment.empty; }; }
|
|
1319
|
+
}
|
|
1305
1320
|
return rule
|
|
1306
1321
|
};
|
|
1307
1322
|
|
|
@@ -1928,7 +1943,10 @@ ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
|
|
|
1928
1943
|
this.index++;
|
|
1929
1944
|
} else {
|
|
1930
1945
|
var dom = document.createElement(nodeName);
|
|
1931
|
-
if (nodeName == "IMG") {
|
|
1946
|
+
if (nodeName == "IMG") {
|
|
1947
|
+
dom.className = "ProseMirror-separator";
|
|
1948
|
+
dom.alt = "";
|
|
1949
|
+
}
|
|
1932
1950
|
if (nodeName == "BR") { dom.className = "ProseMirror-trailingBreak"; }
|
|
1933
1951
|
this.top.children.splice(this.index++, 0, new TrailingHackViewDesc(this.top, nothing, dom, null));
|
|
1934
1952
|
this.changed = true;
|
|
@@ -4678,9 +4696,10 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4678
4696
|
var shift = function (oldStart, oldEnd, newStart, newEnd) {
|
|
4679
4697
|
for (var i = 0; i < children.length; i += 3) {
|
|
4680
4698
|
var end = children[i + 1], dSize = (void 0);
|
|
4681
|
-
if (end
|
|
4682
|
-
|
|
4683
|
-
|
|
4699
|
+
if (end < 0 || oldStart > end + oldOffset) { continue }
|
|
4700
|
+
var start = children[i] + oldOffset;
|
|
4701
|
+
if (oldEnd >= start) {
|
|
4702
|
+
children[i + 1] = oldStart <= start ? -2 : -1;
|
|
4684
4703
|
} else if (newStart >= offset && (dSize = (newEnd - newStart) - (oldEnd - oldStart))) {
|
|
4685
4704
|
children[i] += dSize;
|
|
4686
4705
|
children[i + 1] += dSize;
|
|
@@ -4692,7 +4711,12 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4692
4711
|
// Find the child nodes that still correspond to a single node,
|
|
4693
4712
|
// recursively call mapInner on them and update their positions.
|
|
4694
4713
|
var mustRebuild = false;
|
|
4695
|
-
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1]
|
|
4714
|
+
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] < 0) { // Touched nodes
|
|
4715
|
+
if (children[i$1 + 1] == -2) {
|
|
4716
|
+
mustRebuild = true;
|
|
4717
|
+
children[i$1 + 1] = -1;
|
|
4718
|
+
continue
|
|
4719
|
+
}
|
|
4696
4720
|
var from = mapping.map(oldChildren[i$1] + oldOffset), fromLocal = from - offset;
|
|
4697
4721
|
if (fromLocal < 0 || fromLocal >= node.content.size) {
|
|
4698
4722
|
mustRebuild = true;
|
|
@@ -5288,6 +5312,7 @@ function updateCursorWrapper(view) {
|
|
|
5288
5312
|
var dom = document.createElement("img");
|
|
5289
5313
|
dom.className = "ProseMirror-separator";
|
|
5290
5314
|
dom.setAttribute("mark-placeholder", "true");
|
|
5315
|
+
dom.setAttribute("alt", "");
|
|
5291
5316
|
view.cursorWrapper = {dom: dom, deco: Decoration.widget(view.state.selection.head, dom, {raw: true, marks: view.markCursor})};
|
|
5292
5317
|
} else {
|
|
5293
5318
|
view.cursorWrapper = null;
|