[skip ci] Translate: Shift/Right click shortcut

This commit is contained in:
V 2023-05-11 19:00:18 +02:00
parent a8b6aea26f
commit 622e8dc3e0
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
2 changed files with 9 additions and 4 deletions

View file

@ -43,6 +43,8 @@ export function TranslateChatBarIcon({ slateProps }: { slateProps: { type: { ana
if (slateProps.type.analyticsName !== "normal")
return null;
const toggle = () => settings.store.autoTranslate = !autoTranslate;
return (
<Tooltip text="Open Translate Modal">
{({ onMouseEnter, onMouseLeave }) => (
@ -55,11 +57,14 @@ export function TranslateChatBarIcon({ slateProps }: { slateProps: { type: { ana
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
innerClassName={ButtonWrapperClasses.button}
onClick={() =>
onClick={e => {
if (e.shiftKey) return toggle();
openModal(props => (
<TranslateModal rootProps={props} />
))
}
));
}}
onContextMenu={() => toggle()}
style={{ padding: "0 4px" }}
>
<div className={ButtonWrapperClasses.buttonWrapper}>

View file

@ -46,7 +46,7 @@ export const settings = definePluginSettings({
},
autoTranslate: {
type: OptionType.BOOLEAN,
description: "Automatically translate your messages before sending",
description: "Automatically translate your messages before sending. You can also shift/right click the translate button to toggle this",
default: false
}
});