完美
This commit is contained in:
@@ -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('}') ? (
|
||||
|
||||
Reference in New Issue
Block a user