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][lexical-table] Feature: Scrollable tables with experimental getDOMSlot API #6759

Merged
merged 33 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4639f77
WIP getDOMSlot
etrepum Oct 23, 2024
f9b537a
Refactor mutation observer
etrepum Oct 29, 2024
351dc2f
Mock up horizontal table scroll implementation
etrepum Nov 5, 2024
5214e0a
remove cast
etrepum Nov 5, 2024
4447e64
Default to horizontal scroll except in tests
etrepum Nov 6, 2024
38f364c
Add some docstrings for DOMSlot
etrepum Nov 6, 2024
3bf7484
Merge branch 'main' into reconciler-children
etrepum Nov 6, 2024
03752b2
document setDOMUnmanaged
etrepum Nov 6, 2024
498f255
Make table export more generic and improve nested table compatibility
etrepum Nov 6, 2024
34e14cf
unit test for table wrapping
etrepum Nov 6, 2024
6e9f425
use backwards compatible default
etrepum Nov 6, 2024
3c1e805
selection quirks
etrepum Nov 7, 2024
9f029bf
Merge remote-tracking branch 'origin/main' into reconciler-children
etrepum Nov 7, 2024
f79f445
remove debug
etrepum Nov 7, 2024
62169b8
more test fixes
etrepum Nov 8, 2024
36a14dc
Merge remote-tracking branch 'origin/main' into reconciler-children
etrepum Nov 8, 2024
7052b50
more table fixes
etrepum Nov 8, 2024
1eda439
Merge remote-tracking branch 'origin/main' into reconciler-children
etrepum Nov 8, 2024
3783c88
clean up mutation listener
etrepum Nov 8, 2024
abdbd52
reconcile text node selection
etrepum Nov 8, 2024
13d0c5e
Clean up $getTableEdgeCursorPosition
etrepum Nov 8, 2024
4f4cc34
relax $validatePoint
etrepum Nov 9, 2024
5089142
firefox workaround
etrepum Nov 9, 2024
6d5baef
CSS + theme approach, firefox workaround
etrepum Nov 10, 2024
1e644d1
fix typo
etrepum Nov 10, 2024
3f629f1
fix collab tests
etrepum Nov 10, 2024
f068536
Add an img linebreak hack for Safari
etrepum Nov 10, 2024
6d81cdc
empty
etrepum Nov 10, 2024
aa44e02
isolate img+br hack to specific decorator situation
etrepum Nov 11, 2024
1e9bc54
Make collab test less flaky
etrepum Nov 11, 2024
50dadbc
Update @lexical/react/TablePlugin documentation
etrepum Nov 11, 2024
9bc9c33
flow types
etrepum Nov 11, 2024
6453a4b
Merge branch 'main' into reconciler-children
etrepum Nov 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,43 @@ test.describe('Collaboration', () => {
// Left collaborator types two pieces of text in the same paragraph, but with different styling.
await focusEditor(page);
await page.keyboard.type('normal');
await assertHTML(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding the assertions and the delay/sleeps here seems to sort out the flakiness of this test. It would be nice if we had a better way to wait on specific history events. I assume the arrow key delay fix has something to do with waiting a tick for the selection to get resolved correctly.

page,
html`
<p
class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
dir="ltr">
<span data-lexical-text="true">normal</span>
</p>
`,
);
await sleep(1050);
await toggleBold(page);
await page.keyboard.type('bold');

await assertHTML(
page,
html`
<p
class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
dir="ltr">
<span data-lexical-text="true">normal</span>
<strong
class="PlaygroundEditorTheme__textBold"
data-lexical-text="true">
bold
</strong>
</p>
`,
);
const boldSleep = sleep(1050);

// Right collaborator types at the end of the paragraph.
await sleep(50);
await page
.frameLocator('iframe[name="right"]')
.locator('[data-lexical-editor="true"]')
.focus();
await page.keyboard.press('ArrowDown'); // Move caret to end of paragraph
await page.keyboard.press('ArrowDown', {delay: 50}); // Move caret to end of paragraph
await page.keyboard.type('BOLD');

await assertHTML(
Expand All @@ -352,7 +378,7 @@ test.describe('Collaboration', () => {
);

// Left collaborator undoes their bold text.
await sleep(50);
await boldSleep;
await page.frameLocator('iframe[name="left"]').getByLabel('Undo').click();

// The undo also removed bold the text node from YJS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import {
} from '../../../utils/index.mjs';

test.describe('HTML Tables CopyAndPaste', () => {
test.beforeEach(({isCollab, page}) => initialize({isCollab, page}));
test.beforeEach(({isCollab, page}) =>
initialize({isCollab, page, tableHorizontalScroll: false}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use legacy behavior in these tests, no need to test the wrapper (it is not exported or imported)

);

test('Copy + paste (Table - Google Docs)', async ({
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ test.describe('ContextMenuCopyAndPaste', () => {
await page.keyboard.type('hello');
await click(page, '.lock');

await page.pause();
await doubleClick(page, 'div[contenteditable="false"] span');
await page.pause();
await withExclusiveClipboardAccess(async () => {
await click(page, 'div[contenteditable="false"] span', {button: 'right'});
await click(page, '#typeahead-menu [role="option"] :text("Copy")');
Expand Down Expand Up @@ -72,7 +70,6 @@ test.describe('ContextMenuCopyAndPaste', () => {
await click(page, '.font-increment');
await focusEditor(page);
await page.keyboard.type('MLH Fellowship');
//await page.pause();
await moveToLineEnd(page);
await page.keyboard.press('Enter');
await page.keyboard.type('Fall 2024');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import {
} from '../utils/index.mjs';

test.describe('Identation', () => {
test.beforeEach(({isCollab, page}) => initialize({isCollab, page}));
test.beforeEach(({isCollab, page}) =>
initialize({isCollab, page, tableHorizontalScroll: false}),
);

test(`Can create content and indent and outdent it all`, async ({
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ import {
} from '../utils/index.mjs';

test.describe.parallel('Selection', () => {
test.beforeEach(({isCollab, page}) => initialize({isCollab, page}));
test.beforeEach(({isCollab, page}) =>
initialize({isCollab, page, tableHorizontalScroll: false}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Selection scenarios with the wrapper are tested in the tables suite, no need to refactor here

);
test('does not focus the editor on load', async ({page}) => {
const editorHasFocus = async () =>
await evaluate(page, () => {
Expand Down
Loading
Loading