prosemirror-view 1.41.0 → 1.41.2
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 +12 -0
- package/dist/index.cjs +7 -6
- package/dist/index.js +7 -9
- package/package.json +1 -1
- package/src/domchange.ts +1 -4
- package/src/input.ts +1 -1
- package/src/viewdesc.ts +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 1.41.2 (2025-09-29)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where some Backspace presses with SwiftKey on Android would get interpreted as Enter.
|
|
6
|
+
|
|
7
|
+
## 1.41.1 (2025-09-19)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Consistently set `draggable` on a node's inner DOM representation, not a decoration wrapper element.
|
|
12
|
+
|
|
1
13
|
## 1.41.0 (2025-09-06)
|
|
2
14
|
|
|
3
15
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -1427,15 +1427,17 @@ var NodeViewDesc = function (_ViewDesc4) {
|
|
|
1427
1427
|
}, {
|
|
1428
1428
|
key: "selectNode",
|
|
1429
1429
|
value: function selectNode() {
|
|
1430
|
-
if (this.nodeDOM.nodeType == 1)
|
|
1431
|
-
|
|
1430
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
1431
|
+
this.nodeDOM.classList.add("ProseMirror-selectednode");
|
|
1432
|
+
if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.draggable = true;
|
|
1433
|
+
}
|
|
1432
1434
|
}
|
|
1433
1435
|
}, {
|
|
1434
1436
|
key: "deselectNode",
|
|
1435
1437
|
value: function deselectNode() {
|
|
1436
1438
|
if (this.nodeDOM.nodeType == 1) {
|
|
1437
1439
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
1438
|
-
if (this.contentDOM || !this.node.type.spec.draggable) this.
|
|
1440
|
+
if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.removeAttribute("draggable");
|
|
1439
1441
|
}
|
|
1440
1442
|
}
|
|
1441
1443
|
}, {
|
|
@@ -3171,7 +3173,7 @@ var MouseDown = function () {
|
|
|
3171
3173
|
}
|
|
3172
3174
|
var target = flushed ? null : event.target;
|
|
3173
3175
|
var targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
3174
|
-
this.target = targetDesc && targetDesc.
|
|
3176
|
+
this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
|
|
3175
3177
|
var selection = view.state.selection;
|
|
3176
3178
|
if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof prosemirrorState.NodeSelection && selection.from <= targetPos && selection.to > targetPos) this.mightDrag = {
|
|
3177
3179
|
node: targetNode,
|
|
@@ -4688,10 +4690,9 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
4688
4690
|
var $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
4689
4691
|
var $fromA = doc.resolve(change.start);
|
|
4690
4692
|
var inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
4691
|
-
var nextSel;
|
|
4692
4693
|
if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some(function (n) {
|
|
4693
4694
|
return n.nodeName == "DIV" || n.nodeName == "P";
|
|
4694
|
-
})) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))
|
|
4695
|
+
})) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", function (f) {
|
|
4695
4696
|
return f(view, keyEvent(13, "Enter"));
|
|
4696
4697
|
})) {
|
|
4697
4698
|
view.input.lastIOSEnter = 0;
|
package/dist/index.js
CHANGED
|
@@ -1484,17 +1484,18 @@ class NodeViewDesc extends ViewDesc {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
// Mark this node as being the selected node.
|
|
1486
1486
|
selectNode() {
|
|
1487
|
-
if (this.nodeDOM.nodeType == 1)
|
|
1487
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
1488
1488
|
this.nodeDOM.classList.add("ProseMirror-selectednode");
|
|
1489
|
-
|
|
1490
|
-
|
|
1489
|
+
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
1490
|
+
this.nodeDOM.draggable = true;
|
|
1491
|
+
}
|
|
1491
1492
|
}
|
|
1492
1493
|
// Remove selected node marking from this node.
|
|
1493
1494
|
deselectNode() {
|
|
1494
1495
|
if (this.nodeDOM.nodeType == 1) {
|
|
1495
1496
|
this.nodeDOM.classList.remove("ProseMirror-selectednode");
|
|
1496
1497
|
if (this.contentDOM || !this.node.type.spec.draggable)
|
|
1497
|
-
this.
|
|
1498
|
+
this.nodeDOM.removeAttribute("draggable");
|
|
1498
1499
|
}
|
|
1499
1500
|
}
|
|
1500
1501
|
get domAtom() { return this.node.isAtom; }
|
|
@@ -3346,7 +3347,7 @@ class MouseDown {
|
|
|
3346
3347
|
}
|
|
3347
3348
|
const target = flushed ? null : event.target;
|
|
3348
3349
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
|
|
3349
|
-
this.target = targetDesc && targetDesc.
|
|
3350
|
+
this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
|
|
3350
3351
|
let { selection } = view.state;
|
|
3351
3352
|
if (event.button == 0 &&
|
|
3352
3353
|
targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||
|
|
@@ -5028,16 +5029,13 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
|
|
|
5028
5029
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from);
|
|
5029
5030
|
let $fromA = doc.resolve(change.start);
|
|
5030
5031
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
|
|
5031
|
-
let nextSel;
|
|
5032
5032
|
// If this looks like the effect of pressing Enter (or was recorded
|
|
5033
5033
|
// as being an iOS enter press), just dispatch an Enter key instead.
|
|
5034
5034
|
if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&
|
|
5035
5035
|
(!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
|
|
5036
5036
|
(!inlineChange && $from.pos < parse.doc.content.size &&
|
|
5037
5037
|
(!$from.sameParent($to) || !$from.parent.inlineContent) &&
|
|
5038
|
-
!/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) &&
|
|
5039
|
-
(nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&
|
|
5040
|
-
nextSel.head > $from.pos)) &&
|
|
5038
|
+
$from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")))) &&
|
|
5041
5039
|
view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
|
|
5042
5040
|
view.input.lastIOSEnter = 0;
|
|
5043
5041
|
return;
|
package/package.json
CHANGED
package/src/domchange.ts
CHANGED
|
@@ -176,16 +176,13 @@ export function readDOMChange(view: EditorView, from: number, to: number, typeOv
|
|
|
176
176
|
let $to = parse.doc.resolveNoCache(change.endB - parse.from)
|
|
177
177
|
let $fromA = doc.resolve(change.start)
|
|
178
178
|
let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA
|
|
179
|
-
let nextSel
|
|
180
179
|
// If this looks like the effect of pressing Enter (or was recorded
|
|
181
180
|
// as being an iOS enter press), just dispatch an Enter key instead.
|
|
182
181
|
if (((browser.ios && view.input.lastIOSEnter > Date.now() - 225 &&
|
|
183
182
|
(!inlineChange || addedNodes.some(n => n.nodeName == "DIV" || n.nodeName == "P"))) ||
|
|
184
183
|
(!inlineChange && $from.pos < parse.doc.content.size &&
|
|
185
184
|
(!$from.sameParent($to) || !$from.parent.inlineContent) &&
|
|
186
|
-
!/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) &&
|
|
187
|
-
(nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&
|
|
188
|
-
nextSel.head > $from.pos)) &&
|
|
185
|
+
$from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")))) &&
|
|
189
186
|
view.someProp("handleKeyDown", f => f(view, keyEvent(13, "Enter")))) {
|
|
190
187
|
view.input.lastIOSEnter = 0
|
|
191
188
|
return
|
package/src/input.ts
CHANGED
|
@@ -329,7 +329,7 @@ class MouseDown {
|
|
|
329
329
|
|
|
330
330
|
const target = flushed ? null : event.target as HTMLElement
|
|
331
331
|
const targetDesc = target ? view.docView.nearestDesc(target, true) : null
|
|
332
|
-
this.target = targetDesc && targetDesc.
|
|
332
|
+
this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM as HTMLElement : null
|
|
333
333
|
|
|
334
334
|
let {selection} = view.state
|
|
335
335
|
if (event.button == 0 &&
|
package/src/viewdesc.ts
CHANGED
|
@@ -884,15 +884,17 @@ export class NodeViewDesc extends ViewDesc {
|
|
|
884
884
|
|
|
885
885
|
// Mark this node as being the selected node.
|
|
886
886
|
selectNode() {
|
|
887
|
-
if (this.nodeDOM.nodeType == 1)
|
|
888
|
-
|
|
887
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
888
|
+
;(this.nodeDOM as HTMLElement).classList.add("ProseMirror-selectednode")
|
|
889
|
+
if (this.contentDOM || !this.node.type.spec.draggable) (this.nodeDOM as HTMLElement).draggable = true
|
|
890
|
+
}
|
|
889
891
|
}
|
|
890
892
|
|
|
891
893
|
// Remove selected node marking from this node.
|
|
892
894
|
deselectNode() {
|
|
893
895
|
if (this.nodeDOM.nodeType == 1) {
|
|
894
896
|
;(this.nodeDOM as HTMLElement).classList.remove("ProseMirror-selectednode")
|
|
895
|
-
if (this.contentDOM || !this.node.type.spec.draggable) (this.
|
|
897
|
+
if (this.contentDOM || !this.node.type.spec.draggable) (this.nodeDOM as HTMLElement).removeAttribute("draggable")
|
|
896
898
|
}
|
|
897
899
|
}
|
|
898
900
|
|