@udecode/[email protected]
- #1377 by @zbeyens – Before,
BalloonToolbar
could be outsidePlate
. Now,BallonToolbar
should be a child ofPlate
to support multiple editors.
@udecode/[email protected]
- #1303 by @zbeyens –
Plate
editor
prop can now be fully controlled: Plate is not applyingwithPlate
on it anymore
PlatePlugin.deserializeHtml
- can't be an array anymore
- moved
validAttribute
,validClassName
,validNodeName
,validStyle
todeserializeHtml.rules
property
- renamed
plateStore
toplatesStore
platesStore
is now a zustood storeeventEditorStore
is now a zustood storegetPlateId
now gets the last editor id if not focused or blurred- used by
usePlateEditorRef
andusePlateEditorState
- used by
- removed:
usePlateEnabled
forusePlateSelectors(id).enabled()
usePlateValue
forusePlateSelectors(id).value()
usePlateActions
:resetEditor
forgetPlateActions(id).resetEditor()
clearState
forplatesActions.unset()
setInitialState
forplatesActions.set(id)
setEditor
forgetPlateActions(id).editor(value)
setEnabled
forgetPlateActions(id).enabled(value)
setValue
forgetPlateActions(id).value(value)
getPlateState
usePlateState
usePlateKey
@udecode/[email protected]
- #1303 by @zbeyens –
- renamed
plate-x-ui
toplate-ui-x
: all packages depending onstyled-components
hasplate-ui
prefix - renamed
plate-x-serializer
toplate-serializer-x
- is now exporting only these (new) packages:
@udecode/plate-headless
: all unstyled packages@udecode/plate-ui
: all styled packages
- renamed
PlateState
toPlateStoreState
@udecode/[email protected]
-
IndentListPluginOptions
forPlatePlugin
Rename:
getIndentListInjectComponent
toinjectIndentListComponent
@udecode/[email protected]
-
#1234 by @zbeyens – Breaking changes:
- removed
components
prop:
// Before <Plate plugins={plugins} components={components} />; // After // option 1: use the plugin factory let plugins = [ createParagraphPlugin({ component: ParagraphElement, }), ]; // option 2: use createPlugins plugins = createPlugins(plugins, { components: { [ELEMENT_PARAGRAPH]: ParagraphElement, }, }); <Plate plugins={plugins} />;
- removed
options
prop:
// Before <Plate plugins={plugins} options={options} />; // After // option 1: use the plugin factory let plugins = [ createParagraphPlugin({ type: 'paragraph', }), ]; // option 2: use createPlugins plugins = createPlugins(plugins, { overrideByKey: { [ELEMENT_PARAGRAPH]: { type: 'paragraph', }, }, }); <Plate plugins={plugins} />;
key
- replacing
pluginKey
- is now required: each plugin needs a key to be retrieved by key.
- replacing
- all handlers have
plugin
as a second parameter:
// Before export type X<T = {}> = (editor: PlateEditor<T>) => Y; // After export type X<T = {}, P = {}> = ( editor: PlateEditor<T>, plugin: WithPlatePlugin<T, P> ) => Y;
serialize
no longer haselement
andleaf
properties:
type SerializeHtml = RenderFunction< PlateRenderElementProps | PlateRenderLeafProps >;
Renamed:
injectParentComponent
toinject.aboveComponent
injectChildComponent
toinject.belowComponent
overrideProps
toinject.props
transformClassName
,transformNodeValue
,transformStyle
first parameter is no longereditor
as it's provided bythen
if needed.- the previously
getOverrideProps
is now the core behavior ifinject.props
is defined.
serialize
toserializeHtml
deserialize
todeserializeHtml
- can be an array
- the old deserializer options are merged to
deserializeHtml
type DeserializeHtml = { /** * List of HTML attribute names to store their values in `node.attributes`. */ attributeNames?: string[]; /** * Deserialize an element. * Use this instead of plugin.isElement if you don't want the plugin to renderElement. * @default plugin.isElement */ isElement?: boolean; /** * Deserialize a leaf. * Use this instead of plugin.isLeaf if you don't want the plugin to renderLeaf. * @default plugin.isLeaf */ isLeaf?: boolean; /** * Deserialize html element to slate node. */ getNode?: (element: HTMLElement) => AnyObject | undefined; query?: (element: HTMLElement) => boolean; /** * Deserialize an element: * - if this option (string) is in the element attribute names. * - if this option (object) values match the element attributes. */ validAttribute?: string | { [key: string]: string | string[] }; /** * Valid element `className`. */ validClassName?: string; /** * Valid element `nodeName`. * Set '*' to allow any node name. */ validNodeName?: string | string[]; /** * Valid element style values. * Can be a list of string (only one match is needed). */ validStyle?: Partial< Record<keyof CSSStyleDeclaration, string | string[] | undefined> >; /** * Whether or not to include deserialized children on this node */ withoutChildren?: boolean; };
- handlers starting by
on...
are moved tohandlers
property.
// Before onDrop: handler; // After handlers: { onDrop: handler; }
Removed:
renderElement
is favor of:isElement
is a boolean that enables element rendering.- the previously
getRenderElement
is now the core behavior.
renderLeaf
is favor of:isLeaf
is a boolean that enables leaf rendering.- the previously
getRenderLeaf
is now the core behavior.
inlineTypes
andvoidTypes
for:isInline
is a boolean that enables inline rendering.isVoid
is a boolean that enables void rendering.
- the following plugins are now part of the core plugins, so you need to remove these from your
plugins
prop:
const corePlugins = [ createReactPlugin(), createHistoryPlugin(), createEventEditorPlugin(), createInlineVoidPlugin(), createInsertDataPlugin(), createDeserializeAstPlugin(), createDeserializeHtmlPlugin(), ];
plugins
is not a parameter anymore as it can be retrieved ineditor.plugins
withInlineVoid
is now using pluginsisInline
andisVoid
plugin properties.
Renamed:
getPlatePluginType
togetPluginType
getEditorOptions
togetPlugins
getPlatePluginOptions
togetPlugin
pipeOverrideProps
topipeInjectProps
getOverrideProps
topluginInjectProps
serializeHTMLFromNodes
toserializeHtml
getLeaf
toleafToHtml
getNode
toelementToHtml
xDeserializerId
toKEY_DESERIALIZE_X
deserializeHTMLToText
tohtmlTextNodeToString
deserializeHTMLToMarks
tohtmlElementToLeaf
andpipeDeserializeHtmlLeaf
deserializeHTMLToElement
tohtmlElementToElement
andpipeDeserializeHtmlElement
deserializeHTMLToFragment
tohtmlBodyToFragment
deserializeHTMLToDocumentFragment
todeserializeHtml
deserializeHTMLToBreak
tohtmlBrToNewLine
deserializeHTMLNode
todeserializeHtmlNode
deserializeHTMLElement
todeserializeHtmlElement
Removed:
usePlateKeys
,getPlateKeys
usePlateOptions
forgetPlugin
getPlateSelection
forgetPlateEditorRef().selection
flatMapByKey
getEditableRenderElement
andgetRenderElement
forpipeRenderElement
andpluginRenderElement
getEditableRenderLeaf
andgetRenderLeaf
forpipeRenderLeaf
andpluginRenderLeaf
getInlineTypes
getVoidTypes
getPlatePluginTypes
getPlatePluginWithOverrides
mapPlatePluginKeysToOptions
withDeserializeX
forPlatePlugin.editor.insertData
Changed types:
PlateEditor
:- removed
options
forpluginsByKey
- removed
WithOverride
is not returning an extended editor anymore (input and output editors are assumed to be the same types for simplicity).PlateState
- renamed
keyChange
tokeyEditor
- removed
plugins
foreditor.plugins
- removed
pluginKeys
- removed
selection
foreditor.selection
- actions:
- removed
setSelection
,setPlugins
,setPluginKeys
- removed
incrementKeyChange
for
- removed
- renamed
Renamed types:
XHTMLY
toXHtmlY
Deserialize
toDeseralizeHtml
Removed types:
PlatePluginOptions
:type
toPlatePlugin.type
component
toPlatePlugin.component
deserialize
toPlatePlugin.deserializeHtml
getNodeProps
toPlatePlugin.props.nodeProps
hotkey
toHotkeyPlugin
clear
toToggleMarkPlugin
defaultType
is hardcoded top.type
OverrideProps
forPlatePlugin.inject.props
Serialize
forPlatePlugin.serializeHtml
NodeProps
forAnyObject
OnKeyDownElementOptions
forHotkeyPlugin
OnKeyDownMarkOptions
forToggleMarkPlugin
WithInlineVoidOptions
GetNodeProps
forPlatePluginProps
DeserializeOptions
,GetLeafDeserializerOptions
,GetElementDeserializerOptions
,GetNodeDeserializerOptions
,GetNodeDeserializerRule
,DeserializeNode
forPlatePlugin.deserializeHtml
PlateOptions
RenderNodeOptions
DeserializedHTMLElement
- removed
@udecode/[email protected]
@udecode/[email protected]
@udecode/[email protected]
@udecode/[email protected]
- #1234 by @zbeyens – Removed:
getCodeBlockPluginOptions
forgetPlugin
getCodeLinePluginOptions
forgetPlugin
@udecode/[email protected]
@udecode/[email protected]
- #1234 by @zbeyens – Removed:
getMentionInputPluginOptions
forgetPlugin
getMentionInputType
forgetPluginType
COMBOBOX_TRIGGER_MENTION
@udecode/[email protected]
@udecode/[email protected]
-
#1234 by @zbeyens – Breaking changes:
- all plugins options are now defined in the plugin itself
- plugins which now have nested plugins instead of array:
createBasicElementsPlugin
createCodeBlockPlugin
createHeadingPlugin
createListPlugin
createTablePlugin
createBasicMarksPlugin
Removed:
createEditorPlugins
forcreatePlateEditor
(without components) andcreatePlateEditorUI
(with Plate components)createPlateOptions
forcreatePlugins
- all
DEFAULTS_X
: these are defined in the plugins - all
getXDeserialize
: these are defined in the plugins - all
WithXOptions
for extended plugins - all
getXRenderElement
- some plugin option types are removed for
PlatePlugin
Renamed:
createPlateComponents
tocreatePlateUI
- all
getXY
handlers toyX
(e.g.getXOnKeyDown
toonKeyDownX
) - all
XPluginOptions
toXPlugin
- all
pluginKey
parameter tokey
except in components
Renamed types:
DecorateSearchHighlightOptions
toFindReplacePlugin
Updated deps:
"slate": "0.70.0"
"slate-react": "0.70.1"
Removed deps (merged to core):
plate-common
plate-ast-serializer
plate-html-serializer
plate-serializer
@udecode/[email protected]
- #1234 by @zbeyens – Renamed:
createDeserializeCSVPlugin
tocreateDeserializeCsvPlugin
deserializeCSV
todeserializeCsv
@udecode/[email protected]
-
createDeserializeMdPlugin
:- is now disabled if there is html data in the data transfer.
Renamed:
createDeserializeMDPlugin
tocreateDeserializeMdPlugin
deserializeMD
todeserializeMd
- renamed:
SPEditor
toPEditor
(note thatPlateEditor
is the new default)SPRenderNodeProps
toPlateRenderNodeProps
SPRenderElementProps
toPlateRenderElementProps
SPRenderLeafProps
toPlateRenderLeafProps
useEventEditorId
tousePlateEventId
useStoreEditorOptions
tousePlateOptions
useStoreEditorRef
tousePlateEditorRef
useStoreEditorSelection
tousePlateSelection
useStoreEditorState
tousePlateEditorState
useStoreEditorValue
tousePlateValue
useStoreEnabled
tousePlateEnabled
useStorePlate
tousePlatePlugins
useStorePlatePluginKeys
tousePlateKeys
useStoreState
tousePlateState
getPlateId
: Get the last focused editor id, else get the last blurred editor id, else get the first editor id, elsenull
getPlateState
:- removed first parameter
state
- previously when giving no parameter, it was returning the first editor. Now it's returning the editor with id =
getPlateId()
. It meansuseEventEditorId('focus')
is no longer needed forusePlateEditorRef
usePlateEditorState
usePlateX
...
- removed first parameter
setAlign
: optionalign
renamed tovalue
- removed
getAlignOverrideProps()
in favor ofgetOverrideProps(KEY_ALIGN)
- removed
getIndentOverrideProps()
in favor ofgetOverrideProps(KEY_INDENT)
- rename
onKeyDownHandler
togetIndentOnKeyDown()
IndentPluginOptions
- rename
types
tovalidTypes
- rename
cssPropName
tostyleKey
- rename
transformCssValue
totransformNodeValue
- rename
setLineHeight
: optionlineHeight
renamed tovalue
- removed
getLineHeightOverrideProps
in favor ofgetOverrideProps(KEY_LINE_HEIGHT)
getMentionOnSelectItem
:- removed
createMentionNode
in favor of plugin options - removed
insertSpaceAfterMention
in favor of plugin options
- removed
MentionCombobox
props:- removed
trigger
in favor of plugin options - removed
insertSpaceAfterMention
in favor of plugin options - removed
createMentionNode
in favor of plugin options
- removed
- renamed
ToolbarAlign
toAlignToolbarButton
- renamed
ToolbarCodeBlock
toCodeBlockToolbarButton
- renamed
ToolbarElement
toBlockToolbarButton
- renamed
ToolbarImage
toImageToolbarButton
- renamed
ToolbarLink
toLinkToolbarButton
- renamed
ToolbarList
toListToolbarButton
- renamed
ToolbarLineHeight
toLineHeightToolbarDropdown
- renamed
ToolbarMark
toMarkToolbarButton
- renamed
ToolbarMediaEmbed
toMediaEmbedToolbarButton
- renamed
ToolbarSearchHighlight
toSearchHighlightToolbar
- renamed
ToolbarTable
toTableToolbarButton
The align plugin is no longer wrapping a block, but instead setting an align
property to an existing block.
createAlignPlugin
:- removed
pluginKeys
,renderElement
anddeserialize
- removed
- removed:
ELEMENT_ALIGN_LEFT
ELEMENT_ALIGN_CENTER
ELEMENT_ALIGN_RIGHT
ELEMENT_ALIGN_JUSTIFY
KEYS_ALIGN
in favor ofKEY_ALIGN
getAlignDeserialize
upsertAlign
in favor ofsetAlign
Migration (normalizer):
- for each node:
- run
parent = getParent(editor, path)
, ifparent[0].type
is one of the alignment values:- run
setAlign(editor, { align }, { at: path })
- run
unwrapNodes(editor, { at: path })
- run
- run
ToolbarAlignProps
:- removed
type
in favor ofalign
- removed
unwrapTypes
- added
align
- removed
The mention plugin is now using the combobox.
- removed
useMentionPlugin
in favor ofcreateMentionPlugin
- migration: replace
useMentionPlugin().plugin
bycreateMentionPlugin()
- migration: replace
- removed options:
mentionableSearchPattern
insertSpaceAfterMention
maxSuggestions
: moved tocomboboxStore
trigger
: moved tocomboboxStore
mentionables
: moved toitems
incomboboxStore
mentionableFilter
: moved tofilter
incomboboxStore
- removed
matchesTriggerAndPattern
in favor ofgetTextFromTrigger
- removed
MentionNodeData
in favor ofComboboxItemData
export interface ComboboxItemData {
/**
* Unique key.
*/
key: string;
/**
* Item text.
*/
text: any;
/**
* Whether the item is disabled.
* @default false
*/
disabled?: boolean;
/**
* Data available to `onRenderItem`.
*/
data?: unknown;
}
- removed
MentionSelect
in favor ofMentionCombobox
- removed
setPositionAtSelection
in favor ofuseBalloonToolbarPopper
- removed
useBalloonMove
in favor ofuseBalloonToolbarPopper
- removed
usePopupPosition
in favor ofuseBalloonToolbarPopper
- removed
useBalloonShow
in favor ofuseBalloonToolbarPopper
BalloonToolbar
props: - removed
direction
in favor ofpopperOptions.placement
- renamed
scrollContainer
topopperContainer
BalloonToolbar
: removedhiddenDelay
prop.
There was multiple instances of styled-components
across all the packages.
So we moved styled-components
from dependencies to peer dependencies.
styled-components
was not listed in your dependencies
Add styled-components
to your dependencies
autoformatBlock
:- signatude changed
// Before
(
editor: TEditor,
type: string,
at: Location,
options: Pick<AutoformatRule, 'preFormat' | 'format'>
)
// After
(editor: TEditor, options: AutoformatBlockOptions)
- moved the checks from
withAutoformat
autoformatInline
:- renamed to
autoformatMark
- signatured changed
- renamed to
// Before
(
editor: TEditor,
options: Pick<AutoformatRule, 'type' | 'between' | 'markup' | 'ignoreTrim'>
)
// After
(
editor: TEditor,
options: AutoformatMarkOptions
)
AutoformatRule
is nowAutoformatBlockRule | AutoformatMarkRule | AutoformatTextRule;
mode: 'inline'
renamed tomode: 'mark'
markup
andbetween
have been replaced bymatch: string | string[] | MatchRange | MatchRange[]
: The rule applies when the trigger and the text just before the cursor matches. Formode: 'block'
: lookup for the end match(es) before the cursor. Formode: 'text'
: lookup for the end match(es) before the cursor. Ifformat
is an array, also lookup for the start match(es). Formode: 'mark'
: lookup for the start and end matches. Note:'_*'
,['_*']
and{ start: '_*', end: '*_' }
are equivalent.trigger
now defaults to the last character ofmatch
ormatch.end
(previously' '
)
- the plugin now checks that there is no character before the start match to apply autoformatting. For example, nothing will happen by typing
a*text*
.