interactive
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user