mirror of
https://github.com/ztjhz/BetterChatGPT.git
synced 2023-07-20 23:11:29 +03:00
consistent enter to submit for new and edit message
fixes #255, fixes #379
This commit is contained in:
@@ -43,21 +43,22 @@ const EditView = ({
|
||||
|
||||
if (e.key === 'Enter' && !isMobile && !e.nativeEvent.isComposing) {
|
||||
const enterToSubmit = useStore.getState().enterToSubmit;
|
||||
if (sticky) {
|
||||
if (
|
||||
(enterToSubmit && !e.shiftKey) ||
|
||||
(!enterToSubmit && (e.ctrlKey || e.shiftKey))
|
||||
) {
|
||||
|
||||
if (e.ctrlKey && e.shiftKey) {
|
||||
e.preventDefault();
|
||||
handleSaveAndSubmit();
|
||||
resetTextAreaHeight();
|
||||
} else if (
|
||||
(enterToSubmit && !e.shiftKey) ||
|
||||
(!enterToSubmit && (e.ctrlKey || e.shiftKey))
|
||||
) {
|
||||
if (sticky) {
|
||||
e.preventDefault();
|
||||
handleSaveAndSubmit();
|
||||
resetTextAreaHeight();
|
||||
} else {
|
||||
handleSave();
|
||||
}
|
||||
} else {
|
||||
if (e.ctrlKey && e.shiftKey) {
|
||||
e.preventDefault();
|
||||
handleSaveAndSubmit();
|
||||
resetTextAreaHeight();
|
||||
} else if (e.ctrlKey || e.shiftKey) handleSave();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user