From 6dd581d5e210554f1f423338d59107066d977b82 Mon Sep 17 00:00:00 2001 From: Gabe Yuan Date: Fri, 15 Mar 2024 16:00:20 +0800 Subject: [PATCH] fix: default trans tag --- src/config/index.js | 4 +++- src/views/Content/index.js | 3 ++- src/views/Options/Setting.js | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config/index.js b/src/config/index.js index 35a94a4..3c478c6 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -324,6 +324,8 @@ export const PROMPT_PLACE_TEXT = "{{text}}"; // 占位符 export const DEFAULT_COLOR = "#209CEE"; // 默认高亮背景色/线条颜色 +export const DEFAULT_TRANS_TAG = "font"; + // 全局规则 export const GLOBLA_RULE = { pattern: "*", @@ -460,7 +462,7 @@ export const DEFAULT_SETTING = { detectRemote: false, // 是否使用远程语言检测 contextMenus: true, // 是否添加右键菜单(作废) contextMenuType: 1, // 右键菜单类型(0不显示,1简单菜单,2多级菜单) - transTag: "span", // 译文元素标签 + transTag: DEFAULT_TRANS_TAG, // 译文元素标签 transOnly: false, // 是否仅显示译文 transTitle: false, // 是否同时翻译页面标题 subrulesList: DEFAULT_SUBRULES_LIST, // 订阅列表 diff --git a/src/views/Content/index.js b/src/views/Content/index.js index 3b15c2e..4f5039f 100644 --- a/src/views/Content/index.js +++ b/src/views/Content/index.js @@ -12,6 +12,7 @@ import { DEFAULT_COLOR, MSG_TRANS_CURRULE, TRANS_NEWLINE_LENGTH, + DEFAULT_TRANS_TAG, } from "../../config"; import { useTranslate } from "../../hooks/Translate"; import { styled, css } from "@mui/material/styles"; @@ -90,7 +91,7 @@ export default function Content({ q, keeps, translator, $el }) { const { newlineLength = TRANS_NEWLINE_LENGTH, - transTag = "span", + transTag = DEFAULT_TRANS_TAG, transOnly = false, } = translator.setting; diff --git a/src/views/Options/Setting.js b/src/views/Options/Setting.js index 88a19da..c80ff27 100644 --- a/src/views/Options/Setting.js +++ b/src/views/Options/Setting.js @@ -26,6 +26,7 @@ import { OPT_LANGS_TO, DEFAULT_BLACKLIST, MSG_CONTEXT_MENUS, + DEFAULT_TRANS_TAG, } from "../../config"; import { useShortcut } from "../../hooks/Shortcut"; import ShortcutInput from "./ShortcutInput"; @@ -97,7 +98,7 @@ export default function Settings() { mouseKey = OPT_MOUSEKEY_DISABLE, detectRemote = false, contextMenuType = 1, - transTag = "span", + transTag = DEFAULT_TRANS_TAG, transOnly = false, transTitle = false, touchTranslate = 2,