Fix: Prevent premature focus change in TitleEditor when pressing Enter during IME composition (#730)

* fix: Prevents key events during text composition

Stops handling title key events when composing text,
ensuring proper input behavior during IME use.

* Refines IME composition event checks

Separates IME composition control from shift key logic and adds a Safari-specific keyCode check to prevent premature focus shifts during IME input.
This commit is contained in:
Auxa
2025-06-19 05:33:35 +09:00
committed by GitHub
parent 728cac0a34
commit b9b3406b28

View File

@ -154,7 +154,11 @@ export function TitleEditor({
function handleTitleKeyDown(event: any) {
if (!titleEditor || !pageEditor || event.shiftKey) return;
// Prevent focus shift when IME composition is active
// `keyCode === 229` is added to support Safari where `isComposing` may not be reliable
if (event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) return;
const { key } = event;
const { $head } = titleEditor.state.selection;