@@ -203,7 +203,8 @@ export default class TabSettingsModal {
203203 const outputContent = document . createElement ( "div" ) ;
204204 addClass ( outputContent , "modalTabContent" ) ;
205205 outputContent . id = "output-content" ;
206- this . drawOutputSettings ( outputContent ) ;
206+ // Output settings will be loaded when tab is accessed
207+ outputContent . setAttribute ( "data-needs-init" , "true" ) ;
207208
208209 const editorContent = document . createElement ( "div" ) ;
209210 addClass ( editorContent , "modalTabContent" ) ;
@@ -268,10 +269,11 @@ export default class TabSettingsModal {
268269 ( tabName === "request" && index === 0 ) ||
269270 ( tabName === "endpoints" && index === 1 ) ||
270271 ( tabName === "prefix" && index === 2 ) ||
271- ( tabName === "editor" && index === 3 ) ||
272- ( tabName === "importexport" && index === 4 ) ||
273- ( tabName === "shortcuts" && index === 5 ) ||
274- ( tabName === "about" && index === 6 )
272+ ( tabName === "output" && index === 3 ) ||
273+ ( tabName === "editor" && index === 4 ) ||
274+ ( tabName === "importexport" && index === 5 ) ||
275+ ( tabName === "shortcuts" && index === 6 ) ||
276+ ( tabName === "about" && index === 7 )
275277 ) {
276278 addClass ( btn as HTMLElement , "active" ) ;
277279 } else {
@@ -287,6 +289,12 @@ export default class TabSettingsModal {
287289 content . innerHTML = "" ;
288290 this . drawEditorSettings ( content as HTMLElement ) ;
289291 }
292+ // Load output settings if switching to output tab and it hasn't been loaded yet
293+ if ( tabName === "output" && content . getAttribute ( "data-needs-init" ) === "true" ) {
294+ content . removeAttribute ( "data-needs-init" ) ;
295+ content . innerHTML = "" ;
296+ this . drawOutputSettings ( content as HTMLElement ) ;
297+ }
290298 // Refresh endpoints list when switching to endpoints tab
291299 if ( tabName === "endpoints" ) {
292300 const endpointsList = content . querySelector ( ".endpointsTable" ) ;
@@ -341,11 +349,26 @@ export default class TabSettingsModal {
341349 }
342350
343351 private drawOutputSettings ( container : HTMLElement ) {
344- const yasr = this . tab . getYasr ( ) ;
352+ // Ensure yasr is instantiated
353+ let yasr = this . tab . getYasr ( ) ;
354+ if ( ! yasr ) {
355+ // Initialize yasr if it hasn't been created yet
356+ try {
357+ yasr = this . tab . initYasr ( ) ;
358+ } catch ( e ) {
359+ // If initialization fails, show a helpful message
360+ const notice = document . createElement ( "p" ) ;
361+ addClass ( notice , "settingsHelp" ) ;
362+ notice . textContent = "Unable to load output settings. Please try again." ;
363+ container . appendChild ( notice ) ;
364+ return ;
365+ }
366+ }
367+
345368 if ( ! yasr ) {
346369 const notice = document . createElement ( "p" ) ;
347370 addClass ( notice , "settingsHelp" ) ;
348- notice . textContent = "Output settings will be available after running a query ." ;
371+ notice . textContent = "Output settings are not available yet ." ;
349372 container . appendChild ( notice ) ;
350373 return ;
351374 }
@@ -359,7 +382,7 @@ export default class TabSettingsModal {
359382
360383 // Get available plugins
361384 const availablePlugins = yasr . getAvailablePlugins ( ) ;
362- const currentOrder = yasr . getPluginOrder ( ) || { select : [ ] , construct : [ ] } ;
385+ const currentOrder = this . tab . yasgui . persistentConfig . getPluginOrder ( ) || { select : [ ] , construct : [ ] } ;
363386
364387 // Initialize with priority-based order if empty
365388 if ( ! currentOrder . select || currentOrder . select . length === 0 ) {
@@ -447,8 +470,8 @@ export default class TabSettingsModal {
447470 container . appendChild ( constructSection ) ;
448471
449472 // Initialize drag and drop
450- this . initializePluginOrderDragDrop ( selectList , "select" , yasr ) ;
451- this . initializePluginOrderDragDrop ( constructList , "construct" , yasr ) ;
473+ this . initializePluginOrderDragDrop ( selectList , "select" ) ;
474+ this . initializePluginOrderDragDrop ( constructList , "construct" ) ;
452475 }
453476
454477 private createPluginOrderItem ( pluginName : string , pluginLabel : string ) : HTMLLIElement {
@@ -471,7 +494,7 @@ export default class TabSettingsModal {
471494 return item ;
472495 }
473496
474- private initializePluginOrderDragDrop ( listEl : HTMLElement , queryType : "select" | "construct" , yasr : any ) {
497+ private initializePluginOrderDragDrop ( listEl : HTMLElement , queryType : "select" | "construct" ) {
475498 sortablejs . create ( listEl , {
476499 animation : 150 ,
477500 handle : ".pluginOrderDragHandle" ,
@@ -489,18 +512,18 @@ export default class TabSettingsModal {
489512 }
490513 } ) ;
491514
492- // Save the new order
493- const currentOrder = yasr . getPluginOrder ( ) || { select : [ ] , construct : [ ] } ;
515+ // Save the new order to global config
516+ const currentOrder = this . tab . yasgui . persistentConfig . getPluginOrder ( ) || { select : [ ] , construct : [ ] } ;
494517 if ( queryType === "select" ) {
495518 currentOrder . select = newOrder ;
496519 } else {
497520 currentOrder . construct = newOrder ;
498521 }
499- yasr . setPluginOrder ( currentOrder ) ;
522+ this . tab . yasgui . persistentConfig . setPluginOrder ( currentOrder ) ;
500523
501524 // Show feedback
502525 this . showNotification (
503- `${ queryType === "select" ? "SELECT/ASK" : "CONSTRUCT/DESCRIBE" } plugin order updated` ,
526+ `${ queryType === "select" ? "SELECT/ASK" : "CONSTRUCT/DESCRIBE" } plugin order updated (applies to all tabs) ` ,
504527 "success" ,
505528 ) ;
506529 } ,
0 commit comments