Let enter behavior be configurable
This commit is contained in:
parent
a5f16494fc
commit
d69ef95a41
@ -82,9 +82,12 @@ const BackstoryTextField = React.forwardRef<BackstoryTextFieldRef, BackstoryText
|
||||
}));
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (!onEnter) {
|
||||
return;
|
||||
}
|
||||
if (event.key === 'Enter' && !event.shiftKey) {
|
||||
event.preventDefault(); // Prevent newline
|
||||
onEnter && onEnter(editValue);
|
||||
onEnter(editValue);
|
||||
setEditValue(''); // Clear textarea
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user