prosemirror-model
Advanced tools
Comparing version 1.18.1 to 1.18.2
@@ -0,1 +1,7 @@ | ||
## 1.18.2 (2022-11-14) | ||
### Bug fixes | ||
Improve DOM parsing of nested block elements mixing block and inline children. | ||
## 1.18.1 (2022-06-15) | ||
@@ -2,0 +8,0 @@ |
@@ -88,3 +88,3 @@ import OrderedMap from 'orderedmap'; | ||
contentDOM?: HTMLElement; | ||
} | [string, ...any]; | ||
} | readonly [string, ...any[]]; | ||
/** | ||
@@ -91,0 +91,0 @@ A DOM serializer knows how to convert ProseMirror nodes and |
{ | ||
"name": "prosemirror-model", | ||
"version": "1.18.1", | ||
"version": "1.18.2", | ||
"description": "ProseMirror's document model", | ||
@@ -5,0 +5,0 @@ "type": "module", |
# prosemirror-model | ||
[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**GITTER**](https://gitter.im/ProseMirror/prosemirror) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-model/blob/master/CHANGELOG.md) ] | ||
[ [**WEBSITE**](https://prosemirror.net) | [**ISSUES**](https://github.com/prosemirror/prosemirror/issues) | [**FORUM**](https://discuss.prosemirror.net) | [**CHANGELOG**](https://github.com/ProseMirror/prosemirror-model/blob/master/CHANGELOG.md) ] | ||
@@ -5,0 +5,0 @@ This is a [core module](https://prosemirror.net/docs/ref/#model) of [ProseMirror](https://prosemirror.net). |
@@ -52,3 +52,3 @@ import {Fragment} from "./fragment" | ||
get inlineContent() { | ||
return this.next.length && this.next[0].type.isInline | ||
return this.next.length != 0 && this.next[0].type.isInline | ||
} | ||
@@ -55,0 +55,0 @@ |
@@ -481,2 +481,6 @@ import {Fragment} from "./fragment" | ||
if (blockTags.hasOwnProperty(name)) { | ||
if (top.content.length && top.content[0].isInline && this.open) { | ||
this.open-- | ||
top = this.top | ||
} | ||
sync = true | ||
@@ -483,0 +487,0 @@ if (!top.type) this.needsBlock = true |
@@ -300,4 +300,3 @@ import {Fragment} from "./fragment" | ||
check() { | ||
if (!this.type.validContent(this.content)) | ||
throw new RangeError(`Invalid content for node ${this.type.name}: ${this.content.toString().slice(0, 50)}`) | ||
this.type.checkContent(this.content) | ||
let copy = Mark.none | ||
@@ -304,0 +303,0 @@ for (let i = 0; i < this.marks.length; i++) copy = this.marks[i].addToSet(copy) |
@@ -183,4 +183,3 @@ import {Fragment} from "./fragment" | ||
function close(node: Node, content: Fragment) { | ||
if (!node.type.validContent(content)) | ||
throw new ReplaceError("Invalid content for node " + node.type.name) | ||
node.type.checkContent(content) | ||
return node.copy(content) | ||
@@ -187,0 +186,0 @@ } |
@@ -147,4 +147,3 @@ import OrderedMap from "orderedmap" | ||
content = Fragment.from(content) | ||
if (!this.validContent(content)) | ||
throw new RangeError("Invalid content for node " + this.name) | ||
this.checkContent(content) | ||
return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks)) | ||
@@ -183,2 +182,10 @@ } | ||
/// Throws a RangeError if the given fragment is not valid content for this | ||
/// node type. | ||
/// @internal | ||
checkContent(content: Fragment) { | ||
if (!this.validContent(content)) | ||
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`) | ||
} | ||
/// Check whether the given mark type is allowed in this node. | ||
@@ -185,0 +192,0 @@ allowsMarkType(markType: MarkType) { |
@@ -23,3 +23,3 @@ import {Fragment} from "./fragment" | ||
/// node. | ||
export type DOMOutputSpec = string | DOMNode | {dom: DOMNode, contentDOM?: HTMLElement} | [string, ...any] | ||
export type DOMOutputSpec = string | DOMNode | {dom: DOMNode, contentDOM?: HTMLElement} | readonly [string, ...any[]] | ||
@@ -141,6 +141,6 @@ /// A DOM serializer knows how to convert ProseMirror nodes and | ||
} | ||
for (let i = start; i < (structure as any[]).length; i++) { | ||
for (let i = start; i < (structure as readonly any[]).length; i++) { | ||
let child = (structure as any)[i] as DOMOutputSpec | 0 | ||
if (child === 0) { | ||
if (i < (structure as any[]).length - 1 || i > start) | ||
if (i < (structure as readonly any[]).length - 1 || i > start) | ||
throw new RangeError("Content hole must be the only child of its parent node") | ||
@@ -147,0 +147,0 @@ return {dom, contentDOM: dom} |
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
445076
10925