File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,10 @@ export class ExpertComms {
141141 'registry:node-set-disabled' : 'notifyPaletteChange' ,
142142 'registry:node-set-enabled' : 'notifyPaletteChange' ,
143143 // selection changes
144- 'view:selection-changed' : 'notifySelectionChanged'
144+ 'view:selection-changed' : 'notifySelectionChanged' ,
145+ // workspace changes
146+ 'workspace:change' : 'notifyWorkspaceChange' ,
147+ 'flows:loaded' : 'notifyWorkspaceChange'
145148 }
146149
147150 /**
@@ -212,6 +215,8 @@ export class ExpertComms {
212215
213216 this . setupMessageListeners ( )
214217
218+ this . notifyWorkspaceChange ( )
219+
215220 // Notify the parent window that the assistant is ready
216221 this . postParent ( {
217222 type : 'assistant-ready' ,
@@ -502,6 +507,17 @@ export class ExpertComms {
502507 }
503508 }
504509
510+ notifyWorkspaceChange ( ) {
511+ const activeTab = this . RED . workspaces ?. active ?. ( )
512+ const tab = activeTab ? ( this . RED . nodes ?. workspace ( activeTab ) || this . RED . nodes ?. subflow ( activeTab ) ) : null
513+ const label = tab ?. label || tab ?. name
514+ if ( ! label ) { return }
515+ this . postParent ( {
516+ type : 'nr-assistant/workspace:change' ,
517+ tab : { id : tab . id , label }
518+ } )
519+ }
520+
505521 /**
506522 * FlowFuse Expert message handlers
507523 */
You can’t perform that action at this time.
0 commit comments