Skip to content

Commit

Permalink
Fix insert image to new inserted table row in playground report error (
Browse files Browse the repository at this point in the history
…#5417)

Co-authored-by: frankdiwang <fankdiwang@tencent.com>
  • Loading branch information
frankdiw and frankdiwang committed Dec 26, 2023
1 parent a06b8a1 commit 4383af2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/lexical-playground/__tests__/e2e/Tables.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,9 @@ test.describe('Tables', () => {
</th>
</tr>
<tr>
<td class="PlaygroundEditorTheme__tableCell"><br /></td>
<td class="PlaygroundEditorTheme__tableCell">
<p class="PlaygroundEditorTheme__paragraph"><br /></p>
</td>
</tr>
<tr>
<th
Expand Down
12 changes: 10 additions & 2 deletions packages/lexical-table/src/LexicalTableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ export function $insertTableRow__EXPERIMENTAL(insertAfter = true): void {
for (let i = 0; i < columnCount; i++) {
const {cell, startRow} = focusEndRowMap[i];
if (startRow + cell.__rowSpan - 1 <= focusEndRow) {
newRow.append($createTableCellNode(TableCellHeaderStates.NO_STATUS));
newRow.append(
$createTableCellNode(TableCellHeaderStates.NO_STATUS).append(
$createParagraphNode(),
),
);
} else {
cell.setRowSpan(cell.__rowSpan + 1);
}
Expand All @@ -266,7 +270,11 @@ export function $insertTableRow__EXPERIMENTAL(insertAfter = true): void {
for (let i = 0; i < columnCount; i++) {
const {cell, startRow} = focusStartRowMap[i];
if (startRow === focusStartRow) {
newRow.append($createTableCellNode(TableCellHeaderStates.NO_STATUS));
newRow.append(
$createTableCellNode(TableCellHeaderStates.NO_STATUS).append(
$createParagraphNode(),
),
);
} else {
cell.setRowSpan(cell.__rowSpan + 1);
}
Expand Down

2 comments on commit 4383af2

@vercel
Copy link

@vercel vercel bot commented on 4383af2 Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical-fbopensource.vercel.app
lexical.dev
lexicaljs.org
www.lexical.dev
lexical-git-main-fbopensource.vercel.app
lexicaljs.com

@vercel
Copy link

@vercel vercel bot commented on 4383af2 Dec 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

lexical-playground.vercel.app
lexical-playground-fbopensource.vercel.app
lexical-playground-git-main-fbopensource.vercel.app
playground.lexical.dev

Please sign in to comment.