prosemirror-model
Advanced tools
Changelog
0.23.0 (2017-09-13)
ResolvedPos.marks
no longer takes a parameter (you probably want marksAcross
if you were passing true there).
Attribute and mark constraints in content expressions are no longer supported (this also means the prosemirror-schema-table
package, which relied on them, is no longer supported). In this release, mark constraints are still (approximately) recognized with a warning, when present.
ContentMatch
objects lost a number of methods: matchNode
, matchToEnd
, findWrappingFor
(which can be easily emulated using the remaining API), and allowsMark
, which is now the responsibility of node types instead.
ContentMatch.validEnd
is now a property rather than a method.
ContentMatch.findWrapping
now returns an array of plain node types, with no attribute information (since this is no longer necessary).
The compute
method for attributes is no longer supported.
Fragments no longer have an offsetAt
method.
DOMParser.schemaRules
is no longer public (use fromSchema
and get the resulting parser's rules
property instead).
The DOM parser option topStart
has been replaced by topMatch
.
The DOMSerializer
methods nodesFromSchema
and marksFromSchema
are no longer public (construct a serializer with fromSchema
and read its nodes
and marks
properties instead).
Fix issue where whitespace at node boundaries was sometimes dropped during content parsing.
Attribute default values of undefined
are now allowed.
contentElement
in parse rules may now be a function.
The new method ResolvedPos.marksAcross
can be used to find the set of marks that should be preserved after a deletion.
Content expressions are now a regular language, meaning all the operators can be nested and composed as desired, and a bunch of constraints on what could appear next to what have been lifted.
The starting content match for a node type now lives in NodeType.contentMatch
.
Allowed marks are now specified per node, rather than in content expressions, using the marks
property on the node spec.
Node types received new methods allowsMarkType
, allowsMarks
, and allowedMarks
, which tell you about the marks that node supports.
The style
property on parse rules may now have the form "font-style=italic"
to only match styles that have the value after the equals sign.
Changelog
0.22.0 (2017-06-29)
When using parseSlice
, inline DOM content wrapped in block elements for which no parse rule is defined will now be properly wrapped in a textblock node.
Resolved positions now have a doc
accessor to easily get their root node.
Parse rules now support a namespace
property to match XML namespaces.
The NodeRange
constructor is now public (whereas before you could only construct these through blockRange
).
Changelog
0.21.0 (2017-05-03)
The openLeft
and openRight
properties of Slice
objects have been renamed to openStart
and openEnd
to avoid confusion in right-to-left text. The old names will continue to work with a warning until the next release.
Mark serializing functions now get a second parameter that indicates whether the mark's content is inline or block nodes.
Setting a mark serializer to null
in a DOMSerializer
can now be used to omit that mark when serializing.
Node specs support a new property isolating
, which is used to disable editing actions like backspacing and lifting across such a node's boundaries.
Changelog
0.20.0 (2017-04-03)
Newlines in the text are now normalized to spaces when parsing except when you set preserveWhitespace
to "full"
in your options or in a parse rule.
Fix crash in IE when parsing DOM content.
Fragments now have nodesBetween
and descendants
methods, providing the same functionality as the methods by the same name on nodes.
Resolved positions now have max
and min
methods to easily find a maximum or minimum position.
Changelog
0.19.0 (2017-03-16)
MarkSpec.inclusiveRight
was replaced by inclusive
, which behaves slightly differently. inclusiveRight
will be interpreted as inclusive
(with a warning) until the next release.
The new inlineContent
property on nodes and node types tells you whether a node type supports inline content.
MarkSpec.inclusive
can now be used to control whether content inserted at the boundary of a mark receives that mark.
Parse rule context
restrictions can now use node groups, not just node names, to specify valid context.
Changelog
0.18.0 (2017-02-24)
schema.nodeSpec
and schema.markSpec
have been deprecated in favor of schema.spec
. The properties still work with a warning in this release, but will be dropped in the next.
Node
objects now have a check
method which can be used to assert that they conform to the schema.
Node specs now support an atom
property, and nodes an isAtom
accessor, which is currently only used to determine whether such nodes should be directly selectable (for example when they are rendered as an uneditable node view).
The new excludes
field on mark specs can be used to control the marks that this mark may coexist with. Mark type objects also gained an excludes
method to querty this relation.
Mark specs now support a group
property, and marks can be referred to by group name in content specs.
The Schema
class now provides its whole spec under its spec
property.
The name of a schema's default top-level node is now configurable. You can use schema.topNodeType
to retrieve the top node type.
Parse rules now support a context
field that can be used to only make the rule match inside certain ancestor nodes.
Changelog
0.17.0 (2017-01-05)
Node.marksAt
was replaced with ResolvedPos.marks
. It still works (with a warning) in this release, but will be removed in the next one.
Changelog
0.15.0 (2016-12-10)
ResolvedPos.atNodeBoundary
is deprecated and will be removed in the next release. Use textOffset > 0
instead.
Parse rules associated with a schema can now specify a priority
to influence the order in which they are applied.
Resolved positions have a new getter textOffset
to find their position within a text node (if any).