From 4974512167030ab7c53a365141716ad7cb49155d Mon Sep 17 00:00:00 2001 From: Andrew Zhou <44193474+adrwz@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:26:10 -0500 Subject: [PATCH 1/2] If nothing exists, set colIndex to -1 instead of 0 so that we can discern from a "not found" and an actual index 0 value. --- packages/table/src/queries/getTableColumnIndex.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/table/src/queries/getTableColumnIndex.ts b/packages/table/src/queries/getTableColumnIndex.ts index 7bc7bb74de..701c378b53 100644 --- a/packages/table/src/queries/getTableColumnIndex.ts +++ b/packages/table/src/queries/getTableColumnIndex.ts @@ -14,12 +14,12 @@ export const getTableColumnIndex = ( cellNode: TElement ) => { const path = findNodePath(editor, cellNode); - if (!path) return 0; + if (!path) return -1; const [trNode] = getParentNode(editor, path) ?? []; - if (!trNode) return 0; + if (!trNode) return -1; - let colIndex = 0; + let colIndex = -1; trNode.children.some((item, index) => { if (item === cellNode) { From 2a903d99d7df121e4c52ba2dfc0c82c3cbd7258f Mon Sep 17 00:00:00 2001 From: Ziad Beyens Date: Tue, 5 Mar 2024 02:40:48 +0100 Subject: [PATCH 2/2] Create fuzzy-beds-tie.md --- .changeset/fuzzy-beds-tie.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fuzzy-beds-tie.md diff --git a/.changeset/fuzzy-beds-tie.md b/.changeset/fuzzy-beds-tie.md new file mode 100644 index 0000000000..1676ac6c52 --- /dev/null +++ b/.changeset/fuzzy-beds-tie.md @@ -0,0 +1,5 @@ +--- +"@udecode/plate-table": patch +--- + +Set "not found" value to -1 instead of 0 for colIndex