UNPKG

@lobehub/editor

Version:

A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.

13 lines 561 B
import { $insertNodes, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'; import { $createHorizontalRuleNode } from "../node/HorizontalRuleNode"; export var INSERT_HORIZONTAL_RULE_COMMAND = createCommand('INSERT_HORIZONTAL_RULE_COMMAND'); export function registerHorizontalRuleCommand(editor) { return editor.registerCommand(INSERT_HORIZONTAL_RULE_COMMAND, function () { editor.update(function () { var hrNode = $createHorizontalRuleNode(); $insertNodes([hrNode]); }); return true; }, COMMAND_PRIORITY_EDITOR // Priority ); }