prosemirror-view 1.23.4 → 1.23.7
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 +24 -0
- package/dist/index.es.js +20 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/dom.js +2 -1
- package/src/domchange.js +1 -1
- package/src/domobserver.js +1 -1
- package/src/index.js +4 -1
- package/src/input.js +1 -1
- package/src/selection.js +4 -1
- package/src/viewdesc.js +7 -3
package/dist/index.js
CHANGED
|
@@ -68,7 +68,8 @@ function scanFor(node, off, targetNode, targetOff, dir) {
|
|
|
68
68
|
if (node == targetNode && off == targetOff) { return true }
|
|
69
69
|
if (off == (dir < 0 ? 0 : nodeSize(node))) {
|
|
70
70
|
var parent = node.parentNode;
|
|
71
|
-
if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) ||
|
|
71
|
+
if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) ||
|
|
72
|
+
node.contentEditable == "false")
|
|
72
73
|
{ return false }
|
|
73
74
|
off = domIndex(node) + (dir < 0 ? 0 : 1);
|
|
74
75
|
node = parent;
|
|
@@ -1055,7 +1056,8 @@ ViewDesc.prototype.markDirty = function markDirty (from, to) {
|
|
|
1055
1056
|
else { child.markDirty(from - startInside, to - startInside); }
|
|
1056
1057
|
return
|
|
1057
1058
|
} else {
|
|
1058
|
-
child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM
|
|
1059
|
+
child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length
|
|
1060
|
+
? CONTENT_DIRTY : NODE_DIRTY;
|
|
1059
1061
|
}
|
|
1060
1062
|
}
|
|
1061
1063
|
offset = end;
|
|
@@ -1193,7 +1195,10 @@ var MarkViewDesc = /*@__PURE__*/(function (ViewDesc) {
|
|
|
1193
1195
|
return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom)
|
|
1194
1196
|
};
|
|
1195
1197
|
|
|
1196
|
-
MarkViewDesc.prototype.parseRule = function parseRule () {
|
|
1198
|
+
MarkViewDesc.prototype.parseRule = function parseRule () {
|
|
1199
|
+
if ((this.dirty & NODE_DIRTY) || this.mark.type.spec.reparseInView) { return null }
|
|
1200
|
+
return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM}
|
|
1201
|
+
};
|
|
1197
1202
|
|
|
1198
1203
|
MarkViewDesc.prototype.matchesMark = function matchesMark (mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark) };
|
|
1199
1204
|
|
|
@@ -1294,7 +1299,7 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
|
|
|
1294
1299
|
// attrs in the dom, that won't be picked up. Not entirely sure
|
|
1295
1300
|
// whether this is a problem
|
|
1296
1301
|
var rule = {node: this.node.type.name, attrs: this.node.attrs};
|
|
1297
|
-
if (this.node.type.
|
|
1302
|
+
if (this.node.type.whitespace == "pre") { rule.preserveWhitespace = "full"; }
|
|
1298
1303
|
if (this.contentDOM && !this.contentLost) { rule.contentElement = this.contentDOM; }
|
|
1299
1304
|
else { rule.getContent = function () { return this$1.contentDOM ? prosemirrorModel.Fragment.empty : this$1.node.content; }; }
|
|
1300
1305
|
return rule
|
|
@@ -2152,7 +2157,10 @@ function selectionToDOM(view, force) {
|
|
|
2152
2157
|
|
|
2153
2158
|
if (!editorOwnsSelection(view)) { return }
|
|
2154
2159
|
|
|
2155
|
-
|
|
2160
|
+
// The delayed drag selection causes issues with Cell Selections
|
|
2161
|
+
// in Safari. And the drag selection delay is to workarond issues
|
|
2162
|
+
// which only present in Chrome.
|
|
2163
|
+
if (!force && view.mouseDown && view.mouseDown.allowDefault && result.chrome) {
|
|
2156
2164
|
var domSel = view.root.getSelection(), curSel = view.domObserver.currentSelection;
|
|
2157
2165
|
if (domSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset,
|
|
2158
2166
|
curSel.anchorNode, curSel.anchorOffset)) {
|
|
@@ -2624,7 +2632,7 @@ function parseBetween(view, from_, to_) {
|
|
|
2624
2632
|
topOpen: true,
|
|
2625
2633
|
from: fromOffset,
|
|
2626
2634
|
to: toOffset,
|
|
2627
|
-
preserveWhitespace: $from.parent.type.
|
|
2635
|
+
preserveWhitespace: $from.parent.type.whitespace == "pre" ? "full" : true,
|
|
2628
2636
|
editableContent: true,
|
|
2629
2637
|
findPositions: find,
|
|
2630
2638
|
ruleFromNode: ruleFromNode,
|
|
@@ -3355,7 +3363,7 @@ DOMObserver.prototype.flush = function flush () {
|
|
|
3355
3363
|
checkCSS(this.view);
|
|
3356
3364
|
}
|
|
3357
3365
|
this.handleDOMChange(from, to, typeOver, added);
|
|
3358
|
-
if (this.view.docView.dirty) { this.view.updateState(this.view.state); }
|
|
3366
|
+
if (this.view.docView && this.view.docView.dirty) { this.view.updateState(this.view.state); }
|
|
3359
3367
|
else if (!this.currentSelection.eq(sel)) { selectionToDOM(this.view); }
|
|
3360
3368
|
this.currentSelection.set(sel);
|
|
3361
3369
|
}
|
|
@@ -3906,7 +3914,7 @@ function endComposition(view, forceUpdate) {
|
|
|
3906
3914
|
if (result.android && view.domObserver.flushingSoon >= 0) { return }
|
|
3907
3915
|
view.domObserver.forceFlush();
|
|
3908
3916
|
clearComposition(view);
|
|
3909
|
-
if (forceUpdate || view.docView.dirty) {
|
|
3917
|
+
if (forceUpdate || view.docView && view.docView.dirty) {
|
|
3910
3918
|
var sel = selectionFromDOM(view);
|
|
3911
3919
|
if (sel && !sel.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel)); }
|
|
3912
3920
|
else { view.updateState(view.state); }
|
|
@@ -5448,7 +5456,10 @@ function checkStateComponent(plugin) {
|
|
|
5448
5456
|
// The DOM serializer to use when putting content onto the
|
|
5449
5457
|
// clipboard. If not given, the result of
|
|
5450
5458
|
// [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)
|
|
5451
|
-
// will be used.
|
|
5459
|
+
// will be used. This object will only have its
|
|
5460
|
+
// [`serializeFragment`](#model.DOMSerializer.serializeFragment)
|
|
5461
|
+
// method called, and you may provide an alternative object type
|
|
5462
|
+
// implementing a compatible method.
|
|
5452
5463
|
//
|
|
5453
5464
|
// clipboardTextSerializer:: ?(Slice) → string
|
|
5454
5465
|
// A function that will be called to get the text for the current
|