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:
parent
728cac0a34
commit
b9b3406b28
1 changed files with 5 additions and 1 deletions
|
|
@ -154,7 +154,11 @@ export function TitleEditor({
|
||||||
|
|
||||||
function handleTitleKeyDown(event: any) {
|
function handleTitleKeyDown(event: any) {
|
||||||
if (!titleEditor || !pageEditor || event.shiftKey) return;
|
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 { key } = event;
|
||||||
const { $head } = titleEditor.state.selection;
|
const { $head } = titleEditor.state.selection;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue