Suggestion
Add suggestions to text as marks.
components/demo.tsx
Installation
pnpm add @udecode/plate-suggestion
Usage
import { SuggestionPlugin } from '@udecode/plate-suggestion/react';
const editor = createPlateEditor({
plugins: [
// ...otherPlugins,
suggestionPlugin.configure({
render: { belowNodes: SuggestionBelowNodes as any },
}),
],
});
Keyboard Shortcuts
Key | Description |
---|---|
Cmd + Shift + S | Add a suggestion on the selected text. |
Examples
Plate UI
Refer to the preview above.
Plate Plus
Plugins
SuggestionPlugin
API
editor.api.suggestion.addSuggestion
Adds a new suggestion.
editor.api.suggestion.dataList
Gets an array of suggestion data from a text node.
editor.api.suggestion.isBlockSuggestion
Checks if a node is a block suggestion element.
editor.api.suggestion.node
Gets a suggestion node entry.
editor.api.suggestion.nodeId
Gets the ID of a suggestion from a node.
editor.api.suggestion.nodes
Gets all suggestion node entries matching the options.
editor.api.suggestion.removeSuggestion
Removes a suggestion by ID.
editor.api.suggestion.suggestionData
Gets suggestion data from a node.
editor.api.suggestion.updateSuggestion
Updates a suggestion by ID.
editor.api.suggestion.withoutSuggestions
Executes a function with suggestions temporarily disabled.
Types
TSuggestionText
Interface for text nodes that can contain suggestions.