prosemirror-view 1.23.9 → 1.23.12
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 +34 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +34 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decoration.js +10 -4
- package/src/domchange.js +7 -5
- package/src/viewdesc.js +17 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 1.23.12 (2022-04-08)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where enter on Chrome Android could, in textblock nodes rendered with an inner content element, delete the text after the cursor.
|
|
6
|
+
|
|
7
|
+
## 1.23.11 (2022-03-31)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
## 1.23.10 (2022-03-22)
|
|
14
|
+
|
|
15
|
+
### Bug fixes
|
|
16
|
+
|
|
17
|
+
Fix a crash in `DecorationSet.map` that could occur with some kinds of lift transformations.
|
|
18
|
+
|
|
1
19
|
## 1.23.9 (2022-03-11)
|
|
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
|
|
|
@@ -2710,15 +2725,17 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
2710
2725
|
view.lastKeyCode = null;
|
|
2711
2726
|
|
|
2712
2727
|
var change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
|
|
2728
|
+
if ((result.ios && view.lastIOSEnter > Date.now() - 225 || result.android) &&
|
|
2729
|
+
addedNodes.some(function (n) { return n.nodeName == "DIV" || n.nodeName == "P"; }) &&
|
|
2730
|
+
(!change || change.endA >= change.endB) &&
|
|
2731
|
+
view.someProp("handleKeyDown", function (f) { return f(view, keyEvent(13, "Enter")); })) {
|
|
2732
|
+
view.lastIOSEnter = 0;
|
|
2733
|
+
return
|
|
2734
|
+
}
|
|
2713
2735
|
if (!change) {
|
|
2714
2736
|
if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) &&
|
|
2715
2737
|
!view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {
|
|
2716
2738
|
change = {start: sel.from, endA: sel.to, endB: sel.to};
|
|
2717
|
-
} else if ((result.ios && view.lastIOSEnter > Date.now() - 225 || result.android) &&
|
|
2718
|
-
addedNodes.some(function (n) { return n.nodeName == "DIV" || n.nodeName == "P"; }) &&
|
|
2719
|
-
view.someProp("handleKeyDown", function (f) { return f(view, keyEvent(13, "Enter")); })) {
|
|
2720
|
-
view.lastIOSEnter = 0;
|
|
2721
|
-
return
|
|
2722
2739
|
} else {
|
|
2723
2740
|
if (parse.sel) {
|
|
2724
2741
|
var sel$1 = resolveSelection(view, view.state.doc, parse.sel);
|
|
@@ -4677,9 +4694,10 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4677
4694
|
var shift = function (oldStart, oldEnd, newStart, newEnd) {
|
|
4678
4695
|
for (var i = 0; i < children.length; i += 3) {
|
|
4679
4696
|
var end = children[i + 1], dSize = (void 0);
|
|
4680
|
-
if (end
|
|
4681
|
-
|
|
4682
|
-
|
|
4697
|
+
if (end < 0 || oldStart > end + oldOffset) { continue }
|
|
4698
|
+
var start = children[i] + oldOffset;
|
|
4699
|
+
if (oldEnd >= start) {
|
|
4700
|
+
children[i + 1] = oldStart <= start ? -2 : -1;
|
|
4683
4701
|
} else if (newStart >= offset && (dSize = (newEnd - newStart) - (oldEnd - oldStart))) {
|
|
4684
4702
|
children[i] += dSize;
|
|
4685
4703
|
children[i + 1] += dSize;
|
|
@@ -4691,7 +4709,12 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
|
|
|
4691
4709
|
// Find the child nodes that still correspond to a single node,
|
|
4692
4710
|
// recursively call mapInner on them and update their positions.
|
|
4693
4711
|
var mustRebuild = false;
|
|
4694
|
-
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1]
|
|
4712
|
+
for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] < 0) { // Touched nodes
|
|
4713
|
+
if (children[i$1 + 1] == -2) {
|
|
4714
|
+
mustRebuild = true;
|
|
4715
|
+
children[i$1 + 1] = -1;
|
|
4716
|
+
continue
|
|
4717
|
+
}
|
|
4695
4718
|
var from = mapping.map(oldChildren[i$1] + oldOffset), fromLocal = from - offset;
|
|
4696
4719
|
if (fromLocal < 0 || fromLocal >= node.content.size) {
|
|
4697
4720
|
mustRebuild = true;
|