diff --git a/packages/lexical-plain-text/src/index.ts b/packages/lexical-plain-text/src/index.ts index 1df4cb1c1ca..3300e8d73c3 100644 --- a/packages/lexical-plain-text/src/index.ts +++ b/packages/lexical-plain-text/src/index.ts @@ -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); }, diff --git a/packages/lexical-rich-text/src/index.ts b/packages/lexical-rich-text/src/index.ts index bf53a8acdd4..cec5da17fa7 100644 --- a/packages/lexical-rich-text/src/index.ts +++ b/packages/lexical-rich-text/src/index.ts @@ -860,7 +860,7 @@ export function registerRichText(editor: LexicalEditor): () => void { if (!$isRangeSelection(selection)) { return false; } - event.preventDefault(); + const {anchor} = selection; const anchorNode = anchor.getNode(); @@ -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 (IS_IOS && navigator.language === 'ko-KR') { + return false; + } + event.preventDefault(); + return editor.dispatchCommand(DELETE_CHARACTER_COMMAND, true); }, COMMAND_PRIORITY_EDITOR,