Skip to content

Commit

Permalink
Merge branch 'main' into test-append-inline
Browse files Browse the repository at this point in the history
  • Loading branch information
Shopiley authored Nov 13, 2024
2 parents 17b4078 + 506ef89 commit 077913a
Show file tree
Hide file tree
Showing 42 changed files with 2,167 additions and 850 deletions.
6 changes: 6 additions & 0 deletions packages/lexical-plain-text/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ export function registerPlainText(editor: LexicalEditor): () => void {
return false;
}

// Exception handling for iOS native behavior instead of Lexical's behavior when using Korean on iOS devices.
// more details - https://github.com/facebook/lexical/issues/5841
if (IS_IOS && navigator.language === 'ko-KR') {
return false;
}

event.preventDefault();
return editor.dispatchCommand(DELETE_CHARACTER_COMMAND, true);
},
Expand Down
32 changes: 29 additions & 3 deletions packages/lexical-playground/__tests__/e2e/Collaboration.spec.mjs
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(
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}),
);

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
4 changes: 3 additions & 1 deletion packages/lexical-playground/__tests__/e2e/Selection.spec.mjs
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}),
);
test('does not focus the editor on load', async ({page}) => {
const editorHasFocus = async () =>
await evaluate(page, () => {
Expand Down
Loading

0 comments on commit 077913a

Please sign in to comment.