prosemirror-model
Advanced tools
Comparing version 1.19.2 to 1.19.3
@@ -0,1 +1,7 @@ | ||
## 1.19.3 (2023-07-13) | ||
### Bug fixes | ||
Don't apply style parse rules for nodes that are skipped by other parse rules. | ||
## 1.19.2 (2023-05-23) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.19.2", | ||
"version": "1.19.3", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -431,21 +431,19 @@ import {Fragment} from "./fragment" | ||
addDOM(dom: DOMNode) { | ||
if (dom.nodeType == 3) { | ||
this.addTextNode(dom as Text) | ||
} else if (dom.nodeType == 1) { | ||
let style = (dom as HTMLElement).getAttribute("style") | ||
if (!style) { | ||
this.addElement(dom as HTMLElement) | ||
} else { | ||
let marks = this.readStyles(parseStyles(style)) | ||
if (!marks) return // A style with ignore: true | ||
let [addMarks, removeMarks] = marks, top = this.top | ||
for (let i = 0; i < removeMarks.length; i++) this.removePendingMark(removeMarks[i], top) | ||
for (let i = 0; i < addMarks.length; i++) this.addPendingMark(addMarks[i]) | ||
this.addElement(dom as HTMLElement) | ||
for (let i = 0; i < addMarks.length; i++) this.removePendingMark(addMarks[i], top) | ||
for (let i = 0; i < removeMarks.length; i++) this.addPendingMark(removeMarks[i]) | ||
} | ||
} | ||
if (dom.nodeType == 3) this.addTextNode(dom as Text) | ||
else if (dom.nodeType == 1) this.addElement(dom as HTMLElement) | ||
} | ||
withStyleRules(dom: HTMLElement, f: () => void) { | ||
let style = dom.getAttribute("style") | ||
if (!style) return f() | ||
let marks = this.readStyles(parseStyles(style)) | ||
if (!marks) return // A style with ignore: true | ||
let [addMarks, removeMarks] = marks, top = this.top | ||
for (let i = 0; i < removeMarks.length; i++) this.removePendingMark(removeMarks[i], top) | ||
for (let i = 0; i < addMarks.length; i++) this.addPendingMark(addMarks[i]) | ||
f() | ||
for (let i = 0; i < addMarks.length; i++) this.removePendingMark(addMarks[i], top) | ||
for (let i = 0; i < removeMarks.length; i++) this.addPendingMark(removeMarks[i]) | ||
} | ||
addTextNode(dom: Text) { | ||
@@ -485,3 +483,3 @@ let value = dom.nodeValue! | ||
addElement(dom: HTMLElement, matchAfter?: ParseRule) { | ||
let name = dom.nodeName.toLowerCase(), ruleID | ||
let name = dom.nodeName.toLowerCase(), ruleID: ParseRule | undefined | ||
if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) normalizeList(dom) | ||
@@ -508,7 +506,10 @@ let rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) || | ||
} | ||
this.addAll(dom) | ||
if (rule && rule.skip) this.addAll(dom) | ||
else this.withStyleRules(dom, () => this.addAll(dom)) | ||
if (sync) this.sync(top) | ||
this.needsBlock = oldNeedsBlock | ||
} else { | ||
this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : undefined) | ||
this.withStyleRules(dom, () => { | ||
this.addElementByRule(dom, rule!, rule!.consuming === false ? ruleID : undefined) | ||
}) | ||
} | ||
@@ -515,0 +516,0 @@ } |
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
509411
11025