Another release today, this time with a lot of bugfixes and small features driven by some real-world ProseMirror work I’ve been doing, along with a handful of minor breaking changes that clean up some bad decisions from the past.
The most meaningful change in this release (which was already foreshadowed in 0.19.0) is that selections are represented in a more generic way, and get more control over how they behave when they are deleted or replaced. If your code still assumes a selection is either a text selection or a node selection, you should write it in a different way.
Newlines in the text are now normalized to spaces when parsing except when you set
"full" in your options or in a parse rule.
Fix crash in IE when parsing DOM content.
Fragments now have
descendants methods, providing the same functionality as the methods by the same name on nodes.
Resolved positions now have
min methods to easily find a maximum or minimum position.
Fixes issue where replacing would sometimes unexpectedly split nodes.
Selection.near no longer accepts a
TextSelection.between may now return a node selection when the document does not contain a valid cursor position.
Selection objects now implement a
content method that returns their content. This is used to determine what ends up on the clipboard when the selection is copied or dragged.
Selections may now specify multiple ranges that they cover, to generalize to more types of selections. The
Selection superclass constructor takes an array of ranges as optional third argument.
Selections gained new methods
replaceWith to provide subclasses more control over how selections of that type respond to being deleted or overwritten.
Selections have a new method
getBookmark that custom selection classes can implement to allow the undo history to accurately store and restore them.
The new selection class
AllSelection can be used to select the entire document.
inclusiveRight options to inline decorations were renamed to
inclusiveEnd so that they also make sense in right-to-left text. The old names work with a warning until the next release.
The default styling for lists and blockquotes was removed from
prosemirror.css. (They were moved to the
Fixes reading of selection in Chrome in a shadow DOM.
Registering DOM event handlers that the editor doesn’t listen to by default with the
handleDOMEvents prop should work again.
Backspacing after turning off a mark now works again in Firefox.
The new props
handleDrop can be used to override drop and paste behavior.
The input rules plugin no longer implicitly binds backspace to undo the last applied rule.
This module now exposes a command
undoInputRule, which will revert an input rule when run directly after one was applied.
Appended transactions no longer generate undo history events.
selectAll command, bound to Mod-a in the base keymap, sets the selection to an
liftListItem command can now lift items out of a list entirely, when the parent node isn’t another list.