File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -473,16 +473,31 @@ module.exports = function (RED) {
473473 if ( ! handshakeEditKey || ! meta ?. wysiwyg ?. editKey || handshakeEditKey !== meta . wysiwyg . editKey ) {
474474 delete meta . wysiwyg
475475 }
476- // pass the connected UI the UI config
477- socket . emit ( 'ui-config' , node . id , {
476+
477+ // Prepare the UI configuration
478+ const uiConfig = {
478479 meta,
479480 dashboards : Object . fromEntries ( node . ui . dashboards ) ,
480481 heads : Object . fromEntries ( node . ui . heads ) ,
481482 pages : Object . fromEntries ( node . ui . pages ) ,
482483 themes : Object . fromEntries ( node . ui . themes ) ,
483484 groups : Object . fromEntries ( node . ui . groups ) ,
484485 widgets : Object . fromEntries ( node . ui . widgets )
485- } )
486+ } ;
487+
488+ // Apply plugin modifications
489+ let finalConfig = uiConfig ;
490+ RED . plugins . getByType ( 'node-red-dashboard-2' ) . forEach ( plugin => {
491+ if ( plugin . hooks ?. onEmitConfig ) {
492+ const modifiedConfig = plugin . hooks . onEmitConfig ( socket , finalConfig ) ;
493+ if ( modifiedConfig ) {
494+ finalConfig = modifiedConfig ;
495+ }
496+ }
497+ } ) ;
498+
499+ // Pass the connected UI the UI config
500+ socket . emit ( 'ui-config' , node . id , finalConfig ) ;
486501 }
487502
488503 // remove event handler socket listeners for a given socket connection
You can’t perform that action at this time.
0 commit comments