Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lexical-table] Bug Fix: cannot delete content when a table inside selection #6412

Merged
merged 3 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/lexical-playground/__tests__/e2e/Tables.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,30 @@ test.describe.parallel('Tables', () => {
);
});

test('Can delete all with node selection', async ({
page,
isCollab,
isPlainText,
}) => {
await initialize({isCollab, page});
test.skip(isPlainText);
await focusEditor(page);
await page.keyboard.type('Text before');
await page.keyboard.press('Enter');
await insertSampleImage(page);
await page.keyboard.press('Enter');
await page.keyboard.type('Text after');
await insertTable(page, 2, 3);
await selectAll(page);
await page.keyboard.press('Backspace');
await assertHTML(
page,
html`
<p class="PlaygroundEditorTheme__paragraph"><br /></p>
`,
);
});

test(`Horizontal rule inside cell`, async ({page, isPlainText, isCollab}) => {
await initialize({isCollab, page});
test.skip(isPlainText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,10 @@ export function applyTableHandlers(
if (!parentNode) {
return false;
}
const nextNode = table.getNextSibling() || table.getPreviousSibling();
table.remove();
if (nextNode) {
nextNode.selectStart();
} else {
parentNode.selectStart();
}
}
}
return true;
return false;
}

if ($isTableSelection(selection)) {
Expand Down
Loading