mirror of
https://github.com/NovaOSS/nova-betterchat.git
synced 2024-11-25 17:33:59 +01:00
consistent enter to submit for new and edit message
fixes #255, fixes #379
This commit is contained in:
parent
c7a355b407
commit
1d88a86293
|
@ -43,21 +43,22 @@ const EditView = ({
|
||||||
|
|
||||||
if (e.key === 'Enter' && !isMobile && !e.nativeEvent.isComposing) {
|
if (e.key === 'Enter' && !isMobile && !e.nativeEvent.isComposing) {
|
||||||
const enterToSubmit = useStore.getState().enterToSubmit;
|
const enterToSubmit = useStore.getState().enterToSubmit;
|
||||||
if (sticky) {
|
|
||||||
if (
|
if (e.ctrlKey && e.shiftKey) {
|
||||||
(enterToSubmit && !e.shiftKey) ||
|
e.preventDefault();
|
||||||
(!enterToSubmit && (e.ctrlKey || e.shiftKey))
|
handleSaveAndSubmit();
|
||||||
) {
|
resetTextAreaHeight();
|
||||||
|
} else if (
|
||||||
|
(enterToSubmit && !e.shiftKey) ||
|
||||||
|
(!enterToSubmit && (e.ctrlKey || e.shiftKey))
|
||||||
|
) {
|
||||||
|
if (sticky) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
handleSaveAndSubmit();
|
handleSaveAndSubmit();
|
||||||
resetTextAreaHeight();
|
resetTextAreaHeight();
|
||||||
|
} else {
|
||||||
|
handleSave();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (e.ctrlKey && e.shiftKey) {
|
|
||||||
e.preventDefault();
|
|
||||||
handleSaveAndSubmit();
|
|
||||||
resetTextAreaHeight();
|
|
||||||
} else if (e.ctrlKey || e.shiftKey) handleSave();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue