Long custom modifiers in a disabled state (e.g. right-click on the image tag) are properly restored as disabled but are incorrectly shown as "active" in the UI. I somehow missed that in https://github.com/cmdr2/stable-diffusion-ui/pull/1062, so here is the fix for that. This change only applies to plugins that try to restore image modifiers, no change to the regular UI.
* Moving attention weighting to InvokeAI syntax
() and [] were actually ignored by the legacy parser, so moving the Ctrl+Wheel shortcut to the InvokeAI syntax of '+' and '-'.
* Moving attention weighting to InvokeAI syntax
() and [] were actually ignored by the legacy parser, so moving the Ctrl+Wheel shortcut to the InvokeAI syntax of '+' and '-'.
* Properly cleanup parenthesis
'(image tag)++' need to be trimmed to 'image tag'
* Add parenthesis as needed when adjusting weights
In the InvokeAI syntax, 'image modifier' must become '(image modifier)++' when adjusting weight.
* Code cleanup
Fix a regression introduced by PR 1003 that causes disabled image tags to be restored in an enabled state by the "image modifiers improvements" plugin. No change in the regular UX.
* Custom Image Modifiers dialog tweaks
Couple minor usability improvements for the custom image modifiers dialog:
- set the focus to the textbox when opening the dialog
- pressing the Escape key closes the dialog
* Adding keyboard shortcuts
Escape to cancel the changes, Ctrl+Enter to confirm the changes. No change to the existing UI behavior using the mouse.
* Make the overlay focusable
Allows the keyboard shortcuts to work if user clicks on the main window rather than the textbox itself.
* Disable spell and grammar correction
* Fix restoration of weighted tasks with truncated modifiers
* Reverting this change
Will create a separate PR for this as needed. Doesn't impact the other bug fix.
* Update utils.js
Image modifiers may be temporarily hidden by plugins like searchable modifier search box, and when restoring a task (e.g. use settings) the image modifier s copied with the hidden class set, which makes it look like it's missing.
By notifying plugins that the image tags have been refreshed, it allows it to act accordingly (in this case by making sure image tags are visible).
* Preserve full names for shortened modifiers
The PR https://github.com/cmdr2/stable-diffusion-ui/pull/779/files added code to preserve the full names of truncated image modifiers, but only in the "short image modifiers" code path. This PR fixes that by preserving the full car name for truncated modifier names too.
* Pick the full modifier name
The previous code selected the entire innerText from the modifier-car-label element, but for truncated modifiers this would also include the tooltip text. This modification fixes that by only picking specifically the full modifier name.
* Only pick the full modifier name
Previous code would pick up the tooltip text too, causing a mismatch of strings in the comparison.
* Display the truncated image modifier names
What we process and compare is always the full image modifier string, but we still want to display a shortened string when applicable.
This is purely a DOM update to be able to identify the custom category a given custom image modifier is part of, e.g. using .closest() from a custom modifier plugin. No UI change.
Reloading of image tags with ((weight modifiers)) doesn't reuse the modifier card even if it exists, which means images are not restored either. This change fixes that behavior by ensuring proper matching of the tags with existing modifiers.
No change in existing UI behavior, this change allows image modifier plugins to (optionally) pass the card image as a base64-encoded image rather than a source file.
* Toggle image modifiers plugin
Right-click on image modifiers to temporarily turn them off without removing them. To quickly iterate and experiment with various combinations.
Please note this plugin required a minor tweak in getPrompts() to add support for image modifier inactive state.
* Fix tag matching
Co-authored-by: cmdr2 <secondary.cmdr2@gmail.com>
As per Discord conversation, this PR fixed the image modifiers behavior when a modifier appears more than once, and also fixes a regression introduced by ((weighted modifiers)).