github udecode/plate @udecode/plate-core@48.0.0

latest releases: @platejs/dnd@49.2.22, @platejs/core@49.2.21, @platejs/slate@49.2.21...
4 months ago

Major Changes

  • #4281 by @zbeyens

    • PlateElement, PlateLeaf and PlateText HTML attributes are moved from top-level props to attributes 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 from PlateElement, PlateLeaf, PlateText. It has been merged into attributes prop.
    • Plugin node.props should return the props directly instead of inside nodeProps 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 from PlateElement, PlateLeaf, PlateText. Use as prop instead.
    • Remove elementToAttributes, leafToAttributes, textToAttributes props from PlateElement, PlateLeaf, PlateText.
    • Remove DefaultElement, DefaultLeaf, DefaultText. Use PlateElement, PlateLeaf, PlateText instead.
    • Types: remove PlateRenderElementProps, PlateRenderLeafProps, PlateRenderTextProps. Use PlateElementProps, PlateLeafProps, PlateTextProps instead.

Minor Changes

  • #4225 by @zbeyens
    • createPlateEditor/usePlateEditor
      • new components option, alias to override.components
      • new skipInitialization option, skip the initialization logic (editor.children, editor.selection, normalizing the initial value)
    • 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: initialize editor.children, editor.selection, normalizing the initial value. Use it when skipInitialization is true.

Don't miss a new plate release

NewReleases is sending notifications on new releases.