Docs
Node ID
Node ID
Automatically assign unique IDs to nodes in the document.
Installation
npm install @udecode/plate-node-id
Usage
import { NodeIdPlugin } from '@udecode/plate-node-id';
const plugins = [
// ...otherPlugins,
NodeIdPlugin.configure({
options: {
idKey: 'id',
filterText: true,
idCreator: () => Math.random().toString(36).slice(2, 7),
},
}),
];
Plugins
NodeIdPlugin
Options
Collapse all
- Default:
true
- Default:
() => Math.random().toString(36).slice(2, 7)
- Default:
'id'
- Default:
false
When true, disables using existing IDs during node insertion, even if they don't exist in the document.
Filter Text nodes from receiving IDs.
Function to generate unique IDs.
Node key used to store the ID.
Reuse IDs on undo/redo and copy/pasting if not existing in the document.