BREAKING CHANGES
- The
onKeyDown
andonBeforeInput
handlers signatures have changed! Previously, some Slate handlers had a signature of(e, state, editor)
and others had a signature of(e, data, state, editor)
. Now all handlers will be passed adata
object—which contains Slate-specific data related to the event—even if it is empty. This is helpful for future compatibility where we might need to add data to a handler that previously didn't have any, and is nicer for consistency. TheonKeyDown
handler's newdata
object contains thekey
name,code
and a series ofis*
properties to make working with hotkeys easier. TheonBeforeInput
handler's newdata
object is empty. - The
Utils
export has been removed. Previously, aKey
utility and thefindDOMNode
utility were exposed under theUtils
object. TheKey
has been removed in favor of thedata
object passed toonKeyDown
. And thenfindDOMNode
utility has been upgraded to a top-level named export, so you'll now need to access it viaimport { findDOMNode } from 'slate'
. - Void nodes now permanently have
" "
as content. Previously, they contained an empty string, but this isn't technically correct, since they have content and shouldn't be considered "empty". Now they will have a single space of content. This shouldn't really affect anyone, unless you happened to be accessing that string for serialization. - Empty inline nodes are now impossible. This is to stay consistent with native
contenteditable
behavior, where although technically the elements can exist, they have odd behavior and can never be selected.