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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.23.13 (2022-04-26)
2
+
3
+ ### Bug fixes
4
+
5
+ Work around a hidden cursor issue in Chrome when a textblock ends in an uneditable node wrapped in a mark.
6
+
1
7
  ## 1.23.12 (2022-04-08)
2
8
 
3
9
  ### Bug fixes
package/dist/index.es.js CHANGED
@@ -1921,21 +1921,24 @@ ViewTreeUpdater.prototype.placeWidget = function placeWidget (widget, view, pos)
1921
1921
  // Make sure a textblock looks and behaves correctly in
1922
1922
  // contentEditable.
1923
1923
  ViewTreeUpdater.prototype.addTextblockHacks = function addTextblockHacks () {
1924
- var lastChild = this.top.children[this.index - 1];
1925
- while (lastChild instanceof MarkViewDesc) { lastChild = lastChild.children[lastChild.children.length - 1]; }
1924
+ var lastChild = this.top.children[this.index - 1], parent = this.top;
1925
+ while (lastChild instanceof MarkViewDesc) {
1926
+ parent = lastChild;
1927
+ lastChild = parent.children[parent.children.length - 1];
1928
+ }
1926
1929
 
1927
1930
  if (!lastChild || // Empty textblock
1928
1931
  !(lastChild instanceof TextViewDesc) ||
1929
1932
  /\n$/.test(lastChild.node.text)) {
1930
1933
  // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)
1931
1934
  if ((result.safari || result.chrome) && lastChild && lastChild.dom.contentEditable == "false")
1932
- { this.addHackNode("IMG"); }
1933
- this.addHackNode("BR");
1935
+ { this.addHackNode("IMG", parent); }
1936
+ this.addHackNode("BR", this.top);
1934
1937
  }
1935
1938
  };
1936
1939
 
1937
- ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
1938
- if (this.index < this.top.children.length && this.top.children[this.index].matchesHack(nodeName)) {
1940
+ ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName, parent) {
1941
+ if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {
1939
1942
  this.index++;
1940
1943
  } else {
1941
1944
  var dom = document.createElement(nodeName);
@@ -1944,7 +1947,9 @@ ViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {
1944
1947
  dom.alt = "";
1945
1948
  }
1946
1949
  if (nodeName == "BR") { dom.className = "ProseMirror-trailingBreak"; }
1947
- this.top.children.splice(this.index++, 0, new TrailingHackViewDesc(this.top, nothing, dom, null));
1950
+ var hack = new TrailingHackViewDesc(this.top, nothing, dom, null);
1951
+ if (parent != this.top) { parent.children.push(hack); }
1952
+ else { parent.children.splice(this.index++, 0, hack); }
1948
1953
  this.changed = true;
1949
1954
  }
1950
1955
  };
@@ -3355,7 +3360,7 @@ DOMObserver.prototype.flush = function flush () {
3355
3360
  }
3356
3361
 
3357
3362
  var sel = this.view.root.getSelection();
3358
- var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasSelection(this.view) && !this.ignoreSelectionChange(sel);
3363
+ var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(this.view) && !this.ignoreSelectionChange(sel);
3359
3364
 
3360
3365
  var from = -1, to = -1, typeOver = false, added = [];
3361
3366
  if (this.view.editable) {
@@ -4948,7 +4953,7 @@ var prototypeAccessors$2 = { props: { configurable: true },root: { configurable:
4948
4953
 
4949
4954
  // composing:: boolean
4950
4955
  // Holds `true` when a
4951
- // [composition](https://developer.mozilla.org/en-US/docs/Mozilla/IME_handling_guide)
4956
+ // [composition](https://w3c.github.io/uievents/#events-compositionevents)
4952
4957
  // is active.
4953
4958
 
4954
4959
  // :: DirectEditorProps
@@ -5525,7 +5530,7 @@ function checkStateComponent(plugin) {
5525
5530
 
5526
5531
  // DirectEditorProps:: interface extends EditorProps
5527
5532
  //
5528
- // The props object given directly to the editor view supports two
5533
+ // The props object given directly to the editor view supports some
5529
5534
  // fields that can't be used in plugins:
5530
5535
  //
5531
5536
  // state:: EditorState