Releases: ianstormtaylor/slate
Releases · ianstormtaylor/slate
0.13.0
BREAKING CHANGES
- The
renderNode
andrenderMark
properties are gone! Previously, rendering nodes and marks happened via these two properties of the<Editor>
, but this has been replaced by the newschema
property. Check out the updated examples to see how to define a schema! There's a good chance this eliminates extra code for most use cases! 😄 - The
renderDecorations
property is gone! Decoration rendering has also been replaced by the newschema
property of the<Editor>
.
0.12.0
BREAKING CHANGES
- The
data.files
property is now anArray
. Previously it was a nativeFileList
object, but needed to be changed to add full support for pasting an dropping files in all browsers. This shouldn't affect you unless you were specifically depending on it being array-like instead of a trueArray
.
0.11.0
BREAKING CHANGES
- Void nodes are renderered implicitly again! Previously Slate had required that you wrap void node renderers yourself with the exposed
<Void>
wrapping component. This was to allow for selection styling, but a change was made to make selection styling able to handled in Javascript. Now the<Void>
wrapper will be implicitly rendered by Slate, so you do not need to worry about it, and "voidness" only needs to toggled in one place, theisVoid: true
property of a node.
0.10.0
BREAKING CHANGES
- Marks are now renderable as components. Previously the only supported way to render marks was by returning a
style
object. Now you can return a style object, a class name string, or a full React component. Because of this, the DOM will be renderered slightly differently than before, resulting in an extra<span>
when rendering non-component marks. This won't affect you unless you were depending on the DOM output by Slate for some reason.
0.9.0
BREAKING CHANGES
- The
wrap
andunwrap
method signatures have changed! Previously, you would passtype
anddata
as separate parameters, for example:wrapBlock('code', { src: true })
. This was inconsistent with other transforms, and has been updated such that a single argument ofproperties
is passed instead. So that example could now be:wrapBlock({ type: 'code', { data: { src: true }})
. You can still pass atype
string as shorthand, which will be the most frequent use case, for example:wrapBlock('code')
.
0.8.0
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.
0.7.0
BREAKING CHANGES
- The
Raw
serializer is no longer terse by default! Previously, theRaw
serializer would return a "terse" representation of the document, omitting information that wasn't strictly necessary to deserialize later, like thekey
of nodes. By default this no longer happens. You have to opt-in to the behavior by passing{ terse: true }
as the secondoptions
argument of thedeserialize
andserialize
methods.
0.6.0
BREAKING CHANGES
- Void components are no longer rendered implicity! Previously, Slate would automatically wrap any node with
isVoid: true
in a<Void>
component. But doing this prevented you from customizing the wrapper, like adding aclassName
orstyle
property. So you must now render the wrapper yourself, and it has been exported asSlate.Void
. This, combined with a small change to the<Void>
component's structure allows the "selected" state of void nodes to be rendered purely with CSS based on the:focus
property of a<Void>
element, which previously had to be handled in Javascript. This allows us to streamline selection-handling logic, improving performance and reducing complexity. data-offset-key
is now<key>-<index>
instead of<key>:<start>-<end>
. This shouldn't actually affect anyone, unless you were specifically relying on that attribute in the DOM. This change greatly reduces the number of re-renders needed, since previously any additional characters would cause a cascading change in the<start>
and<end>
offsets of latter text ranges.
0.5.0
BREAKING CHANGES
node.getTextNodes()
is nownode.getTexts()
. This is just for consistency with the other existingNode
methods likegetBlocks()
,getInlines()
, etc. And it's nicely shorter. 😉Node
methods nowthrow
earlier during unexpected states. This shouldn't break anything for most folks, unless a strange edge-case was going undetected previously.
0.4.0
BREAKING CHANGES
renderMark(mark, state, editor)
is nowrenderMark(mark, marks, state, editor)
. This change allows you to render marks based on multiplemarks
presence at once on a given range of text, for example using a customBoldItalic.otf
font when text has bothbold
anditalic
marks.