1 import {EditorUiContext} from "./core";
2 import {LexicalNode} from "lexical";
4 export interface EditorDecoratorAdapter {
6 getNode(): LexicalNode;
9 export abstract class EditorDecorator {
11 protected node: LexicalNode | null = null;
12 protected context: EditorUiContext;
14 constructor(context: EditorUiContext) {
15 this.context = context;
18 protected getNode(): LexicalNode {
20 throw new Error('Attempted to get use node without it being set');
26 setNode(node: LexicalNode) {
31 * Render the decorator.
32 * Can run on both creation and update for a node decorator.
33 * If an element is returned, this will be appended to the element
34 * that is being decorated.
36 abstract render(context: EditorUiContext, decorated: HTMLElement): HTMLElement|void;