prosemirror-view 1.31.1 → 1.31.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 +8 -0
- package/dist/index.cjs +4 -23
- package/dist/index.js +3 -16
- package/package.json +1 -1
- package/src/index.ts +2 -3
- package/src/viewdesc.ts +0 -12
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1134,21 +1134,6 @@ var ViewDesc = function () {
|
|
|
1134
1134
|
|
|
1135
1135
|
if (node.nodeType == 3) {
|
|
1136
1136
|
brKludge = !!(_offset && node.nodeValue[_offset - 1] == "\n");
|
|
1137
|
-
|
|
1138
|
-
if (brKludge && _offset == node.nodeValue.length) {
|
|
1139
|
-
for (var scan = node, after; scan; scan = scan.parentNode) {
|
|
1140
|
-
if (after = scan.nextSibling) {
|
|
1141
|
-
if (after.nodeName == "BR") anchorDOM = headDOM = {
|
|
1142
|
-
node: after.parentNode,
|
|
1143
|
-
offset: domIndex(after) + 1
|
|
1144
|
-
};
|
|
1145
|
-
break;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
var desc = scan.pmViewDesc;
|
|
1149
|
-
if (desc && desc.node && desc.node.isBlock) break;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
1137
|
} else {
|
|
1153
1138
|
var prev = node.childNodes[_offset - 1];
|
|
1154
1139
|
brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
|
|
@@ -1156,8 +1141,8 @@ var ViewDesc = function () {
|
|
|
1156
1141
|
}
|
|
1157
1142
|
|
|
1158
1143
|
if (gecko && domSel.focusNode && domSel.focusNode != headDOM.node && domSel.focusNode.nodeType == 1) {
|
|
1159
|
-
var
|
|
1160
|
-
if (
|
|
1144
|
+
var after = domSel.focusNode.childNodes[domSel.focusOffset];
|
|
1145
|
+
if (after && after.contentEditable == "false") force = true;
|
|
1161
1146
|
}
|
|
1162
1147
|
|
|
1163
1148
|
if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, domSel.focusNode, domSel.focusOffset)) return;
|
|
@@ -5959,17 +5944,13 @@ function computeDocDeco(view) {
|
|
|
5959
5944
|
var attrs = Object.create(null);
|
|
5960
5945
|
attrs["class"] = "ProseMirror";
|
|
5961
5946
|
attrs.contenteditable = String(view.editable);
|
|
5962
|
-
attrs.translate = "no";
|
|
5963
5947
|
view.someProp("attributes", function (value) {
|
|
5964
5948
|
if (typeof value == "function") value = value(view.state);
|
|
5965
5949
|
if (value) for (var attr in value) {
|
|
5966
|
-
if (attr == "class") attrs["class"] += " " + value[attr];
|
|
5967
|
-
|
|
5968
|
-
if (attr == "style") {
|
|
5969
|
-
attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr];
|
|
5970
|
-
} else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName") attrs[attr] = String(value[attr]);
|
|
5950
|
+
if (attr == "class") attrs["class"] += " " + value[attr];else if (attr == "style") attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr];else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName") attrs[attr] = String(value[attr]);
|
|
5971
5951
|
}
|
|
5972
5952
|
});
|
|
5953
|
+
if (!attrs.translate) attrs.translate = "no";
|
|
5973
5954
|
return [Decoration.node(0, view.state.doc.content.size, attrs)];
|
|
5974
5955
|
}
|
|
5975
5956
|
|
package/dist/index.js
CHANGED
|
@@ -957,19 +957,6 @@ class ViewDesc {
|
|
|
957
957
|
let { node, offset } = anchorDOM;
|
|
958
958
|
if (node.nodeType == 3) {
|
|
959
959
|
brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
|
|
960
|
-
// Issue #1128
|
|
961
|
-
if (brKludge && offset == node.nodeValue.length) {
|
|
962
|
-
for (let scan = node, after; scan; scan = scan.parentNode) {
|
|
963
|
-
if (after = scan.nextSibling) {
|
|
964
|
-
if (after.nodeName == "BR")
|
|
965
|
-
anchorDOM = headDOM = { node: after.parentNode, offset: domIndex(after) + 1 };
|
|
966
|
-
break;
|
|
967
|
-
}
|
|
968
|
-
let desc = scan.pmViewDesc;
|
|
969
|
-
if (desc && desc.node && desc.node.isBlock)
|
|
970
|
-
break;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
960
|
}
|
|
974
961
|
else {
|
|
975
962
|
let prev = node.childNodes[offset - 1];
|
|
@@ -5435,7 +5422,6 @@ function computeDocDeco(view) {
|
|
|
5435
5422
|
let attrs = Object.create(null);
|
|
5436
5423
|
attrs.class = "ProseMirror";
|
|
5437
5424
|
attrs.contenteditable = String(view.editable);
|
|
5438
|
-
attrs.translate = "no";
|
|
5439
5425
|
view.someProp("attributes", value => {
|
|
5440
5426
|
if (typeof value == "function")
|
|
5441
5427
|
value = value(view.state);
|
|
@@ -5443,13 +5429,14 @@ function computeDocDeco(view) {
|
|
|
5443
5429
|
for (let attr in value) {
|
|
5444
5430
|
if (attr == "class")
|
|
5445
5431
|
attrs.class += " " + value[attr];
|
|
5446
|
-
if (attr == "style")
|
|
5432
|
+
else if (attr == "style")
|
|
5447
5433
|
attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr];
|
|
5448
|
-
}
|
|
5449
5434
|
else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName")
|
|
5450
5435
|
attrs[attr] = String(value[attr]);
|
|
5451
5436
|
}
|
|
5452
5437
|
});
|
|
5438
|
+
if (!attrs.translate)
|
|
5439
|
+
attrs.translate = "no";
|
|
5453
5440
|
return [Decoration.node(0, view.state.doc.content.size, attrs)];
|
|
5454
5441
|
}
|
|
5455
5442
|
function updateCursorWrapper(view) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -478,20 +478,19 @@ function computeDocDeco(view: EditorView) {
|
|
|
478
478
|
let attrs = Object.create(null)
|
|
479
479
|
attrs.class = "ProseMirror"
|
|
480
480
|
attrs.contenteditable = String(view.editable)
|
|
481
|
-
attrs.translate = "no"
|
|
482
481
|
|
|
483
482
|
view.someProp("attributes", value => {
|
|
484
483
|
if (typeof value == "function") value = value(view.state)
|
|
485
484
|
if (value) for (let attr in value) {
|
|
486
485
|
if (attr == "class")
|
|
487
486
|
attrs.class += " " + value[attr]
|
|
488
|
-
if (attr == "style")
|
|
487
|
+
else if (attr == "style")
|
|
489
488
|
attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr]
|
|
490
|
-
}
|
|
491
489
|
else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName")
|
|
492
490
|
attrs[attr] = String(value[attr])
|
|
493
491
|
}
|
|
494
492
|
})
|
|
493
|
+
if (!attrs.translate) attrs.translate = "no"
|
|
495
494
|
|
|
496
495
|
return [Decoration.node(0, view.state.doc.content.size, attrs)]
|
|
497
496
|
}
|
package/src/viewdesc.ts
CHANGED
|
@@ -385,18 +385,6 @@ export class ViewDesc {
|
|
|
385
385
|
let {node, offset} = anchorDOM
|
|
386
386
|
if (node.nodeType == 3) {
|
|
387
387
|
brKludge = !!(offset && node.nodeValue![offset - 1] == "\n")
|
|
388
|
-
// Issue #1128
|
|
389
|
-
if (brKludge && offset == node.nodeValue!.length) {
|
|
390
|
-
for (let scan: DOMNode | null = node, after; scan; scan = scan.parentNode) {
|
|
391
|
-
if (after = scan.nextSibling) {
|
|
392
|
-
if (after.nodeName == "BR")
|
|
393
|
-
anchorDOM = headDOM = {node: after.parentNode!, offset: domIndex(after) + 1}
|
|
394
|
-
break
|
|
395
|
-
}
|
|
396
|
-
let desc = scan.pmViewDesc
|
|
397
|
-
if (desc && desc.node && desc.node.isBlock) break
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
388
|
} else {
|
|
401
389
|
let prev = node.childNodes[offset - 1]
|
|
402
390
|
brKludge = prev && (prev.nodeName == "BR" || (prev as HTMLElement).contentEditable == "false")
|