prosemirror-model
Advanced tools
Comparing version 1.13.3 to 1.14.0
@@ -0,1 +1,13 @@ | ||
## 1.14.0 (2021-04-06) | ||
### Bug fixes | ||
`Node.check` will now error if a node has an invalid combination of marks. | ||
Don't leave carriage return characters in parsed DOM content, since they confuse Chrome's cursor motion. | ||
### New features | ||
`Fragment.textBetween` is now public. | ||
## 1.13.3 (2021-02-04) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.13.3", | ||
"version": "1.14.0", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -43,3 +43,5 @@ import {findDiffStart, findDiffEnd} from "./diff" | ||
// : (number, number, ?string, ?string) → string | ||
// :: (number, number, ?string, ?string) → string | ||
// Extract the text between `from` and `to`. See the same method on | ||
// [`Node`](#model.Node.textBetween). | ||
textBetween(from, to, blockSeparator, leafText) { | ||
@@ -46,0 +48,0 @@ let text = "", separated = true |
@@ -430,2 +430,4 @@ import {Fragment} from "./fragment" | ||
value = value.replace(/\r?\n|\r/g, " ") | ||
} else { | ||
value = value.replace(/\r\n?/g, "\n") | ||
} | ||
@@ -449,2 +451,3 @@ if (value) this.insertNode(this.parser.schema.text(value)) | ||
this.findInside(dom) | ||
this.ignoreFallback(dom) | ||
} else if (!rule || rule.skip || rule.closeParent) { | ||
@@ -475,2 +478,9 @@ if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1) | ||
// Called for ignored nodes | ||
ignoreFallback(dom) { | ||
// Ignored BR nodes should at least create an inline context | ||
if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent)) | ||
this.findPlace(this.parser.schema.text("-")) | ||
} | ||
// Run any style parser associated with the node's styles. Either | ||
@@ -477,0 +487,0 @@ // return an array of marks, or null to indicate some of the styles |
@@ -330,2 +330,6 @@ import {Fragment} from "./fragment" | ||
throw new RangeError(`Invalid content for node ${this.type.name}: ${this.content.toString().slice(0, 50)}`) | ||
let copy = Mark.none | ||
for (let i = 0; i < this.marks.length; i++) copy = this.marks[i].addToSet(copy) | ||
if (!Mark.sameSet(copy, this.marks)) | ||
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`) | ||
this.content.forEach(node => node.check()) | ||
@@ -332,0 +336,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
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
898044
9225