feat: Enable Option + Enter to insert a new line (#1887)

This commit is contained in:
Yingjie He
2025-03-28 09:08:26 -07:00
committed by GitHub
parent 594fa7ef6b
commit 1f72044413
+6 -2
View File
@@ -111,9 +111,13 @@ export default function Input({
}
if (evt.key === 'Enter') {
// should not trigger submit on Enter if it's composing (IME input in progress) or shift is pressed
// should not trigger submit on Enter if it's composing (IME input in progress) or shift/alt(option) is pressed
if (evt.shiftKey || isComposing) {
// Allow line break for Shift+Enter or during IME composition
// Allow line break for Shift+Enter, or during IME composition
return;
}
if (evt.altKey) {
setValue(value + '\n');
return;
}