Skip to main content

Reset Node

Allows you to reset the block type based on certain rules.

In the following example, you can press Enter in an empty block quote or Backspace at the start of a block so it resets to a paragraph.

Installation#

npm install @udecode/plate-reset-node

Usage#

Live Editor
Result

Options#

export interface ResetNodePluginRule extends HotkeyPlugin {
defaultType?: string;
/**
* Node types where the rule applies.
*/
types: string[];
/**
* Additional condition to the rule.
*/
predicate: (editor: PlateEditor) => boolean;
/**
* Callback called when resetting.
*/
onReset?: (editor: PlateEditor) => void;
}
export interface ResetNodePlugin {
rules?: ResetNodePluginRule[];
}

Source Code#