prosemirror-view 1.41.0 → 1.41.1
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 +6 -0
- package/dist/index.cjs +6 -4
- package/dist/index.js +6 -5
- package/package.json +1 -1
- package/src/input.ts +1 -1
- package/src/viewdesc.ts +5 -3
package/CHANGELOG.md
CHANGED
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,
|
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 ||
|
package/package.json
CHANGED
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
|
|