feat: regex hide rules (full-match) + right-click Hide button
- Hide rules now use anchored regex (^rule$) so plain text like "Speaker" matches exactly "Speaker", not "Gaming Speaker". To match a substring, use e.g. ".*Speaker.*". Rules that already start with ^ or end with $ are used as-is. - Add "Hide" to node right-click context menu — adds the node's display name as a hide rule immediately Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -114,9 +114,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isNodeHidden(nd: { name: string; nick: string }): boolean {
|
function isNodeHidden(nd: { name: string; nick: string }): boolean {
|
||||||
const dn = displayName(nd).toLowerCase();
|
const dn = displayName(nd);
|
||||||
for (const rule of $patchbay.hide_rules) {
|
for (const rule of $patchbay.hide_rules) {
|
||||||
if (dn === rule.toLowerCase()) return true;
|
try {
|
||||||
|
// Anchor to full match unless user already added anchors
|
||||||
|
const anchored = (rule.startsWith('^') || rule.endsWith('$')) ? rule : `^${rule}$`;
|
||||||
|
if (new RegExp(anchored, 'i').test(dn)) return true;
|
||||||
|
} catch {
|
||||||
|
if (dn.toLowerCase() === rule.toLowerCase()) return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -692,6 +698,11 @@
|
|||||||
renameInput = $patchbay.aliases?.[nodeContextMenu!.nodeName] ?? '';
|
renameInput = $patchbay.aliases?.[nodeContextMenu!.nodeName] ?? '';
|
||||||
nodeContextMenu = null;
|
nodeContextMenu = null;
|
||||||
}}>Rename</button>
|
}}>Rename</button>
|
||||||
|
<button onclick={() => {
|
||||||
|
const nd = $nodes.find(n => n.id === nodeContextMenu!.nodeId);
|
||||||
|
if (nd) addHideRule(displayName(nd));
|
||||||
|
nodeContextMenu = null;
|
||||||
|
}}>Hide</button>
|
||||||
<button onclick={() => {
|
<button onclick={() => {
|
||||||
fetch('/api/destroy-node', {
|
fetch('/api/destroy-node', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
Reference in New Issue
Block a user