import type {EditorConfig} from "lexical/LexicalEditor";
import type {RangeSelection} from "lexical/LexicalSelection";
import {
- CommonBlockAlignment, commonPropertiesDifferent,
+ CommonBlockAlignment, commonPropertiesDifferent, deserializeCommonBlockNode,
SerializedCommonBlockNode,
setCommonBlockPropsFromElement,
updateElementWithCommonBlockProps
__id: string = '';
__category: CalloutCategory = 'info';
__alignment: CommonBlockAlignment = '';
+ __inset: number = 0;
static getType() {
return 'callout';
const newNode = new CalloutNode(node.__category, node.__key);
newNode.__id = node.__id;
newNode.__alignment = node.__alignment;
+ newNode.__inset = node.__inset;
return newNode;
}
return self.__alignment;
}
+ setInset(size: number) {
+ const self = this.getWritable();
+ self.__inset = size;
+ }
+
+ getInset(): number {
+ const self = this.getLatest();
+ return self.__inset;
+ }
+
createDOM(_config: EditorConfig, _editor: LexicalEditor) {
const element = document.createElement('p');
element.classList.add('callout', this.__category || '');
category: this.__category,
id: this.__id,
alignment: this.__alignment,
+ inset: this.__inset,
};
}
static importJSON(serializedNode: SerializedCalloutNode): CalloutNode {
const node = $createCalloutNode(serializedNode.category);
- node.setId(serializedNode.id);
- node.setAlignment(serializedNode.alignment);
+ deserializeCommonBlockNode(serializedNode, node);
return node;
}