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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.23.4",
3
+ "version": "1.23.7",
4
4
  "description": "ProseMirror's view component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -18,7 +18,7 @@
18
18
  "url": "git://github.com/prosemirror/prosemirror-view.git"
19
19
  },
20
20
  "dependencies": {
21
- "prosemirror-model": "^1.14.3",
21
+ "prosemirror-model": "^1.16.0",
22
22
  "prosemirror-state": "^1.0.0",
23
23
  "prosemirror-transform": "^1.1.0"
24
24
  },
package/src/dom.js CHANGED
@@ -39,7 +39,8 @@ function scanFor(node, off, targetNode, targetOff, dir) {
39
39
  if (node == targetNode && off == targetOff) return true
40
40
  if (off == (dir < 0 ? 0 : nodeSize(node))) {
41
41
  let parent = node.parentNode
42
- if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false")
42
+ if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) ||
43
+ node.contentEditable == "false")
43
44
  return false
44
45
  off = domIndex(node) + (dir < 0 ? 0 : 1)
45
46
  node = parent
package/src/domchange.js CHANGED
@@ -39,7 +39,7 @@ function parseBetween(view, from_, to_) {
39
39
  topOpen: true,
40
40
  from: fromOffset,
41
41
  to: toOffset,
42
- preserveWhitespace: $from.parent.type.spec.code ? "full" : true,
42
+ preserveWhitespace: $from.parent.type.whitespace == "pre" ? "full" : true,
43
43
  editableContent: true,
44
44
  findPositions: find,
45
45
  ruleFromNode,
@@ -174,7 +174,7 @@ export class DOMObserver {
174
174
  checkCSS(this.view)
175
175
  }
176
176
  this.handleDOMChange(from, to, typeOver, added)
177
- if (this.view.docView.dirty) this.view.updateState(this.view.state)
177
+ if (this.view.docView && this.view.docView.dirty) this.view.updateState(this.view.state)
178
178
  else if (!this.currentSelection.eq(sel)) selectionToDOM(this.view)
179
179
  this.currentSelection.set(sel)
180
180
  }
package/src/index.js CHANGED
@@ -602,7 +602,10 @@ function checkStateComponent(plugin) {
602
602
  // The DOM serializer to use when putting content onto the
603
603
  // clipboard. If not given, the result of
604
604
  // [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)
605
- // will be used.
605
+ // will be used. This object will only have its
606
+ // [`serializeFragment`](#model.DOMSerializer.serializeFragment)
607
+ // method called, and you may provide an alternative object type
608
+ // implementing a compatible method.
606
609
  //
607
610
  // clipboardTextSerializer:: ?(Slice) → string
608
611
  // A function that will be called to get the text for the current
package/src/input.js CHANGED
@@ -485,7 +485,7 @@ export function endComposition(view, forceUpdate) {
485
485
  if (browser.android && view.domObserver.flushingSoon >= 0) return
486
486
  view.domObserver.forceFlush()
487
487
  clearComposition(view)
488
- if (forceUpdate || view.docView.dirty) {
488
+ if (forceUpdate || view.docView && view.docView.dirty) {
489
489
  let sel = selectionFromDOM(view)
490
490
  if (sel && !sel.eq(view.state.selection)) view.dispatch(view.state.tr.setSelection(sel))
491
491
  else view.updateState(view.state)
package/src/selection.js CHANGED
@@ -42,7 +42,10 @@ export function selectionToDOM(view, force) {
42
42
 
43
43
  if (!editorOwnsSelection(view)) return
44
44
 
45
- if (!force && view.mouseDown && view.mouseDown.allowDefault) {
45
+ // The delayed drag selection causes issues with Cell Selections
46
+ // in Safari. And the drag selection delay is to workarond issues
47
+ // which only present in Chrome.
48
+ if (!force && view.mouseDown && view.mouseDown.allowDefault && browser.chrome) {
46
49
  let domSel = view.root.getSelection(), curSel = view.domObserver.currentSelection
47
50
  if (domSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset,
48
51
  curSel.anchorNode, curSel.anchorOffset)) {
package/src/viewdesc.js CHANGED
@@ -462,7 +462,8 @@ class ViewDesc {
462
462
  else child.markDirty(from - startInside, to - startInside)
463
463
  return
464
464
  } else {
465
- child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM ? CONTENT_DIRTY : NODE_DIRTY
465
+ child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length
466
+ ? CONTENT_DIRTY : NODE_DIRTY
466
467
  }
467
468
  }
468
469
  offset = end
@@ -577,7 +578,10 @@ class MarkViewDesc extends ViewDesc {
577
578
  return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom)
578
579
  }
579
580
 
580
- parseRule() { return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM} }
581
+ parseRule() {
582
+ if ((this.dirty & NODE_DIRTY) || this.mark.type.spec.reparseInView) return null
583
+ return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM}
584
+ }
581
585
 
582
586
  matchesMark(mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark) }
583
587
 
@@ -667,7 +671,7 @@ class NodeViewDesc extends ViewDesc {
667
671
  // attrs in the dom, that won't be picked up. Not entirely sure
668
672
  // whether this is a problem
669
673
  let rule = {node: this.node.type.name, attrs: this.node.attrs}
670
- if (this.node.type.spec.code) rule.preserveWhitespace = "full"
674
+ if (this.node.type.whitespace == "pre") rule.preserveWhitespace = "full"
671
675
  if (this.contentDOM && !this.contentLost) rule.contentElement = this.contentDOM
672
676
  else rule.getContent = () => this.contentDOM ? Fragment.empty : this.node.content
673
677
  return rule