if editing and styles tab is selected and it exists for the next item, keep it selected

This commit is contained in:
Jamie V 2025-01-16 14:49:24 -08:00
parent 4202de9f98
commit f4f010ac4f

View File

@ -80,7 +80,9 @@ export default {
}, },
methods: { methods: {
updateSelection() { updateSelection() {
const previousSelectedTab = this.selectedTab?.key;
const inspectorViews = this.openmct.inspectorViews.get(this.openmct.selection.get()); const inspectorViews = this.openmct.inspectorViews.get(this.openmct.selection.get());
const isEditing = this.openmct.editor.isEditing();
this.tabs = inspectorViews.map((view) => { this.tabs = inspectorViews.map((view) => {
return { return {
@ -91,7 +93,13 @@ export default {
}; };
}); });
this.selectTab(this.visibleTabs[0]); const stylesTabIndex = this.tabs.findIndex((tab) => tab.key === 'stylesInspectorView');
if (isEditing && previousSelectedTab === 'stylesInspectorView' && stylesTabIndex !== -1) {
this.selectTab(this.tabs[stylesTabIndex]);
} else {
this.selectTab(this.visibleTabs[0]);
}
}, },
isSelected(tab) { isSelected(tab) {
return this.selectedTab?.key === tab.key; return this.selectedTab?.key === tab.key;