Changelog History
Page 8
-
v0.22.9
September 27, 2019 -
v0.22.8
August 27, 2019 -
v0.22.7
August 22, 2019 -
v0.22.6
August 19, 2019 -
v0.22.5
August 19, 2019 -
v0.22.4
June 07, 2019 -
v0.22.3
May 21, 2019 -
v0.22.0 Changes
September 05, 2017NEW
The
state.activeMarks
returns the intersection of marks in the selection. Previously there was onlystate.marks
which returns marks that appeared on any character in the selection. Butstate.activeMarks
returns marks that appear on every character in the selection, which is often more useful for implementing standard richtext editor behaviors.BREAKING
The
Plain
serializer now adds line breaks between blocks. Previously between blocks the text would be joined without any space whatsoever, but this wasn't really that useful or what you'd expect.The
toggleMark
transform now checks the intersection of marks. Previously, toggling would remove the mark from the range if any of the characters in a range didn't have it. However, this wasn't what all other richtext editors did, so the behavior has changed to mimic the standard behavior. Now, if any characters in the selection have the mark applied, it will first be added when toggling.🚚 The
.length
property of nodes has been removed. This property caused issues with code like in Lodash that checked for "array-likeness" by simply looking for a.length
property that was a number.onChange
now receives aChange
object (previously namedTransform
) instead of aState
. This is needed because it enforces that all changes are represented by a single set of operations. Otherwise right now it's possible to do things likestate.transform()....apply({ save: false }).transform()....apply()
and result in losing the operation information in the history. With OT, we need all transforms that may happen to be exposed and emitted by the editor. The new syntax looks like:onChange(change) { this.setState({ state: change.state }) } onChange({ state }) { this.setState({ state }) }
Similarly, handlers now receive
e, data, change
instead ofe, data, state
. Instead of doingreturn state.transform()....apply()
the plugins can now act on the change object directly. Plugins can stillreturn change...
if they want to break the stack from continuing on to other plugins. (Any!= null
value will break out.) But they can also now not return anything, and the stack will apply their changes and continue onwards. This was previously impossible. The new syntax looks like:function onKeyDown(e, data, change) { if (data.key == 'enter') { return change.splitBlock() } }
The
onChange
andon[Before]Change
handlers now receiveChange
objects. Previously they would also receive astate
object, but now they receivechange
objects like the rest of the plugin API.The
.apply({ save })
option is nowstate.change({ save })
instead. This is the easiest way to use it, but requires that you know whether to save or not up front. If you want to use it inline after already saving some changes, you can use thechange.setOperationFlag('save', true)
flag instead. This shouldn't be necessary for 99% of use cases though.0️⃣ The
.undo()
and.redo()
transforms don't save by default. Previously you had to specifically tell these transforms not to save into the history, which was awkward. Now they won't save the operations they're undoing/redoing by default.onBeforeChange
is no longer called fromcomponentWillReceiveProps
, when a newstate
is passed in as props to the<Editor>
component. This caused lots of state-management issues and was weird in the first place because passing in props would result in changes firing. It is now the parent component's responsibility to not pass in improperly formattedState
objects.The
splitNodeByKey
change method has changed to be shallow. Previously, it would deeply split to an offset. But now it is shallow and anothersplitDescendantsByKey
change method has been added (with a different signature) for the deep splitting behavior. This is needed because splitting and joining operations have been changed to all be shallow, which is required so that operational transforms can be written against them.Blocks cannot have mixed "inline" and "block" children anymore. Blocks were implicitly expected to either contain "text" and "inline" nodes only, or to contain "block" nodes only. Invalid case are now normalized by the core schema.
The shape of many operations has changed. This was needed to make operations completely invertible without any extra context. The operations were never really exposed in a consumable way, so I won't detail all of the changes here, but feel free to look at the source to see the details.
🔀 All references to "joining" nodes is now called "merging". This is to be slightly clearer, since merging can only happen with adjacent nodes already, and to have a nicer parallel with "splitting", as in cells. The operation is now called
merge_node
, and the transforms are nowmerge*
.🗄 ###### DEPRECATED
🗄 The
transform.apply()
method is deprecated. Previously this is where the saving into the history would happen, but it created an awkward convention that wasn't necessary. Now operations are saved into the history as they are created with change methods, instead of waiting until the end. You can access the newState
of a change at any time viachange.state
.
-
v0.21.0 Changes
July 20, 2017BREAKING
📜 The
Html
serializer now usesDOMParser
instead ofcheerio
. Previously, theHtml
serializer used thecheerio
library for representing elements in the serialization rule logic, but cheerio was a very large dependency. It has been removed, and the native browserDOMParser
is now used instead. All HTML serialization rules will need to be updated. If you are working with Slate on the server, you can now pass in a custom serializer to theHtml
constructor, using theparse5
library.
-
v0.20.0 Changes
May 17, 2017BREAKING
Returning
null
from theHtml
serializer skips the element. Previously,null
andundefined
had the same behavior of skipping the rule and trying the rest of the rules. Now if you explicitly returnnull
it will skip the element itself.