[skip ci] Translate: Shift/Right click shortcut
This commit is contained in:
parent
a8b6aea26f
commit
622e8dc3e0
2 changed files with 9 additions and 4 deletions
|
@ -43,6 +43,8 @@ export function TranslateChatBarIcon({ slateProps }: { slateProps: { type: { ana
|
||||||
if (slateProps.type.analyticsName !== "normal")
|
if (slateProps.type.analyticsName !== "normal")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
const toggle = () => settings.store.autoTranslate = !autoTranslate;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip text="Open Translate Modal">
|
<Tooltip text="Open Translate Modal">
|
||||||
{({ onMouseEnter, onMouseLeave }) => (
|
{({ onMouseEnter, onMouseLeave }) => (
|
||||||
|
@ -55,11 +57,14 @@ export function TranslateChatBarIcon({ slateProps }: { slateProps: { type: { ana
|
||||||
onMouseEnter={onMouseEnter}
|
onMouseEnter={onMouseEnter}
|
||||||
onMouseLeave={onMouseLeave}
|
onMouseLeave={onMouseLeave}
|
||||||
innerClassName={ButtonWrapperClasses.button}
|
innerClassName={ButtonWrapperClasses.button}
|
||||||
onClick={() =>
|
onClick={e => {
|
||||||
|
if (e.shiftKey) return toggle();
|
||||||
|
|
||||||
openModal(props => (
|
openModal(props => (
|
||||||
<TranslateModal rootProps={props} />
|
<TranslateModal rootProps={props} />
|
||||||
))
|
));
|
||||||
}
|
}}
|
||||||
|
onContextMenu={() => toggle()}
|
||||||
style={{ padding: "0 4px" }}
|
style={{ padding: "0 4px" }}
|
||||||
>
|
>
|
||||||
<div className={ButtonWrapperClasses.buttonWrapper}>
|
<div className={ButtonWrapperClasses.buttonWrapper}>
|
||||||
|
|
|
@ -46,7 +46,7 @@ export const settings = definePluginSettings({
|
||||||
},
|
},
|
||||||
autoTranslate: {
|
autoTranslate: {
|
||||||
type: OptionType.BOOLEAN,
|
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
|
default: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue