add new shortcuts
This commit is contained in:
@@ -1285,6 +1285,40 @@ export function EmailComposer({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleComposerKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
||||||
|
if (e.defaultPrevented) return;
|
||||||
|
|
||||||
|
const isPlainEscape = e.key === 'Escape' && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey;
|
||||||
|
const isSendShortcut = e.key === 'Enter' && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey;
|
||||||
|
if (!isPlainEscape && !isSendShortcut) return;
|
||||||
|
|
||||||
|
if (
|
||||||
|
showTemplatePicker ||
|
||||||
|
showSaveAsTemplate ||
|
||||||
|
showScheduleDialog ||
|
||||||
|
smimePassphrasePrompt ||
|
||||||
|
showAttachmentWarning ||
|
||||||
|
showCloseDialog
|
||||||
|
) return;
|
||||||
|
|
||||||
|
if (isPlainEscape) {
|
||||||
|
if (activeAutoField) return;
|
||||||
|
e.preventDefault();
|
||||||
|
handleClose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSendShortcut) {
|
||||||
|
if (e.repeat) {
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
handleSend();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("flex h-full bg-background", className)}>
|
<div className={cn("flex h-full bg-background", className)}>
|
||||||
<PluginSlot
|
<PluginSlot
|
||||||
@@ -1299,6 +1333,7 @@ export function EmailComposer({
|
|||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
|
onKeyDown={handleComposerKeyDown}
|
||||||
>
|
>
|
||||||
{/* Drag overlay */}
|
{/* Drag overlay */}
|
||||||
{isDraggingOver && (
|
{isDraggingOver && (
|
||||||
|
|||||||
Reference in New Issue
Block a user