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-rich-text][lexical-plain-text] workaround for Korean IME issue on iOS #6819

Merged
Merged
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
11 changes: 10 additions & 1 deletion packages/lexical-rich-text/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ export function registerRichText(editor: LexicalEditor): () => void {
if (!$isRangeSelection(selection)) {
return false;
}
event.preventDefault();

const {anchor} = selection;
const anchorNode = anchor.getNode();

Expand All @@ -871,9 +871,18 @@ export function registerRichText(editor: LexicalEditor): () => void {
) {
const element = $getNearestBlockElementAncestorOrThrow(anchorNode);
if (element.getIndent() > 0) {
event.preventDefault();
return editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined);
}
}

// 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 (navigator.language === 'ko-KR' && IS_IOS) {
2wheeh marked this conversation as resolved.
Show resolved Hide resolved
return false;
}
event.preventDefault();

return editor.dispatchCommand(DELETE_CHARACTER_COMMAND, true);
},
COMMAND_PRIORITY_EDITOR,
Expand Down
Loading