feat: add text additional styles to rule

This commit is contained in:
Gabe
2025-11-03 19:01:57 +08:00
parent 1e63fd1e19
commit 814ce4ca11
5 changed files with 25 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ export const matchRule = async (href, { injectRules, subrulesList }) => {
"aiTerms",
"termsStyle",
"highlightStyle",
"textExtStyle",
"selectStyle",
"parentStyle",
"grandStyle",
@@ -150,6 +151,7 @@ export const checkRules = (rules) => {
aiTerms,
termsStyle,
highlightStyle,
textExtStyle,
selectStyle,
parentStyle,
grandStyle,
@@ -189,6 +191,7 @@ export const checkRules = (rules) => {
aiTerms: type(aiTerms) === "string" ? aiTerms : "",
termsStyle: type(termsStyle) === "string" ? termsStyle : "",
highlightStyle: type(highlightStyle) === "string" ? highlightStyle : "",
textExtStyle: type(textExtStyle) === "string" ? textExtStyle : "",
selectStyle: type(selectStyle) === "string" ? selectStyle : "",
parentStyle: type(parentStyle) === "string" ? parentStyle : "",
grandStyle: type(grandStyle) === "string" ? grandStyle : "",

View File

@@ -1153,6 +1153,7 @@ export class Translator {
transEndHook,
transOnly,
termsStyle,
textExtStyle,
selectStyle,
parentStyle,
grandStyle,
@@ -1187,6 +1188,9 @@ export class Translator {
const inner = document.createElement(transTag);
inner.className = `${Translator.KISS_CLASS.inner} ${this.#textClass[textStyle]}`;
if (textExtStyle?.trim()) {
inner.style.cssText = textExtStyle; // 附加内联样式
}
inner.appendChild(createLoadingSVG());
wrapper.appendChild(inner);
nodes[nodes.length - 1].after(wrapper);