From 97692e9795bb9528046dba129f882ceab8d8e6e8 Mon Sep 17 00:00:00 2001 From: Ivaylo Pavlov Date: Sun, 16 Feb 2025 22:56:52 +0000 Subject: [PATCH] Freeze top row pure css --- .../plugins/TableActionMenuPlugin/index.tsx | 20 +++++++++++ .../src/themes/PlaygroundEditorTheme.css | 28 +++++++++++++++ .../src/themes/PlaygroundEditorTheme.ts | 1 + .../lexical-table/src/LexicalTableNode.ts | 36 +++++++++++++++++++ .../__tests__/unit/LexicalTableNode.test.tsx | 1 + 5 files changed, 86 insertions(+) diff --git a/packages/lexical-playground/src/plugins/TableActionMenuPlugin/index.tsx b/packages/lexical-playground/src/plugins/TableActionMenuPlugin/index.tsx index 9df7c6355f5..46096a69ec6 100644 --- a/packages/lexical-playground/src/plugins/TableActionMenuPlugin/index.tsx +++ b/packages/lexical-playground/src/plugins/TableActionMenuPlugin/index.tsx @@ -516,6 +516,19 @@ function TableActionMenu({ }); }, [editor, tableCellNode, clearTableSelection, onClose]); + const toggleFirstRowFreeze = useCallback(() => { + editor.update(() => { + if (tableCellNode.isAttached()) { + const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode); + if (tableNode) { + tableNode.setFrozenRows(tableNode.getFrozenRows() === 0 ? 1 : 0); + } + } + clearTableSelection(); + onClose(); + }); + }, [editor, tableCellNode, clearTableSelection, onClose]); + const toggleFirstColumnFreeze = useCallback(() => { editor.update(() => { if (tableCellNode.isAttached()) { @@ -670,6 +683,13 @@ function TableActionMenu({ +