Add shortcuts for forward/delete selected/targeted messages
This commit is contained in:
parent
dd16be13b0
commit
d0f17a1398
9 changed files with 106 additions and 35 deletions
|
@ -163,7 +163,7 @@ const MESSAGE_SHORTCUTS: Array<ShortcutType> = [
|
|||
keys: [['commandOrCtrl', 'S']],
|
||||
},
|
||||
{
|
||||
description: 'Keyboard--delete-message',
|
||||
description: 'Keyboard--delete-messages',
|
||||
keys: [['commandOrCtrl', 'shift', 'D']],
|
||||
},
|
||||
];
|
||||
|
|
|
@ -6,6 +6,9 @@ import { useEscapeHandling } from '../../hooks/useEscapeHandling';
|
|||
|
||||
export type PropsType = {
|
||||
conversationId: string;
|
||||
hasOpenModal: boolean;
|
||||
isSelectMode: boolean;
|
||||
onExitSelectMode: () => void;
|
||||
processAttachments: (options: {
|
||||
conversationId: string;
|
||||
files: ReadonlyArray<File>;
|
||||
|
@ -14,21 +17,18 @@ export type PropsType = {
|
|||
renderConversationHeader: () => JSX.Element;
|
||||
renderTimeline: () => JSX.Element;
|
||||
renderPanel: () => JSX.Element | undefined;
|
||||
isSelectMode: boolean;
|
||||
isForwardModalOpen: boolean;
|
||||
onExitSelectMode: () => void;
|
||||
};
|
||||
|
||||
export function ConversationView({
|
||||
conversationId,
|
||||
hasOpenModal,
|
||||
isSelectMode,
|
||||
onExitSelectMode,
|
||||
processAttachments,
|
||||
renderCompositionArea,
|
||||
renderConversationHeader,
|
||||
renderTimeline,
|
||||
renderPanel,
|
||||
isSelectMode,
|
||||
isForwardModalOpen,
|
||||
onExitSelectMode,
|
||||
}: PropsType): JSX.Element {
|
||||
const onDrop = React.useCallback(
|
||||
(event: React.DragEvent<HTMLDivElement>) => {
|
||||
|
@ -88,7 +88,7 @@ export function ConversationView({
|
|||
);
|
||||
|
||||
useEscapeHandling(
|
||||
isSelectMode && !isForwardModalOpen ? onExitSelectMode : undefined
|
||||
isSelectMode && !hasOpenModal ? onExitSelectMode : undefined
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
@ -103,11 +103,11 @@ export default function SelectModeActions({
|
|||
onDeleteMessages();
|
||||
},
|
||||
style: 'negative',
|
||||
text: i18n('icu:SelectModeActions__confirmDelete--confirm'),
|
||||
text: i18n('icu:ConfirmDeleteForMeModal--confirm'),
|
||||
},
|
||||
]}
|
||||
dialogName="TimelineMessage/deleteMessage"
|
||||
title={i18n('icu:SelectModeActions__confirmDelete--title', {
|
||||
dialogName="ConfirmDeleteForMeModal"
|
||||
title={i18n('icu:ConfirmDeleteForMeModal--title', {
|
||||
count: selectedMessageIds.length,
|
||||
})}
|
||||
i18n={i18n}
|
||||
|
@ -115,7 +115,7 @@ export default function SelectModeActions({
|
|||
setConfirmDelete(false);
|
||||
}}
|
||||
>
|
||||
{i18n('icu:SelectModeActions__confirmDelete--description', {
|
||||
{i18n('icu:ConfirmDeleteForMeModal--description', {
|
||||
count: selectedMessageIds.length,
|
||||
})}
|
||||
</ConfirmationDialog>
|
||||
|
|
|
@ -369,14 +369,19 @@ export function TimelineMessage(props: Props): JSX.Element {
|
|||
messageIds: [id],
|
||||
}),
|
||||
style: 'negative',
|
||||
text: i18n('delete'),
|
||||
text: i18n('icu:ConfirmDeleteForMeModal--confirm'),
|
||||
},
|
||||
]}
|
||||
dialogName="TimelineMessage/deleteMessage"
|
||||
dialogName="ConfirmDeleteForMeModal"
|
||||
i18n={i18n}
|
||||
onClose={() => setHasDeleteConfirmation(false)}
|
||||
title={i18n('icu:ConfirmDeleteForMeModal--title', {
|
||||
count: 1,
|
||||
})}
|
||||
>
|
||||
{i18n('deleteWarning')}
|
||||
{i18n('icu:ConfirmDeleteForMeModal--description', {
|
||||
count: 1,
|
||||
})}
|
||||
</ConfirmationDialog>
|
||||
)}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue