prosemirror-view
Advanced tools
Comparing version 0.17.1 to 0.17.2
@@ -213,3 +213,3 @@ var ref = require("prosemirror-model"); | ||
var sel = resolveSelection(view.state.doc, mapping, parsedSel) | ||
if (!sel.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel)) } | ||
if (sel && !sel.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel)) } | ||
} | ||
@@ -260,3 +260,6 @@ return | ||
{ tr = view.state.tr.replace(from, to, parsed.slice(change.start - range.from, change.endB - range.from)) } | ||
if (parsedSel) { tr.setSelection(resolveSelection(tr.doc, mapping, parsedSel)) } | ||
if (parsedSel) { | ||
var sel$1 = resolveSelection(tr.doc, mapping, parsedSel) | ||
if (sel$1) { tr.setSelection(sel$1) } | ||
} | ||
if (storedMarks) { tr.setStoredMarks(storedMarks) } | ||
@@ -267,2 +270,3 @@ view.dispatch(tr.scrollIntoView()) | ||
function resolveSelection(doc, mapping, parsedSel) { | ||
if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) { return null } | ||
return Selection.between(doc.resolve(mapping.map(parsedSel.anchor)), | ||
@@ -338,3 +342,3 @@ doc.resolve(mapping.map(parsedSel.head))) | ||
var start = a.findDiffStart(b, pos) | ||
if (!start) { return null } | ||
if (start == null) { return null } | ||
var ref = a.findDiffEnd(b, pos + a.size, pos + b.size); | ||
@@ -341,0 +345,0 @@ var endA = ref.a; |
@@ -192,6 +192,6 @@ var ref = require("prosemirror-state"); | ||
function handleSingleClick(view, pos, inside, event) { | ||
function handleSingleClick(view, pos, inside, event, selectNode) { | ||
return runHandlerOnContext(view, "handleClickOn", pos, inside, event) || | ||
view.someProp("handleClick", function (f) { return f(view, pos, event); }) || | ||
selectClickedLeaf(view, inside) | ||
(selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)) | ||
} | ||
@@ -316,5 +316,3 @@ | ||
this.view.selectionReader.poll("pointer") | ||
} else if (this.selectNode | ||
? selectClickedNode(this.view, this.pos.inside) | ||
: handleSingleClick(this.view, this.pos.pos, this.pos.inside, event)) { | ||
} else if (handleSingleClick(this.view, this.pos.pos, this.pos.inside, event, this.selectNode)) { | ||
event.preventDefault() | ||
@@ -321,0 +319,0 @@ } else if (this.flushed) { |
@@ -586,3 +586,3 @@ var ref = require("prosemirror-model"); | ||
TextViewDesc.prototype.update = function (node, outerDeco) { | ||
if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent) || | ||
if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) || | ||
!node.sameMarkup(this.node)) { return false } | ||
@@ -653,2 +653,3 @@ this.updateOuterDeco(outerDeco) | ||
CustomNodeViewDesc.prototype.update = function (node, outerDeco, innerDeco, view) { | ||
if (this.dirty == NODE_DIRTY) { return false } | ||
if (this.spec.update) { | ||
@@ -655,0 +656,0 @@ var result = this.spec.update(node, outerDeco) |
{ | ||
"name": "prosemirror-view", | ||
"version": "0.17.1", | ||
"version": "0.17.2", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -201,3 +201,3 @@ const {Fragment, DOMParser} = require("prosemirror-model") | ||
let sel = resolveSelection(view.state.doc, mapping, parsedSel) | ||
if (!sel.eq(view.state.selection)) view.dispatch(view.state.tr.setSelection(sel)) | ||
if (sel && !sel.eq(view.state.selection)) view.dispatch(view.state.tr.setSelection(sel)) | ||
} | ||
@@ -248,3 +248,6 @@ return | ||
tr = view.state.tr.replace(from, to, parsed.slice(change.start - range.from, change.endB - range.from)) | ||
if (parsedSel) tr.setSelection(resolveSelection(tr.doc, mapping, parsedSel)) | ||
if (parsedSel) { | ||
let sel = resolveSelection(tr.doc, mapping, parsedSel) | ||
if (sel) tr.setSelection(sel) | ||
} | ||
if (storedMarks) tr.setStoredMarks(storedMarks) | ||
@@ -255,2 +258,3 @@ view.dispatch(tr.scrollIntoView()) | ||
function resolveSelection(doc, mapping, parsedSel) { | ||
if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) return null | ||
return Selection.between(doc.resolve(mapping.map(parsedSel.anchor)), | ||
@@ -326,3 +330,3 @@ doc.resolve(mapping.map(parsedSel.head))) | ||
let start = a.findDiffStart(b, pos) | ||
if (!start) return null | ||
if (start == null) return null | ||
let {a: endA, b: endB} = a.findDiffEnd(b, pos + a.size, pos + b.size) | ||
@@ -329,0 +333,0 @@ if (endA < start && a.size < b.size) { |
@@ -169,6 +169,6 @@ const {Selection, NodeSelection, TextSelection} = require("prosemirror-state") | ||
function handleSingleClick(view, pos, inside, event) { | ||
function handleSingleClick(view, pos, inside, event, selectNode) { | ||
return runHandlerOnContext(view, "handleClickOn", pos, inside, event) || | ||
view.someProp("handleClick", f => f(view, pos, event)) || | ||
selectClickedLeaf(view, inside) | ||
(selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)) | ||
} | ||
@@ -292,5 +292,3 @@ | ||
this.view.selectionReader.poll("pointer") | ||
} else if (this.selectNode | ||
? selectClickedNode(this.view, this.pos.inside) | ||
: handleSingleClick(this.view, this.pos.pos, this.pos.inside, event)) { | ||
} else if (handleSingleClick(this.view, this.pos.pos, this.pos.inside, event, this.selectNode)) { | ||
event.preventDefault() | ||
@@ -297,0 +295,0 @@ } else if (this.flushed) { |
@@ -532,3 +532,3 @@ const {DOMSerializer} = require("prosemirror-model") | ||
update(node, outerDeco) { | ||
if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent) || | ||
if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) || | ||
!node.sameMarkup(this.node)) return false | ||
@@ -584,2 +584,3 @@ this.updateOuterDeco(outerDeco) | ||
update(node, outerDeco, innerDeco, view) { | ||
if (this.dirty == NODE_DIRTY) return false | ||
if (this.spec.update) { | ||
@@ -586,0 +587,0 @@ let result = this.spec.update(node, outerDeco) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
294023
6885