support diy text styles

This commit is contained in:
Gabe Yuan
2023-09-01 15:57:05 +08:00
parent 3e36ceb5b9
commit 503a71302c
8 changed files with 11075 additions and 15315 deletions

View File

@@ -52,6 +52,7 @@ export const matchRule = async (
GLOBLA_RULE.selector;
rule.bgColor = rule?.bgColor?.trim() || globalRule?.bgColor?.trim();
rule.textDiyStyle = rule?.textDiyStyle?.trim() || globalRule?.textDiyStyle?.trim();
["translator", "fromLang", "toLang", "textStyle", "transOpen"].forEach(
(key) => {
@@ -99,10 +100,12 @@ export const checkRules = (rules) => {
textStyle,
transOpen,
bgColor,
textDiyStyle,
}) => ({
pattern: pattern.trim(),
selector: type(selector) === "string" ? selector : "",
bgColor: type(bgColor) === "string" ? bgColor : "",
textDiyStyle: type(textDiyStyle) === "string" ? textDiyStyle : "",
translator: matchValue([GLOBAL_KEY, ...OPT_TRANS_ALL], translator),
fromLang: matchValue([GLOBAL_KEY, ...fromLangs], fromLang),
toLang: matchValue([GLOBAL_KEY, ...toLangs], toLang),