5 SELECTION_CHANGE_COMMAND
7 import {getMainEditorFullToolbar} from "./toolbars";
9 export function buildEditorUI(element: HTMLElement, editor: LexicalEditor) {
10 const toolbar = getMainEditorFullToolbar();
11 toolbar.setContext({editor});
12 element.before(toolbar.getDOMElement());
14 // Update button states on editor selection change
15 editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
16 const selection = $getSelection();
17 toolbar.updateState({editor, selection});
19 }, COMMAND_PRIORITY_LOW);