The output of toDOM
functions can now be a {dom, contentDOM}
object specifying the precise parent and content DOM elements.
Fix issue where 1.11.1 uses an array method not available on Internet Explorer.
Fix an issue where an inner node's mark information could reset the same mark provided by an outer node in the DOM parser.
Resolved positions have a new convenience method, posAtIndex
, which can resolve a depth and index to a position.
Fix a bug that prevented non-canonical list structure from being normalized.
Avoid fixing directly nested list nodes during DOM parsing when it looks like the schema allows those.
DOM parser rules can now specify closeParent: true
to have the effect of closing their parent node when matched.
Marks found in the DOM at the wrong level (for example, a bold style on a block node) are now properly moved to the node content.
The NodeType
method hasRequiredAttrs
is now public.
Element and attribute names in DOMOutputSpec
structures can now contain namespaces.
Rename ES module files to use a .js extension, since Webpack gets confused by .mjs
The file referred to in the package's module
field now is compiled down to ES5.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
Add a module
field to package json file.
ContentMatch.edge
now throws, as it is supposed to, when you try to access the edge past the last one.
Fix an issue where fillBefore
would in some cases insert unneccesary optional child nodes in the generated content.
Fix an issue where any whitespace (not just the characters that HTML collapses) was collapsed by the parser in non-whitespace-preserving mode.
When <br>
DOM nodes can't be parsed normally, the parser now converts them to newlines. This should improve parsing of some forms of source code HTML.
Using Fragment.from
on an invalid value, including a Fragment
instance from a different version/instance of the library, now raises a meaningful error rather than getting confused.
Fix a bug in parsing overlapping marks of the same non-self-exclusive type.
Mark specs now support a property spanning
which, when set to false
, prevents the mark's DOM markup from spanning multiple nodes, so that a separate wrapper is created for each adjacent marked node.
Don't output empty style attributes when a style property with a null value is present in renderSpec
.
The DOM parser now drops whitespace after BR nodes when not in whitespace-preserving mode.
Prevent ContentMatch.findWrapping
from returning node types with required attributes.
Fix a bug where marks were sometimes parsed incorrectly.
Fix issue where marks would be applied to the wrong node when parsing a slice from DOM.
Adds a new node spec property, toDebugString
, making it possible to customize your nodes' toString
behavior.
ParseRule.getContent
is now passed the parser schema as second argument.
Fix a regression where DOMParser.parse
would fail to apply mark nodes directly at the start of the input.
DOMParser.parseSlice
can now correctly parses marks at the top level again.
Remove a console.log
that was accidentally left in the previous release.
DOMParser
can now parse marks on block nodes.
ContentMatch.defaultType
, a way to get a matching node type at a content match position, is now public.
ContentMatch
objects now have an edgeCount
property and an edge
method, providing direct access to the finite automaton structure.
Throw errors, rather than constructing invalid objects, when deserializing from invalid JSON data.
Content expressions with text nodes in required positions now raise the appropriate error about being unable to generate such nodes.
rangeHasMark
now always returns false for empty ranges.
The DOM renderer no longer needlessly splits mark nodes when starting a non-rendered mark.
DOMSerializer
now allows DOM specs for marks to have holes in them, to specify the precise position where their content should be rendered.
The base position parameter to Node.nodesBetween
and Fragment.nodesBetween
is now part of the public interface.
Slice.maxOpen
now has a second argument that can be used to prevent it from opening isolating nodes.
ReplaceError
instances now properly inherit from Error
.
ParseRule.context
may now include multiple, pipe-separated context expressions.
NodeType.allowsMarks
and allowedMarks
now actually work for nodes that allow only specific marks.
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.
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
).
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.
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.
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.
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.
Node.marksAt
was replaced with ResolvedPos.marks
. It still works (with a warning) in this release, but will be removed in the next one.
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).
DOMParser.parseSlice
will now ignore whitespace-only text nodes at the top of the slice.
Parse rules now support skip
(skip outer element, parse content) and getContent
(compute content using custom code) properties.
The DOMSerializer
class now exports a static renderSpec
method that can help render DOM spec arrays.
ResolvedPos.sameDepth
is now called ResolvedPos.sharedDepth
, and takes a raw, unresolved position as argument.
DOMSerializer
's nodes
and marks
properties are now public.
ContentMatch.findWrapping
now takes a third argument, marks
. There's a new method findWrappingFor
that accepts a whole node.
Adds Slice.maxOpen
static method to create maximally open slices.
DOM parser objects now have a parseSlice
method which parses an HTML fragment into a Slice
, rather than trying to create a whole document from it.
Drops support for some undocumented options to the DOM serializer that were used by the view.
When rendering DOM attributes, only ignore null values, not all falsy values.
Moved into a separate module.
The JSON representation of marks has changed from
{"_": "type", "attr1": "value"}
to {"type": "type", "attrs": {"attr1": "value"}}
, where attrs
may be omitted when the mark has
no attributes.
Mark-related JSON methods now live on the
Mark
class.
The way node and mark types in a schema are defined was changed from
defining subclasses to passing plain objects
(NodeSpec
and MarkSpec
).
DOM serialization and parsing logic is now done through dedicated
objects (DOMSerializer
and
DOMParser
), rather than through the schema. It
is now possible to define alternative parsing and serializing
strategies without touching the schema.
The Slice
class now has an eq
method.
The Node.marksAt
method got a second
parameter to indicate you're interested in the marks after the
position.