github udecode/plate @platejs/core@49.1.3

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

Patch Changes

  • #4454 by @felixfeng33

    • Added editor.tf.nodeId.normalize() API to manually normalize node IDs in the document.

      // Normalize all nodes in the document to ensure they have IDs
      editor.tf.nodeId.normalize();
    • Added normalizeNodeId pure function to normalize node IDs in a value without using editor operations.

      import { normalizeNodeId } from '@platejs/core';
      
      // Normalize a value without editor operations
      const normalizedValue = normalizeNodeId(value, {
        idKey: 'id',
        idCreator: () => nanoid(10),
        filterInline: true,
        filterText: true,
      });

      This is useful when the value is passed from server to client-side editor.

    • Added getFragment() API method to ViewPlugin for accessing the selected DOM fragment.

    usePlateViewEditor:

    • Added onReady handler support for async rendering with automatic re-render when isAsync is true
    // New API usage
    const fragment = editor.getApi(ViewPlugin).getFragment();
    
    // Async rendering support
    const editor = usePlateViewEditor({
      onReady: (ctx) => {
        // Called when editor is ready, supports async rendering
      },
    });

Don't miss a new plate release

NewReleases is sending notifications on new releases.