prosemirror-state
Advanced tools
Changelog
0.21.0 (2017-05-03)
Selection.atStart
, and atEnd
no longer take a second textOnly
parameter.
Selection.near
, atStart
, and atEnd
will now fall back to returning an AllSelection
when unable to find a valid selection. This removes the (undocumented) requirement that documents always contain a valid selection position (though you'll probably still want to maintain this for practical UI reasons).
Changelog
0.20.0 (2017-04-03)
Selection.near
no longer accepts a textOnly
parameter.
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 replace
and 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.
Changelog
0.19.1 (2017-03-17)
Fix an issue where ensureMarks
would fail to reset the marks to the empty set when turning off the last mark.
Changelog
0.19.0 (2017-03-16)
Selection.between
is now called TextSelection.between
, and only returns text selections.
The JSON representation of selections changed. fromJSON
will continue to understand the old representation, but if your own code touches the JSON data, you'll have to adjust it.
All Selection
objects now have $head
/$anchor
properties, so those can no longer be used to recognize text selections (use $cursor
or instanceof
).
It is now possible to write your own Selection
subclasses and set the editor selection to an instance of them (provided you implement all required methods and register them with Selection.jsonID
).
Text selections now have a $cursor
getter which returns a position only if this is a cursor selection.
The new Transaction.ensureMarks
method makes it easier to ensure given set of active marks without needlessly setting storedMarks
.
Changelog
0.17.1 (2017-02-08)
Transaction.scrolledIntoView
no longer always returns true.
Selection.near
now takes a third textOnly
argument, as the docs already claimed.