添加可以选择悬浮按钮单击操作的设置选项 (#313)

* Add an option in Settings to provide choices for the FAB Single Click action.

* Complete Translation

---------

Co-authored-by: 1030283726 <1030283726@qq.com>
This commit is contained in:
Zack C
2025-09-21 00:50:39 +10:00
committed by GitHub
parent d39a016d5f
commit 563242c5f1
4 changed files with 40 additions and 3 deletions

View File

@@ -33,6 +33,8 @@ export default function Action({ translator, fab }) {
});
const [moved, setMoved] = useState(false);
const { fabClickAction = 0 } = fab || {};
const handleWindowResize = useMemo(
() =>
debounce(() => {
@@ -215,7 +217,14 @@ export default function Action({ translator, fab }) {
color="primary"
onClick={(e) => {
if (!moved) {
setShowPopup((pre) => !pre);
if (fabClickAction === 1) {
translator.toggle();
sendIframeMsg(MSG_TRANS_TOGGLE);
setShowPopup(false);
}
else {
setShowPopup((pre) => !pre);
}
}
}}
>

View File

@@ -122,7 +122,7 @@ export default function Settings() {
transInterval = 500,
langDetector = OPT_TRANS_MICROSOFT,
} = setting;
const { isHide = false } = fab || {};
const { isHide = false, fabClickAction = 0 } = fab || {};
return (
<Box>
@@ -232,6 +232,19 @@ export default function Settings() {
</Select>
</FormControl>
<FormControl size="small">
<InputLabel>{i18n("fab_click_action")}</InputLabel>
<Select
name="fabClickAction"
value={fabClickAction}
label={i18n("fab_click_action")}
onChange= {(e) => updateFab({ fabClickAction: e.target.value })}
>
<MenuItem value={0}>{i18n("fab_click_menu")}</MenuItem>
<MenuItem value={1}>{i18n("fab_click_translate")}</MenuItem>
</Select>
</FormControl>
<FormControl size="small">
<InputLabel>{i18n("context_menus")}</InputLabel>
<Select