prosemirror-model
Advanced tools
Comparing version 1.9.1 to 1.10.0
@@ -0,1 +1,11 @@ | ||
## 1.10.0 (2020-05-25) | ||
### Bug fixes | ||
Avoid fixing directly nested list nodes during DOM parsing when it looks like the schema allows those. | ||
### New features | ||
DOM parser rules can now specify `closeParent: true` to have the effect of closing their parent node when matched. | ||
## 1.9.1 (2020-01-17) | ||
@@ -2,0 +12,0 @@ |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -387,4 +387,4 @@ import {Fragment} from "./fragment" | ||
} | ||
if (dead) stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position") | ||
if (dead) stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)") | ||
} | ||
} |
@@ -98,2 +98,6 @@ import {Fragment} from "./fragment" | ||
// | ||
// closeParent:: ?bool | ||
// When true, finding an element that matches this rule will close | ||
// the current node. | ||
// | ||
// skip:: ?bool | ||
@@ -159,2 +163,9 @@ // When true, ignore the node that matches this rule, but do parse | ||
}) | ||
// Only normalize list elements when lists in the schema can't directly contain themselves | ||
this.normalizeLists = !this.tags.some(r => { | ||
if (!/^(ul|ol)\b/.test(r.tag) || !r.node) return false | ||
let node = schema.nodes[r.node] | ||
return node.contentMatch.matchType(node) | ||
}) | ||
} | ||
@@ -419,8 +430,9 @@ | ||
let name = dom.nodeName.toLowerCase() | ||
if (listTags.hasOwnProperty(name)) normalizeList(dom) | ||
if (listTags.hasOwnProperty(name) && this.normalizeLists) normalizeList(dom) | ||
let rule = (this.options.ruleFromNode && this.options.ruleFromNode(dom)) || this.parser.matchTag(dom, this) | ||
if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) { | ||
this.findInside(dom) | ||
} else if (!rule || rule.skip) { | ||
if (rule && rule.skip.nodeType) dom = rule.skip | ||
} else if (!rule || rule.skip || rule.closeParent) { | ||
if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1) | ||
else if (rule && rule.skip.nodeType) dom = rule.skip | ||
let sync, top = this.top, oldNeedsBlock = this.needsBlock | ||
@@ -427,0 +439,0 @@ if (blockTags.hasOwnProperty(name)) { |
@@ -225,4 +225,4 @@ import {Fragment} from "./fragment" | ||
// :: (number, number, MarkType) → bool | ||
// Test whether a mark of the given type occurs in this document | ||
// :: (number, number, Mark | MarkType) → bool | ||
// Test whether a given mark or mark type occurs in this document | ||
// between the two given positions. | ||
@@ -229,0 +229,0 @@ rangeHasMark(from, to, type) { |
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
Sorry, the diff of this file is not supported yet
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
851668
9041