prosemirror-view
Advanced tools
Comparing version 1.33.6 to 1.33.7
{ | ||
"name": "prosemirror-view", | ||
"version": "1.33.6", | ||
"version": "1.33.7", | ||
"description": "ProseMirror's view component", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -230,8 +230,9 @@ import {EditorState} from "prosemirror-state" | ||
if (!desc) return null | ||
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent && !sawBlock || !desc.contentDOM)) { | ||
if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) { | ||
let rect = (desc.dom as HTMLElement).getBoundingClientRect() | ||
if (desc.node.isBlock && desc.parent && !sawBlock) { | ||
if (desc.node.isBlock && desc.parent) { | ||
// Only apply the horizontal test to the innermost block. Vertical for any parent. | ||
if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore | ||
else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter | ||
sawBlock = true | ||
if (rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore | ||
else if (rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter | ||
} | ||
@@ -238,0 +239,0 @@ if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) { |
@@ -186,8 +186,15 @@ import {Selection} from "prosemirror-state" | ||
if (browser.gecko && added.length > 1) { | ||
let brs = added.filter(n => n.nodeName == "BR") | ||
if (browser.gecko && added.length) { | ||
let brs = added.filter(n => n.nodeName == "BR") as HTMLElement[] | ||
if (brs.length == 2) { | ||
let a = brs[0] as HTMLElement, b = brs[1] as HTMLElement | ||
let [a, b] = brs | ||
if (a.parentNode && a.parentNode.parentNode == b.parentNode) b.remove() | ||
else a.remove() | ||
} else { | ||
let {focusNode} = this.currentSelection | ||
for (let br of brs) { | ||
let parent = br.parentNode | ||
if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent)) | ||
br.remove() | ||
} | ||
} | ||
@@ -321,1 +328,9 @@ } | ||
} | ||
function blockParent(view: EditorView, node: DOMNode): Node | null { | ||
for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) { | ||
let desc = view.docView.nearestDesc(p, true) | ||
if (desc && desc.node.isBlock) return p | ||
} | ||
return null | ||
} |
@@ -329,3 +329,3 @@ import {Selection, NodeSelection, TextSelection} from "prosemirror-state" | ||
const targetDesc = target ? view.docView.nearestDesc(target, true) : null | ||
this.target = targetDesc ? targetDesc.dom as HTMLElement : null | ||
this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom as HTMLElement : null | ||
@@ -332,0 +332,0 @@ let {selection} = view.state |
@@ -837,4 +837,6 @@ import {DOMSerializer, Fragment, Mark, Node, TagParseRule} from "prosemirror-model" | ||
deselectNode() { | ||
if (this.nodeDOM.nodeType == 1) (this.nodeDOM as HTMLElement).classList.remove("ProseMirror-selectednode") | ||
if (this.contentDOM || !this.node.type.spec.draggable) (this.dom as HTMLElement).removeAttribute("draggable") | ||
if (this.nodeDOM.nodeType == 1) { | ||
;(this.nodeDOM as HTMLElement).classList.remove("ProseMirror-selectednode") | ||
if (this.contentDOM || !this.node.type.spec.draggable) (this.dom as HTMLElement).removeAttribute("draggable") | ||
} | ||
} | ||
@@ -841,0 +843,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
856823
17310