follow global style bug
This commit is contained in:
@@ -60,32 +60,25 @@ export const matchRule = async (
|
|||||||
const rule = rules.find((r) =>
|
const rule = rules.find((r) =>
|
||||||
r.pattern.split(",").some((p) => isMatch(href, p.trim()))
|
r.pattern.split(",").some((p) => isMatch(href, p.trim()))
|
||||||
);
|
);
|
||||||
|
const globalRule = rules.find((r) => r.pattern === GLOBAL_KEY) || GLOBLA_RULE;
|
||||||
const globalRule =
|
|
||||||
rules.find((r) =>
|
|
||||||
r.pattern.split(",").some((p) => p.trim() === GLOBAL_KEY)
|
|
||||||
) || GLOBLA_RULE;
|
|
||||||
|
|
||||||
if (!rule) {
|
if (!rule) {
|
||||||
return globalRule;
|
return globalRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.selector =
|
rule.selector = rule.selector?.trim() || globalRule.selector;
|
||||||
rule?.selector?.trim() ||
|
if (rule.textStyle === GLOBAL_KEY) {
|
||||||
globalRule?.selector?.trim() ||
|
rule.textStyle = globalRule.textStyle;
|
||||||
GLOBLA_RULE.selector;
|
rule.bgColor = globalRule.bgColor;
|
||||||
|
rule.textDiyStyle = globalRule.textDiyStyle;
|
||||||
rule.bgColor = rule?.bgColor?.trim() || globalRule?.bgColor?.trim();
|
} else {
|
||||||
rule.textDiyStyle =
|
rule.bgColor = rule.bgColor?.trim() || globalRule.bgColor;
|
||||||
rule?.textDiyStyle?.trim() || globalRule?.textDiyStyle?.trim();
|
rule.textDiyStyle = rule.textDiyStyle?.trim() || globalRule.textDiyStyle;
|
||||||
|
}
|
||||||
["translator", "fromLang", "toLang", "textStyle", "transOpen"].forEach(
|
["translator", "fromLang", "toLang", "transOpen"].forEach((key) => {
|
||||||
(key) => {
|
if (rule[key] === GLOBAL_KEY) {
|
||||||
if (rule[key] === GLOBAL_KEY) {
|
rule[key] = globalRule[key];
|
||||||
rule[key] = globalRule[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
return rule;
|
return rule;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user