All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
Note: Version bump only for package slate-plugins
Until 1.0.0 is released, breaking changes will be added as minor or patch version bumps.
Note: Version bump only for package slate-plugins
Note: Version bump only for package slate-plugins
Note: Version bump only for package slate-plugins
- renamed
withDeserializeHtml
towithDeserializeHTML
. - changed signature of
withDeserializeHTML
to({ plugins })
- renamed most of utils in
deserialize-html
, includinghtmlDeserialize
todeserializeHTMLToDocumentFragment
- renamed
htmlSerialize
toserializeHTMLFromNodes
. - removed
ToolbarCodeBlock
in favor ofToolbarElement
instead. withBreakEmptyReset
andwithDeleteStartReset
β renamed optiontypeP
todefaultType
.withToggleType
β renamed optiontypeP
todefaultType
withTable
β removedinsertBreak
handler that prevented to insert break inside table cells, you should now useSoftBreakPlugin
to allow inserting soft breaks instead.
- new types, including
SlateDocument
to enforce a valid structure to be used in<Slate>
- added
inlineTypes
andvoidTypes
properties to theSlatePlugin
interface.EditablePlugins
will setisInline
andisVoid
to each provided type. withVoid
andwithInline
have been replaced bywithInlineVoid
.withResetBlockType
β combineswithBreakEmptyReset
andwithDeleteStartReset
.SoftBreakPlugin
β configurable rules.ExitBreakPlugin
.
deserializeHTMLToDocumentFragment
could return a fragment with emptychildren
, crashing the editor. It has been fixed so all elements have at least one children (empty text) by usingSlateDocument
type.withDeserializeHTML
was buggy when the first inserted node is an inline element (e.g. mention element).
htmlSerialize
β function for serializing content from Slate format to HTML format.
htmlSerialize
β improved the plugin identification and also added a branch for missing types in top levels.withNodeID
βinsertNode
operation was not creating new ids.
htmlSerialize
β function for serializing content from Slate format to HTML format.
- correctly export the React component types.
- export
withNodeID
.
- renamed
withBlock
towithToggleType
as it just toggles the type of an element (inline or not). - renamed
withImage
towithImageUpload
. - renamed
VideoPlugin
and its atoms toMediaEmbedPlugin
. - renamed
VIDEO
type toMEDIA_EMBED
and changed its value fromvideo
tomedia_embed
. - renamed
withShortcuts
towithAutoformat
. - renamed
HoveringToolbar
toBalloonToolbar
. - renamed
MarkdownPreviewPlugin
toPreviewPlugin
as it will be configurable to support other languages. - removed
height
props inToolbar
, usestyles
instead. - renamed
ToolbarBlock
toToolbarElement
. - renamed
ToolbarTableProps.action
toToolbarTableProps.transform
.
- New plugin
BasicElementPlugins
- New props
styles
inToolbar
- New props
styles
inHeadingToolbar
- New props in
ToolbarButton
:styles
tooltip
- New props in
BalloonToolbar
:styles
direction
hiddenDelay
theme
arrow
Toolbar
,HeadingToolbar
andBalloonToolbar
restyled.- New queries:
getSelectionText
getText
isCollapsed
isExpanded
isSelectionExpanded
useMention
:- removed
MentionSelectComponent
from return
- removed
onChangeMention
:- signature changed from
({ editor }: { editor: Editor })
to(editor: Editor)
- signature changed from
MentionSelect
:- props renaming:
- from
mentionables
tooptions
- from
index
tovalueIndex
- from
target
toat
- from
- props renaming:
MentionNode
interface: replacedmentionable
byvalue
. You can add more fields to the element interface instead of adding them tomentionable
onKeyDownMark
:- signature changed from
({ clear, type, hotkey, }: MarkOnKeyDownOptions)
to(type: string, hotkey: string, { clear }: MarkOnKeyDownOptions = {})
- signature changed from
- removed
withForcedLayout
in favor ofwithTypeRules
(more generic) - changed
CODE
type value fromcode
tocode_block
- renamed
CodePlugin
toCodeBlockPlugin
andInlineCodePlugin
toCodePlugin
getLastNode(editor: Editor, level: number)
: new query to get the last node at a specific level/depthwithTypeRules
: new normalizer plugin to force any node to have a specific typeutils
:getPreviousIndex
getNextIndex
queries
:isPointAtWordEnd
isWordAfterTrigger
getNode
: same thanNode.get
but returns null if not the node is not found at the given path.
useMention
:options
is now optional
MentionPlugin
,renderElementMention
:- added
prefix
option - added
onClick
option
- added
MentionSelect
:- added props:
styles
, see Component Styling
- added props:
getRenderElement
- added a 3rd argument:
options
that will be passed to the component as props. You should use that for static props (same value for all instances). And you should mutate the element when it's dynamic.
- added a 3rd argument:
MentionElement
:- attribute
data-slate-character
renamed todata-slate-value
- attribute
mention
:- signature of
onChangeMention
changed - signature of
useMention
changed
- signature of
// from
useMention({
characters: CHARACTERS,
}
// to
useMention(CHARACTERS, {
maxSuggestions: 10,
trigger: '@',
prefix: ''
});
mention
:- changed mention representation from string to object (more useful later for storing other information then just the string, like ids)
- added an options parameter to useMention, adding trigger and prefix to maxSuggestions
- improved typing where seemed appropriate
deserializer-html
:- export
withDeserializeHtml
- export
- previous build was broken because of tests not being excluded
- refactored:
toggleCode
totoggleWrapNodes
(generic).
- removed:
clearMark
in favor ofEditor.removeMark
.
pipe
: new helper to avoid the wrapper hell when usingwithPlugins
. You can now have an array of pluginswithPlugins
.EditablePlugins
: new props for adding your dependencies to the correspondinguseCallback
.decorateDeps
renderElementDeps
renderLeafDeps
onDOMBeforeInputDeps
onKeyDownDeps
toggleMark
: new optional parameterclear
: marks to clear when adding mark.- helpers:
createDefaultHandler
- there was a big performance gap between the official slate
Editable
component and ourEditablePlugins
component. This has been resolved by usinguseCallback
.
deserializeLink
: should work with slate fragments.withForcedLayout
was normalizing on each change.
withNodeID
: renamedidGenerator
toidCreator
withNodeID
: new options:filterText
filter
allow
exclude
setPropsToNodes
: helper to set props to nodes and its children (recursively), with many options to filter the nodes that will receive the props (e.g. only Element, only Text, only nodes of type Paragraph, etc.).
withNodeID
should now work with history undos/redos
- renamed:
withPasteHtml
towithDeserializeHtml
withPasteMd
towithDeserializeMd
onKeyDownMark.mark
toonKeyDownMark.type
- refactored:
onKeyDownMention
andonChangeMention
are now returned byuseMention
isBlockActive
andisLinkActive
have been removed in favor ofisNodeInSelection
- new options for mark plugins: type (
typeBold
,typeItalic
, etc.) . withDeserializeHtml
:- the deserializer is now using
data-slate-type
attribute of each HTML element. So copy/pasting slate fragments should now work. - when pasting a value, the type of the first node will replace the
type of the selected node (using
Transforms.setNodes
).
- the deserializer is now using
withTransforms
:- extends
editor
with transforms (only one for now).
- extends
withNodeID
:- Set an id to the new
Element
and/orText
nodes.
- Set an id to the new
deserializeMention
deserializeActionItem
deserializeIframe
deserializeHighlight
getSelectionNodesArrayByType
getSelectionNodesByType
isAncestor
unwrapNodesByType
- unit testing
- a lot of refactoring
HeadingPlugin
:- styling change (from h1 to h6)
EditablePlugins
:style
props is now overridable
withDeserializeHtml
: fixCannot read property 'children' of null
withForcedLayout
: the previous behavior was forcing to have paragraph nodes after the title. New behavior: first node should be a title (otherwise insert/edit) and second node should exist (otherwise insert a paragraph by default). We will see how to generalize this plugin in a future release.Toolbar
: changeheight
tomin-height
for dynamic height.
- refactor
getElement
togetElementComponent
- refactor elements types to reflect the html tags. Also avoiding
-
as it's not valid in GraphQL enums.action-item
->action_item
block-quote
->blockquote
heading-one
->h1
(untilh6
)link
->a
numbered-list
->ol
bulleted-list
->ul
list-item
->li
paragraph
->p
table-row
->tr
table-cell
->td
If you already saved elements in your database, you will need to migrate or override the types with the previous ones:
// you can add nodeTypes to any element plugin
export const nodeTypes = {
typeP: PARAGRAPH,
typeMention: MENTION,
typeBlockquote: BLOCKQUOTE,
typeCode: CODE_BLOCK,
typeLink: LINK,
typeImg: IMAGE,
typeVideo: MEDIA_EMBED,
typeActionItem: ACTION_ITEM,
typeTable: TableType.TABLE,
typeTr: TableType.ROW,
typeTd: TableType.CELL,
typeUl: ListType.UL,
typeOl: ListType.OL,
typeLi: ListType.LI,
typeH1: HeadingType.H1,
typeH2: HeadingType.H2,
typeH3: HeadingType.H3,
typeH4: HeadingType.H4,
typeH5: HeadingType.H5,
typeH6: HeadingType.H6,
typeEditableVoid: EDITABLE_VOID,
};
- Ordered lists supported in
withShortcuts
(Markdown Shortcuts) by typing1.
. - Option type to all elements. Not yet for the marks.
getRenderElements
- queries:
isRangeAtRoot(point: Point)
to check if anchor or focus of a range is at the root.
- use
isRangeAtRoot(point: Point)
before eachEditor.parent
call.
- queries:
isPointAtRoot(point: Point)
to check if a point is at the root.
- plugins:
withVoid
to set a list of element types to void.withInline
to set a list of element types to inline.
plugin-list
: fixed a bug where toggling the list throws an error when a paragraph has few leafs
plugin-marks
: New plugins for HTML<sub>
and<sup>
tags: superscript and subscript plugins. Included in the "Marks" story.
- Deserializer: pasting html or markdown with Elements inside Text tags works correctly now.
paste-md
:- markdown can be pasted into the editor
plugin-list
:- make sure list item is removed when unwrapping.
- if multiple paragraphs are selected when pressing toggle - they should end up as separate list items.
- The default toggleBlock function creates several code blocks if there are multiple paragraphs selected. This fix creates a toggleCode function that just wraps the whole selection in a code block - or unwraps if it is already in a block.
plugin-table
:- Insert table
- Delete table
- Add/delete row
- Add/delete cell
plugin-list
:- Each list item now has a paragraph child.
plugin-list
:- Supports nested lists:
- Press
Tab
on a list item (except the first one) to indent the current list. - Press
Shift+Tab
,Enter
orBackspace
to unindent the current list.
- Press
- Supports nested lists:
- styles:
line-height
of heading
- plugins:
withList
has been removed and its logic is now insidewithBlock
with the new optionunwrapTypes
.withShortcuts
: removeddeleteBackward
logic as its covered bywithDeleteStartReset
.
p
tag was the default if notype
was provided. The new default isdiv
.
- plugins:
withDeleteStartReset
: on delete at the start of an empty block in types, replace it with a new paragraph.withBreakEmptyReset
: on insert break at the start of an empty block in types, replace it with a new paragraph.
- queries:
isList
- styles
- action item.
- removed the element styling from
globalStyle
as it is not exported. - a lot of spacing changes.