From aa11ac53eb1509acb3be091750902864984f8ef1 Mon Sep 17 00:00:00 2001 From: Shaun Johnston Date: Tue, 16 Dec 2025 09:34:58 +1000 Subject: [PATCH] interactive --- README.md | 8 ++++---- js/multi_replace.js | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f6ca62..8478671 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A ComfyUI custom node package for creating and applying multiple find/replace pa - **Find/Replace Pairs Node**: Create an arbitrary number of find/replace pairs - Starts with one pair, click "➕ Add Pair" button to add more - Right-click menu also provides Add/Remove pair options - - Text fields with optional input connectors (right-click → Convert to Input) + - Each pair has both a text field AND an input connector - Connected inputs override widget values - Outputs: pairs object, JSON, and CSV formats @@ -41,7 +41,7 @@ A ComfyUI custom node package for creating and applying multiple find/replace pa ### Connecting Dynamic Values -Right-click any find or replace text field and select "Convert to Input" to create a connector. Connected inputs override the widget value, following the standard ComfyUI pattern. +Each pair has both a text field for direct entry and an input connector on the left side. When a connector is linked, it overrides the widget value. ### Chaining Replacers @@ -66,8 +66,8 @@ The Text Replacer node passes through the pairs object, allowing you to chain mu | Input | Type | Description | |-------|------|-------------| -| `find_N` | STRING | Find pattern for pair N (text field, convertible to input) | -| `replace_N` | STRING | Replacement for pair N (text field, convertible to input) | +| `find_N` | STRING | Find pattern for pair N (text field + input connector) | +| `replace_N` | STRING | Replacement for pair N (text field + input connector) | **Buttons:** - **➕ Add Pair** - Add a new find/replace pair diff --git a/js/multi_replace.js b/js/multi_replace.js index 3441058..6ea6d9e 100644 --- a/js/multi_replace.js +++ b/js/multi_replace.js @@ -21,6 +21,11 @@ app.registerExtension({ this.pairCount = 1; this.serialize_widgets = true; + // Add input connectors for the first pair (widgets are already defined) + // Find the widgets for pair 1 and link them to inputs + this.addInput("find_1", "STRING"); + this.addInput("replace_1", "STRING"); + // Add the "Add Pair" button this.addWidget("button", "➕ Add Pair", null, () => { this.addNewPair(); @@ -69,6 +74,10 @@ app.registerExtension({ // Re-add buttons at end this.widgets.push(this.addPairButton, this.removePairButton); + // Add input connectors for the new pair + this.addInput(`find_${idx}`, "STRING"); + this.addInput(`replace_${idx}`, "STRING"); + this.updateRemoveButtonState(); this.setSize(this.computeSize()); app.graph.setDirtyCanvas(true, true);