This commit is contained in:
iqudoo
2026-06-13 06:13:25 +08:00
parent a08fbd1eb6
commit f71ee2f861
8 changed files with 543 additions and 103 deletions

View File

@@ -9,9 +9,18 @@ interface VisibilityRuleSummaryProps {
onDelete: () => void;
}
/** 将 {变量} 高亮展示 */
/** 将 {变量} 或「内容值」高亮展示 */
function renderRuleDescription(rule: VisibilityRule) {
const text = formatVisibilityRuleDescription(rule);
if (rule.target === 'content') {
const parts = text.split('内容值');
if (parts.length === 1) return text;
return parts.flatMap((part, i) =>
i === 0
? [<span key={`${i}-t`}>{part}</span>, <span key={`${i}-c`} className="var-token"></span>]
: [<span key={`${i}-t`}>{part}</span>]
);
}
const parts = text.split(/(\{[^}]+\})/g);
return parts.map((part, i) =>
part.startsWith('{') && part.endsWith('}') ? (