@@ -50,16 +50,19 @@ function initializeEventHandlers() {
5050 ComfyWidgets . STRING = function ( node , inputName , inputData , appInstance ) { // Use appInstance to avoid conflict with global app
5151 const result = originalStringWidget . apply ( this , arguments ) ;
5252
53- // Check if the widget has an inputEl and if it's a TEXTAREA
53+ // Check if the widget has an element and if it's a TEXTAREA
5454 // This is to ensure we are targeting multiline text inputs, related to '.comfy-multiline-input'
55- if ( result && result . widget
56- && result . widget . inputEl && result . widget . inputEl . tagName === 'TEXTAREA' && ! result . widget . inputEl . readOnly ) {
57- const widgetConfig = inputData && inputData [ 1 ] ? inputData [ 1 ] : { } ;
58- // Future: Add checks for Autocomplete Plus specific configurations if needed
59- // e.g., if (widgetConfig["AutocompletePlus.enabled"] === false) return result;
60-
61- const nodeInfo = new NodeInfo ( node . comfyClass || node . constructor . name , inputName ) ;
62- attachListeners ( result . widget . inputEl , nodeInfo ) ;
55+ if ( result && result . widget ) {
56+ // fallback for older Comfyui frontend versions
57+ const inputEl = result . widget . element ?? result . widget . inputEl ;
58+ if ( inputEl && inputEl . tagName === 'TEXTAREA' && ! inputEl . readOnly ) {
59+ const widgetConfig = inputData && inputData [ 1 ] ? inputData [ 1 ] : { } ;
60+ // Future: Add checks for Autocomplete Plus specific configurations if needed
61+ // e.g., if (widgetConfig["AutocompletePlus.enabled"] === false) return result;
62+
63+ const nodeInfo = new NodeInfo ( node . comfyClass || node . constructor . name , inputName ) ;
64+ attachListeners ( inputEl , nodeInfo ) ;
65+ }
6366 }
6467 return result ;
6568 } ;
0 commit comments