]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/nodes/custom-table-cell.ts
Lexical: Wired table properties, and other buttons
[bookstack] / resources / js / wysiwyg / nodes / custom-table-cell.ts
index b73a2180716420723b125c639fd7e9e2a49212c5..c8fe58c772d4d76975f96625ea852a653ee3948e 100644 (file)
@@ -20,7 +20,7 @@ import {
     TableCellNode
 } from "@lexical/table";
 import {TableCellHeaderState} from "@lexical/table/LexicalTableCellNode";
-import {createStyleMapFromDomStyles, StyleMap} from "../utils/styles";
+import {extractStyleMapFromElement, StyleMap} from "../utils/dom";
 
 export type SerializedCustomTableCellNode = Spread<{
     styles: Record<string, string>,
@@ -45,6 +45,11 @@ export class CustomTableCellNode extends TableCellNode {
         return cellNode;
     }
 
+    clearWidth(): void {
+        const self = this.getWritable();
+        self.__width = undefined;
+    }
+
     getStyles(): StyleMap {
         const self = this.getLatest();
         return new Map(self.__styles);
@@ -122,7 +127,7 @@ function $convertCustomTableCellNodeElement(domNode: Node): DOMConversionOutput
     const output =  $convertTableCellNodeElement(domNode);
 
     if (domNode instanceof HTMLElement && output.node instanceof CustomTableCellNode) {
-        output.node.setStyles(createStyleMapFromDomStyles(domNode.style));
+        output.node.setStyles(extractStyleMapFromElement(domNode));
     }
 
     return output;