prosemirror-view 1.23.12 → 1.23.13
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.es.js +15 -10
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/domobserver.js +2 -2
- package/src/index.js +2 -2
- package/src/viewdesc.js +12 -7
package/dist/index.js
CHANGED
|
@@ -1925,21 +1925,24 @@ ViewTreeUpdater.prototype.placeWidget = function placeWidget (widget, view, pos)
|
|
|
1925
1925
|
// Make sure a textblock looks and behaves correctly in
|
|
1926
1926
|
// contentEditable.
|
|
1927
1927
|
ViewTreeUpdater.prototype.addTextblockHacks = function addTextblockHacks () {
|
|
1928
|
-
var lastChild = this.top.children[this.index - 1];
|
|
1929
|
-
while (lastChild instanceof MarkViewDesc) {
|
|
1928
|
+
var lastChild = this.top.children[this.index - 1], parent = this.top;
|
|
1929
|
+
while (lastChild instanceof MarkViewDesc) {
|
|
1930
|
+
parent = lastChild;
|
|
1931
|
+
lastChild = parent.children[parent.children.length - 1];
|
|
1932
|
+
}
|
|
1930
1933
|
|
|
1931
1934
|
if (!lastChild || // Empty textblock
|
|
1932
1935
|
!(lastChild instanceof TextViewDesc) ||
|
|
1933
1936
|
/\n$/.test(lastChild.node.text)) {
|
|
1934
1937
|
// Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)
|
|
1935
1938
|
if ((result.safari || result.chrome) && lastChild && lastChild.dom.contentEditable == "false")
|
|
1936
|
-
{ this.addHackNode("IMG"); }
|
|
1937
|
-
this.addHackNode("BR");
|
|
1939
|
+
{ this.addHackNode("IMG", parent); }
|
|
1940
|
+
this.addHackNode("BR", this.top);
|
|
1938
1941
|
}
|
|
1939
1942
|
};
|
|
1940
1943
|
|
|
1941
|
-
ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
|
|
1942
|
-
if (this.index <
|
|
1944
|
+
ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName, parent) {
|
|
1945
|
+
if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {
|
|
1943
1946
|
this.index++;
|
|
1944
1947
|
} else {
|
|
1945
1948
|
var dom = document.createElement(nodeName);
|
|
@@ -1948,7 +1951,9 @@ ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
|
|
|
1948
1951
|
dom.alt = "";
|
|
1949
1952
|
}
|
|
1950
1953
|
if (nodeName == "BR") { dom.className = "ProseMirror-trailingBreak"; }
|
|
1951
|
-
|
|
1954
|
+
var hack = new TrailingHackViewDesc(this.top, nothing, dom, null);
|
|
1955
|
+
if (parent != this.top) { parent.children.push(hack); }
|
|
1956
|
+
else { parent.children.splice(this.index++, 0, hack); }
|
|
1952
1957
|
this.changed = true;
|
|
1953
1958
|
}
|
|
1954
1959
|
};
|
|
@@ -3359,7 +3364,7 @@ DOMObserver.prototype.flush = function flush () {
|
|
|
3359
3364
|
}
|
|
3360
3365
|
|
|
3361
3366
|
var sel = this.view.root.getSelection();
|
|
3362
|
-
var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) &&
|
|
3367
|
+
var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(this.view) && !this.ignoreSelectionChange(sel);
|
|
3363
3368
|
|
|
3364
3369
|
var from = -1, to = -1, typeOver = false, added = [];
|
|
3365
3370
|
if (this.view.editable) {
|
|
@@ -4952,7 +4957,7 @@ var prototypeAccessors$2 = { props: { configurable: true },root: { configurable:
|
|
|
4952
4957
|
|
|
4953
4958
|
// composing:: boolean
|
|
4954
4959
|
// Holds `true` when a
|
|
4955
|
-
// [composition](https://
|
|
4960
|
+
// [composition](https://w3c.github.io/uievents/#events-compositionevents)
|
|
4956
4961
|
// is active.
|
|
4957
4962
|
|
|
4958
4963
|
// :: DirectEditorProps
|
|
@@ -5529,7 +5534,7 @@ function checkStateComponent(plugin) {
|
|
|
5529
5534
|
|
|
5530
5535
|
// DirectEditorProps:: interface extends EditorProps
|
|
5531
5536
|
//
|
|
5532
|
-
// The props object given directly to the editor view supports
|
|
5537
|
+
// The props object given directly to the editor view supports some
|
|
5533
5538
|
// fields that can't be used in plugins:
|
|
5534
5539
|
//
|
|
5535
5540
|
// state:: EditorState
|