Skip to content

Commit

Permalink
If nothing exists, set colIndex to -1 instead of 0 so that we can dis…
Browse files Browse the repository at this point in the history
…cern from a "not found" and an actual index 0 value.
  • Loading branch information
adrwz authored Mar 4, 2024
1 parent 79f5a49 commit 4974512
Showing 1 changed file with 3 additions and 3 deletions.
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 4974512

Please sign in to comment.