prosemirror-view 1.23.13 → 1.24.0-beta.3

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/dist/index.es.js CHANGED
@@ -691,7 +691,7 @@ var ViewDesc = function ViewDesc(parent, children, dom, contentDOM) {
691
691
  this.dirty = NOT_DIRTY;
692
692
  };
693
693
 
694
- var prototypeAccessors = { size: { configurable: true },border: { configurable: true },posBefore: { configurable: true },posAtStart: { configurable: true },posAfter: { configurable: true },posAtEnd: { configurable: true },contentLost: { configurable: true },domAtom: { configurable: true },ignoreForCoords: { configurable: true } };
694
+ var prototypeAccessors$2 = { size: { configurable: true },border: { configurable: true },posBefore: { configurable: true },posAtStart: { configurable: true },posAfter: { configurable: true },posAtEnd: { configurable: true },contentLost: { configurable: true },domAtom: { configurable: true },ignoreForCoords: { configurable: true } };
695
695
 
696
696
  // Used to check whether a given description corresponds to a
697
697
  // widget/mark/node.
@@ -712,7 +712,7 @@ ViewDesc.prototype.parseRule = function parseRule () { return null };
712
712
  ViewDesc.prototype.stopEvent = function stopEvent () { return false };
713
713
 
714
714
  // The size of the content represented by this desc.
715
- prototypeAccessors.size.get = function () {
715
+ prototypeAccessors$2.size.get = function () {
716
716
  var size = 0;
717
717
  for (var i = 0; i < this.children.length; i++) { size += this.children[i].size; }
718
718
  return size
@@ -720,7 +720,7 @@ prototypeAccessors.size.get = function () {
720
720
 
721
721
  // For block nodes, this represents the space taken up by their
722
722
  // start/end tokens.
723
- prototypeAccessors.border.get = function () { return 0 };
723
+ prototypeAccessors$2.border.get = function () { return 0 };
724
724
 
725
725
  ViewDesc.prototype.destroy = function destroy () {
726
726
  this.parent = null;
@@ -737,19 +737,19 @@ ViewDesc.prototype.posBeforeChild = function posBeforeChild (child) {
737
737
  }
738
738
  };
739
739
 
740
- prototypeAccessors.posBefore.get = function () {
740
+ prototypeAccessors$2.posBefore.get = function () {
741
741
  return this.parent.posBeforeChild(this)
742
742
  };
743
743
 
744
- prototypeAccessors.posAtStart.get = function () {
744
+ prototypeAccessors$2.posAtStart.get = function () {
745
745
  return this.parent ? this.parent.posBeforeChild(this) + this.border : 0
746
746
  };
747
747
 
748
- prototypeAccessors.posAfter.get = function () {
748
+ prototypeAccessors$2.posAfter.get = function () {
749
749
  return this.posBefore + this.size
750
750
  };
751
751
 
752
- prototypeAccessors.posAtEnd.get = function () {
752
+ prototypeAccessors$2.posAtEnd.get = function () {
753
753
  return this.posAtStart + this.size - 2 * this.border
754
754
  };
755
755
 
@@ -1034,7 +1034,7 @@ ViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {
1034
1034
  return !this.contentDOM && mutation.type != "selection"
1035
1035
  };
1036
1036
 
1037
- prototypeAccessors.contentLost.get = function () {
1037
+ prototypeAccessors$2.contentLost.get = function () {
1038
1038
  return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM)
1039
1039
  };
1040
1040
 
@@ -1069,11 +1069,11 @@ ViewDesc.prototype.markParentsDirty = function markParentsDirty () {
1069
1069
  }
1070
1070
  };
1071
1071
 
1072
- prototypeAccessors.domAtom.get = function () { return false };
1072
+ prototypeAccessors$2.domAtom.get = function () { return false };
1073
1073
 
1074
- prototypeAccessors.ignoreForCoords.get = function () { return false };
1074
+ prototypeAccessors$2.ignoreForCoords.get = function () { return false };
1075
1075
 
1076
- Object.defineProperties( ViewDesc.prototype, prototypeAccessors );
1076
+ Object.defineProperties( ViewDesc.prototype, prototypeAccessors$2 );
1077
1077
 
1078
1078
  // Reused array to avoid allocating fresh arrays for things that will
1079
1079
  // stay empty anyway.
@@ -1286,7 +1286,7 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
1286
1286
  };
1287
1287
 
1288
1288
  NodeViewDesc.prototype.parseRule = function parseRule () {
1289
- var this$1 = this;
1289
+ var this$1$1 = this;
1290
1290
 
1291
1291
  // Experimental kludge to allow opt-in re-parsing of nodes
1292
1292
  if (this.node.type.spec.reparseInView) { return null }
@@ -1297,7 +1297,7 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
1297
1297
  var rule = {node: this.node.type.name, attrs: this.node.attrs};
1298
1298
  if (this.node.type.whitespace == "pre") { rule.preserveWhitespace = "full"; }
1299
1299
  if (!this.contentDOM) {
1300
- rule.getContent = function () { return this$1.node.content; };
1300
+ rule.getContent = function () { return this$1$1.node.content; };
1301
1301
  } else if (!this.contentLost) {
1302
1302
  rule.contentElement = this.contentDOM;
1303
1303
  } else {
@@ -1330,7 +1330,7 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
1330
1330
  // separate step, syncs the DOM inside `this.contentDOM` to
1331
1331
  // `this.children`.
1332
1332
  NodeViewDesc.prototype.updateChildren = function updateChildren (view, pos) {
1333
- var this$1 = this;
1333
+ var this$1$1 = this;
1334
1334
 
1335
1335
  var inline = this.node.inlineContent, off = pos;
1336
1336
  var composition = view.composing && this.localCompositionInfo(view, pos);
@@ -1341,7 +1341,7 @@ var NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {
1341
1341
  if (widget.spec.marks)
1342
1342
  { updater.syncToMarks(widget.spec.marks, inline, view); }
1343
1343
  else if (widget.type.side >= 0 && !insideNode)
1344
- { updater.syncToMarks(i == this$1.node.childCount ? Mark.none : this$1.node.child(i).marks, inline, view); }
1344
+ { updater.syncToMarks(i == this$1$1.node.childCount ? Mark.none : this$1$1.node.child(i).marks, inline, view); }
1345
1345
  // If the next node is a desc matching this widget, reuse it,
1346
1346
  // otherwise insert the widget as a new view desc.
1347
1347
  updater.placeWidget(widget, view, off);
@@ -3238,7 +3238,7 @@ SelectionState.prototype.eq = function eq (sel) {
3238
3238
  };
3239
3239
 
3240
3240
  var DOMObserver = function DOMObserver(view, handleDOMChange) {
3241
- var this$1 = this;
3241
+ var this$1$1 = this;
3242
3242
 
3243
3243
  this.view = view;
3244
3244
  this.handleDOMChange = handleDOMChange;
@@ -3246,7 +3246,7 @@ var DOMObserver = function DOMObserver(view, handleDOMChange) {
3246
3246
  this.flushingSoon = -1;
3247
3247
  this.observer = window.MutationObserver &&
3248
3248
  new window.MutationObserver(function (mutations) {
3249
- for (var i = 0; i < mutations.length; i++) { this$1.queue.push(mutations[i]); }
3249
+ for (var i = 0; i < mutations.length; i++) { this$1$1.queue.push(mutations[i]); }
3250
3250
  // IE11 will sometimes (on backspacing out a single character
3251
3251
  // text node after a BR node) call the observer callback
3252
3252
  // before actually updating the DOM, which will cause
@@ -3254,15 +3254,15 @@ var DOMObserver = function DOMObserver(view, handleDOMChange) {
3254
3254
  if (result.ie && result.ie_version <= 11 && mutations.some(
3255
3255
  function (m) { return m.type == "childList" && m.removedNodes.length ||
3256
3256
  m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length; }))
3257
- { this$1.flushSoon(); }
3257
+ { this$1$1.flushSoon(); }
3258
3258
  else
3259
- { this$1.flush(); }
3259
+ { this$1$1.flush(); }
3260
3260
  });
3261
3261
  this.currentSelection = new SelectionState;
3262
3262
  if (useCharData) {
3263
3263
  this.onCharData = function (e) {
3264
- this$1.queue.push({target: e.target, type: "characterData", oldValue: e.prevValue});
3265
- this$1.flushSoon();
3264
+ this$1$1.queue.push({target: e.target, type: "characterData", oldValue: e.prevValue});
3265
+ this$1$1.flushSoon();
3266
3266
  };
3267
3267
  }
3268
3268
  this.onSelectionChange = this.onSelectionChange.bind(this);
@@ -3270,10 +3270,10 @@ var DOMObserver = function DOMObserver(view, handleDOMChange) {
3270
3270
  };
3271
3271
 
3272
3272
  DOMObserver.prototype.flushSoon = function flushSoon () {
3273
- var this$1 = this;
3273
+ var this$1$1 = this;
3274
3274
 
3275
3275
  if (this.flushingSoon < 0)
3276
- { this.flushingSoon = window.setTimeout(function () { this$1.flushingSoon = -1; this$1.flush(); }, 20); }
3276
+ { this.flushingSoon = window.setTimeout(function () { this$1$1.flushingSoon = -1; this$1$1.flush(); }, 20); }
3277
3277
  };
3278
3278
 
3279
3279
  DOMObserver.prototype.forceFlush = function forceFlush () {
@@ -3293,13 +3293,13 @@ DOMObserver.prototype.start = function start () {
3293
3293
  };
3294
3294
 
3295
3295
  DOMObserver.prototype.stop = function stop () {
3296
- var this$1 = this;
3296
+ var this$1$1 = this;
3297
3297
 
3298
3298
  if (this.observer) {
3299
3299
  var take = this.observer.takeRecords();
3300
3300
  if (take.length) {
3301
3301
  for (var i = 0; i < take.length; i++) { this.queue.push(take[i]); }
3302
- window.setTimeout(function () { return this$1.flush(); }, 20);
3302
+ window.setTimeout(function () { return this$1$1.flush(); }, 20);
3303
3303
  }
3304
3304
  this.observer.disconnect();
3305
3305
  }
@@ -3316,10 +3316,10 @@ DOMObserver.prototype.disconnectSelection = function disconnectSelection () {
3316
3316
  };
3317
3317
 
3318
3318
  DOMObserver.prototype.suppressSelectionUpdates = function suppressSelectionUpdates () {
3319
- var this$1 = this;
3319
+ var this$1$1 = this;
3320
3320
 
3321
3321
  this.suppressingSelectionUpdates = true;
3322
- setTimeout(function () { return this$1.suppressingSelectionUpdates = false; }, 50);
3322
+ setTimeout(function () { return this$1$1.suppressingSelectionUpdates = false; }, 50);
3323
3323
  };
3324
3324
 
3325
3325
  DOMObserver.prototype.onSelectionChange = function onSelectionChange () {
@@ -3735,7 +3735,7 @@ handlers.mousedown = function (view, event) {
3735
3735
  };
3736
3736
 
3737
3737
  var MouseDown = function MouseDown(view, pos, event, flushed) {
3738
- var this$1 = this;
3738
+ var this$1$1 = this;
3739
3739
 
3740
3740
  this.view = view;
3741
3741
  this.startDoc = view.state.doc;
@@ -3777,7 +3777,7 @@ var MouseDown = function MouseDown(view, pos, event, flushed) {
3777
3777
  if (this.mightDrag.addAttr) { this.target.draggable = true; }
3778
3778
  if (this.mightDrag.setUneditable)
3779
3779
  { setTimeout(function () {
3780
- if (this$1.view.mouseDown == this$1) { this$1.target.setAttribute("contentEditable", "false"); }
3780
+ if (this$1$1.view.mouseDown == this$1$1) { this$1$1.target.setAttribute("contentEditable", "false"); }
3781
3781
  }, 20); }
3782
3782
  this.view.domObserver.start();
3783
3783
  }
@@ -3788,7 +3788,7 @@ var MouseDown = function MouseDown(view, pos, event, flushed) {
3788
3788
  };
3789
3789
 
3790
3790
  MouseDown.prototype.done = function done () {
3791
- var this$1 = this;
3791
+ var this$1$1 = this;
3792
3792
 
3793
3793
  this.view.root.removeEventListener("mouseup", this.up);
3794
3794
  this.view.root.removeEventListener("mousemove", this.move);
@@ -3798,7 +3798,7 @@ MouseDown.prototype.done = function done () {
3798
3798
  if (this.mightDrag.setUneditable) { this.target.removeAttribute("contentEditable"); }
3799
3799
  this.view.domObserver.start();
3800
3800
  }
3801
- if (this.delayedSelectionSync) { setTimeout(function () { return selectionToDOM(this$1.view); }); }
3801
+ if (this.delayedSelectionSync) { setTimeout(function () { return selectionToDOM(this$1$1.view); }); }
3802
3802
  this.view.mouseDown = null;
3803
3803
  };
3804
3804
 
@@ -4497,14 +4497,14 @@ DecorationSet.prototype.add = function add (doc, decorations) {
4497
4497
  };
4498
4498
 
4499
4499
  DecorationSet.prototype.addInner = function addInner (doc, decorations, offset) {
4500
- var this$1 = this;
4500
+ var this$1$1 = this;
4501
4501
 
4502
4502
  var children, childIndex = 0;
4503
4503
  doc.forEach(function (childNode, childOffset) {
4504
4504
  var baseOffset = childOffset + offset, found;
4505
4505
  if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) { return }
4506
4506
 
4507
- if (!children) { children = this$1.children.slice(); }
4507
+ if (!children) { children = this$1$1.children.slice(); }
4508
4508
  while (childIndex < children.length && children[childIndex] < childOffset) { childIndex += 3; }
4509
4509
  if (children[childIndex] == childOffset)
4510
4510
  { children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1); }
@@ -4949,7 +4949,7 @@ var EditorView = function EditorView(place, props) {
4949
4949
  this.updatePluginViews();
4950
4950
  };
4951
4951
 
4952
- var prototypeAccessors$2 = { props: { configurable: true },root: { configurable: true },isDestroyed: { configurable: true } };
4952
+ var prototypeAccessors = { props: { configurable: true },root: { configurable: true },isDestroyed: { configurable: true } };
4953
4953
 
4954
4954
  // composing:: boolean
4955
4955
  // Holds `true` when a
@@ -4958,7 +4958,7 @@ var prototypeAccessors$2 = { props: { configurable: true },root: { configurable:
4958
4958
 
4959
4959
  // :: DirectEditorProps
4960
4960
  // The view's current [props](#view.EditorProps).
4961
- prototypeAccessors$2.props.get = function () {
4961
+ prototypeAccessors.props.get = function () {
4962
4962
  if (this._props.state != this.state) {
4963
4963
  var prev = this._props;
4964
4964
  this._props = {};
@@ -5001,7 +5001,7 @@ EditorView.prototype.updateState = function updateState (state) {
5001
5001
  };
5002
5002
 
5003
5003
  EditorView.prototype.updateStateInner = function updateStateInner (state, reconfigured) {
5004
- var this$1 = this;
5004
+ var this$1$1 = this;
5005
5005
 
5006
5006
  var prev = this.state, redraw = false, updateSel = false;
5007
5007
  // When stored marks are added, stop composition, so that they can
@@ -5072,7 +5072,7 @@ EditorView.prototype.updateStateInner = function updateStateInner (state, reconf
5072
5072
  this.dom.scrollTop = 0;
5073
5073
  } else if (scroll == "to selection") {
5074
5074
  var startDOM = this.root.getSelection().focusNode;
5075
- if (this.someProp("handleScrollToSelection", function (f) { return f(this$1); }))
5075
+ if (this.someProp("handleScrollToSelection", function (f) { return f(this$1$1); }))
5076
5076
  ; // Handled
5077
5077
  else if (state.selection instanceof NodeSelection)
5078
5078
  { scrollRectIntoView(this, this.docView.domAfterPos(state.selection.from).getBoundingClientRect(), startDOM); }
@@ -5149,7 +5149,7 @@ EditorView.prototype.focus = function focus () {
5149
5149
  // usually be the top-level `document`, but might be a [shadow
5150
5150
  // DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
5151
5151
  // root if the editor is inside one.
5152
- prototypeAccessors$2.root.get = function () {
5152
+ prototypeAccessors.root.get = function () {
5153
5153
  var cached = this._root;
5154
5154
  if (cached == null) { for (var search = this.dom.parentNode; search; search = search.parentNode) {
5155
5155
  if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {
@@ -5263,7 +5263,7 @@ EditorView.prototype.destroy = function destroy () {
5263
5263
  // This is true when the view has been
5264
5264
  // [destroyed](#view.EditorView.destroy) (and thus should not be
5265
5265
  // used anymore).
5266
- prototypeAccessors$2.isDestroyed.get = function () {
5266
+ prototypeAccessors.isDestroyed.get = function () {
5267
5267
  return this.docView == null
5268
5268
  };
5269
5269
 
@@ -5286,7 +5286,7 @@ EditorView.prototype.dispatch = function dispatch (tr) {
5286
5286
  else { this.updateState(this.state.apply(tr)); }
5287
5287
  };
5288
5288
 
5289
- Object.defineProperties( EditorView.prototype, prototypeAccessors$2 );
5289
+ Object.defineProperties( EditorView.prototype, prototypeAccessors );
5290
5290
 
5291
5291
  function computeDocDeco(view) {
5292
5292
  var attrs = Object.create(null);
@@ -5536,7 +5536,7 @@ function checkStateComponent(plugin) {
5536
5536
  // state:: EditorState
5537
5537
  // The current state of the editor.
5538
5538
  //
5539
- // plugins:: [Plugin]
5539
+ // plugins:: ?[Plugin]
5540
5540
  // A set of plugins to use in the view, applying their [plugin
5541
5541
  // view](#state.PluginSpec.view) and
5542
5542
  // [props](#state.PluginSpec.props). Passing plugins with a state