mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
feat: add clear button to autocomplete text widget and fix external value change sync
- Add clear button inside autocomplete text widget that shows when text exists - Support both Canvas mode and Vue DOM mode with appropriate styling - Fix clear button visibility when value is changed externally (e.g., via 'send lora to workflow') - Implement dual notification mechanism: CustomEvent + onSetValue callback - Update widget interface to include onSetValue property
This commit is contained in:
@@ -416,6 +416,14 @@ function createAutocompleteTextWidgetFactory(
|
||||
setValue(v: string) {
|
||||
if (widget.inputEl) {
|
||||
widget.inputEl.value = v ?? ''
|
||||
// Notify Vue component of value change via custom event
|
||||
widget.inputEl.dispatchEvent(new CustomEvent('lora-manager:autocomplete-value-changed', {
|
||||
detail: { value: v ?? '' }
|
||||
}))
|
||||
}
|
||||
// Also call onSetValue if defined (for Vue component integration)
|
||||
if (typeof widget.onSetValue === 'function') {
|
||||
widget.onSetValue(v ?? '')
|
||||
}
|
||||
},
|
||||
serialize: true,
|
||||
|
||||
Reference in New Issue
Block a user