Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
KatsiarynaDzibrova committed Apr 16, 2024
1 parent 4e1e4ff commit 67bc535
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/lexical-react/src/LexicalTablePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export function TablePlugin({
const lastCellMap = gridMap[i][rowLength - 1];
const lastRowCell = lastCellMap.cell;
for (let j = rowLength; j < maxRowLength; ++j) {
// TODO: inherit header state from another header or body
const newCell = $createTableCellNode(0);
newCell.append($createParagraphNode());
if (lastRowCell !== null) {
Expand Down
11 changes: 5 additions & 6 deletions packages/lexical-table/src/LexicalTableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,7 @@ export function $unmergeCell(): void {
}
}
export function $computeTableMapSkipCellCheck(grid: TableNode) {
const cell = new TableCellNode();
const [tableMap] = $computeTableMapHelper(grid, cell, cell);
const [tableMap] = $computeTableMapHelper(grid, null, null);
return tableMap;
}

Expand All @@ -737,8 +736,8 @@ export function $computeTableMap(

function $computeTableMapHelper(
grid: TableNode,
cellA: TableCellNode,
cellB: TableCellNode,
cellA: null | TableCellNode,
cellB: null | TableCellNode,
): [TableMapType, TableMapValueType | null, TableMapValueType | null] {
const tableMap: TableMapType = [];
let cellAValue: null | TableMapValueType = null;
Expand All @@ -759,10 +758,10 @@ function $computeTableMapHelper(
tableMap[startRow + i][startColumn + j] = value;
}
}
if (cellA.is(cell)) {
if (cellA !== null && cellA.is(cell)) {
cellAValue = value;
}
if (cellB.is(cell)) {
if (cellB !== null && cellB.is(cell)) {
cellBValue = value;
}
}
Expand Down

0 comments on commit 67bc535

Please sign in to comment.