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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 1.23.11 (2022-03-31)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where a node view with a separate content wrapper node could sometimes lose its content on Chrome when backspacing out content due to unexpected DOM element recreation.
|
|
6
|
+
|
|
7
|
+
## 1.23.10 (2022-03-22)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Fix a crash in `DecorationSet.map` that could occur with some kinds of lift transformations.
|
|
12
|
+
|
|
13
|
+
## 1.23.9 (2022-03-11)
|
|
14
|
+
|
|
15
|
+
### Bug fixes
|
|
16
|
+
|
|
17
|
+
Make sure screen readers don't read the `<img>` nodes added as kludge for cursor behavior.
|
|
18
|
+
|
|
1
19
|
## 1.23.8 (2022-03-10)
|
|
2
20
|
|
|
3
21
|
### Bug fixes
|
package/dist/index.es.js
CHANGED
|
@@ -1296,8 +1296,23 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
|
|
|
1296
1296
|
// whether this is a problem
|
|
1297
1297
|
var rule = {node: this.node.type.name, attrs: this.node.attrs};
|
|
1298
1298
|
if (this.node.type.whitespace == "pre") { rule.preserveWhitespace = "full"; }
|
|
1299
|
-
if (this.contentDOM
|
|
1300
|
-
|
|
1299
|
+
if (!this.contentDOM) {
|
|
1300
|
+
rule.getContent = function () { return this$1.node.content; };
|
|
1301
|
+
} else if (!this.contentLost) {
|
|
1302
|
+
rule.contentElement = this.contentDOM;
|
|
1303
|
+
} else {
|
|
1304
|
+
// Chrome likes to randomly recreate parent nodes when
|
|
1305
|
+
// backspacing things. When that happens, this tries to find the
|
|
1306
|
+
// new parent.
|
|
1307
|
+
for (var i = this.children.length - 1; i >= 0; i--) {
|
|
1308
|
+
var child = this.children[i];
|
|
1309
|
+
if (this.dom.contains(child.dom.parentNode)) {
|
|
1310
|
+
rule.contentElement = child.dom.parentNode;
|
|
1311
|
+
break
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
if (!rule.contentElement) { rule.getContent = function () { return Fragment.empty; }; }
|
|
1315
|
+
}
|
|
1301
1316
|
return rule
|
|
1302
1317
|
};
|
|
1303
1318
|
|
|
@@ -1924,7 +1939,10 @@ ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
|
|
|
1924
1939
|
this.index++;
|
|
1925
1940
|
} else {
|
|
1926
1941
|
var dom = document.createElement(nodeName);
|
|
1927
|
-
if (nodeName == "IMG") {
|
|
1942
|
+
if (nodeName == "IMG") {
|
|
1943
|
+
dom.className = "ProseMirror-separator";
|
|
1944
|
+
dom.alt = "";
|
|
1945
|
+
}
|
|
1928
1946
|
if (nodeName == "BR") { dom.className = "ProseMirror-trailingBreak"; }
|
|
1929
1947
|
this.top.children.splice(this.index++, 0, new TrailingHackViewDesc(this.top, nothing, dom, null));
|
|
1930
1948
|
this.changed = true;
|
|
@@ -4674,9 +4692,10 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4674
4692
|
var shift = function (oldStart, oldEnd, newStart, newEnd) {
|
|
4675
4693
|
for (var i = 0; i < children.length; i += 3) {
|
|
4676
4694
|
var end = children[i + 1], dSize = (void 0);
|
|
4677
|
-
if (end
|
|
4678
|
-
|
|
4679
|
-
|
|
4695
|
+
if (end < 0 || oldStart > end + oldOffset) { continue }
|
|
4696
|
+
var start = children[i] + oldOffset;
|
|
4697
|
+
if (oldEnd >= start) {
|
|
4698
|
+
children[i + 1] = oldStart <= start ? -2 : -1;
|
|
4680
4699
|
} else if (newStart >= offset && (dSize = (newEnd - newStart) - (oldEnd - oldStart))) {
|
|
4681
4700
|
children[i] += dSize;
|
|
4682
4701
|
children[i + 1] += dSize;
|
|
@@ -4688,7 +4707,12 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4688
4707
|
// Find the child nodes that still correspond to a single node,
|
|
4689
4708
|
// recursively call mapInner on them and update their positions.
|
|
4690
4709
|
var mustRebuild = false;
|
|
4691
|
-
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1]
|
|
4710
|
+
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] < 0) { // Touched nodes
|
|
4711
|
+
if (children[i$1 + 1] == -2) {
|
|
4712
|
+
mustRebuild = true;
|
|
4713
|
+
children[i$1 + 1] = -1;
|
|
4714
|
+
continue
|
|
4715
|
+
}
|
|
4692
4716
|
var from = mapping.map(oldChildren[i$1] + oldOffset), fromLocal = from - offset;
|
|
4693
4717
|
if (fromLocal < 0 || fromLocal >= node.content.size) {
|
|
4694
4718
|
mustRebuild = true;
|
|
@@ -5284,6 +5308,7 @@ function updateCursorWrapper(view) {
|
|
|
5284
5308
|
var dom = document.createElement("img");
|
|
5285
5309
|
dom.className = "ProseMirror-separator";
|
|
5286
5310
|
dom.setAttribute("mark-placeholder", "true");
|
|
5311
|
+
dom.setAttribute("alt", "");
|
|
5287
5312
|
view.cursorWrapper = {dom: dom, deco: Decoration.widget(view.state.selection.head, dom, {raw: true, marks: view.markCursor})};
|
|
5288
5313
|
} else {
|
|
5289
5314
|
view.cursorWrapper = null;
|