Major Changes
-
PlateElement
,PlateLeaf
andPlateText
HTML attributes are moved from top-level props toattributes
prop. Migration:
// From <PlateElement {...props} ref={ref} contentEditable={false} > {children} </PlateElement> // To <PlateElement {...props} ref={ref} attributes={{ ...props.attributes, contentEditable: false, }} > {children} </PlateElement>
- Remove
nodeProps
prop fromPlateElement
,PlateLeaf
,PlateText
. It has been merged intoattributes
prop. - Plugin
node.props
should return the props directly instead of insidenodeProps
object. Migration:
// From node: { props: ({ element }) => ({ nodeProps: { colSpan: element?.attributes?.colspan, rowSpan: element?.attributes?.rowspan, }, }); } // To node: { props: ({ element }) => ({ colSpan: element?.attributes?.colspan, rowSpan: element?.attributes?.rowspan, }); }
- Remove
asChild
prop fromPlateElement
,PlateLeaf
,PlateText
. Useas
prop instead. - Remove
elementToAttributes
,leafToAttributes
,textToAttributes
props fromPlateElement
,PlateLeaf
,PlateText
. - Remove
DefaultElement
,DefaultLeaf
,DefaultText
. UsePlateElement
,PlateLeaf
,PlateText
instead. - Types: remove
PlateRenderElementProps
,PlateRenderLeafProps
,PlateRenderTextProps
. UsePlateElementProps
,PlateLeafProps
,PlateTextProps
instead.
Minor Changes
- #4225 by @zbeyens –
createPlateEditor
/usePlateEditor
- new
components
option, alias tooverride.components
- new
skipInitialization
option, skip the initialization logic (editor.children
,editor.selection
, normalizing the initial value)
- new
- New api
editor.api.shouldNormalizeNode
: use case is to prevent normalizeNode from being called when the editor is not ready - New transform
editor.tf.init
: initializeeditor.children
,editor.selection
, normalizing the initial value. Use it whenskipInitialization
istrue
.