Skip to content

Commit

Permalink
Merge pull request #3013 from adrwz/patch-1
Browse files Browse the repository at this point in the history
Set "not found" value to -1 instead of 0 for colIndex
  • Loading branch information
zbeyens authored Mar 5, 2024
2 parents 79f5a49 + 2a903d9 commit 03e1d07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-beds-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/plate-table": patch
---

Set "not found" value to -1 instead of 0 for colIndex
6 changes: 3 additions & 3 deletions packages/table/src/queries/getTableColumnIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const getTableColumnIndex = <V extends Value>(
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) {
Expand Down

0 comments on commit 03e1d07

Please sign in to comment.