[lexical] Chore: Revert Enter command to use inexact matching (#7479)

This commit is contained in:
Daniel Teo
2025-04-17 22:49:44 +08:00
committed by GitHub
parent aea58dcc9a
commit 141ecad8bb

View File

@ -926,11 +926,20 @@ export function isUnderline(event: KeyboardEventModifiers): boolean {
}
export function isParagraph(event: KeyboardEventModifiers): boolean {
return isExactShortcutMatch(event, 'Enter', {});
return isExactShortcutMatch(event, 'Enter', {
altKey: 'any',
ctrlKey: 'any',
metaKey: 'any',
});
}
export function isLineBreak(event: KeyboardEventModifiers): boolean {
return isExactShortcutMatch(event, 'Enter', {shiftKey: true});
return isExactShortcutMatch(event, 'Enter', {
altKey: 'any',
ctrlKey: 'any',
metaKey: 'any',
shiftKey: true,
});
}
// Inserts a new line after the selection
@ -1045,10 +1054,6 @@ export function controlOrMeta(metaKey: boolean, ctrlKey: boolean): boolean {
return ctrlKey;
}
export function isReturn(event: KeyboardEventModifiers): boolean {
return event.key === 'Enter';
}
export function isBackspace(event: KeyboardEventModifiers): boolean {
return event.key === 'Backspace';
}