Overview
The insert paragraph operation creates a new paragraph node. Typically triggered when user presses Enter.
Interface
interface InsertParagraphOperation extends Operation {
type: 'insertParagraph';
path: Path;
}Usage
function insertParagraph(editor: Editor, position: Path) {
const operation: InsertParagraphOperation = {
type: 'insertParagraph',
path: position
};
editor.applyOperation(operation);
}
// Inverse: Delete paragraph
const inverse = {
type: 'deleteNode',
path: position
};