diff --git a/packages/yasgui/src/PersistentConfig.ts b/packages/yasgui/src/PersistentConfig.ts index 20f3917f..d62fb797 100644 --- a/packages/yasgui/src/PersistentConfig.ts +++ b/packages/yasgui/src/PersistentConfig.ts @@ -312,6 +312,22 @@ export default class PersistentConfig { this.toStorage(); } + /** + * Get the persisted layout orientation + */ +public getOrientation(): "vertical" | "horizontal" | undefined { + const orientation = this.persistedJson.orientation; + return orientation === "vertical" || orientation === "horizontal" ? orientation : undefined; +} + + /** + * Set and persist the layout orientation + */ + public setOrientation(orientation: "vertical" | "horizontal") { + this.persistedJson.orientation = orientation; + this.toStorage(); + } + /** * Get list of disabled developer-configured endpoint buttons */ diff --git a/packages/yasgui/src/Tab.ts b/packages/yasgui/src/Tab.ts index 363b3d22..7de2d106 100644 --- a/packages/yasgui/src/Tab.ts +++ b/packages/yasgui/src/Tab.ts @@ -621,6 +621,9 @@ export class Tab extends EventEmitter { // Update global config this.yasgui.config.orientation = newOrientation; + // Persist orientation + this.yasgui.persistentConfig.setOrientation(newOrientation); + // Apply to all tabs for (const tabId in this.yasgui._tabs) { const tab = this.yasgui._tabs[tabId]; diff --git a/packages/yasgui/src/index.ts b/packages/yasgui/src/index.ts index 99f820a1..08b0ef32 100644 --- a/packages/yasgui/src/index.ts +++ b/packages/yasgui/src/index.ts @@ -186,6 +186,12 @@ export class Yasgui extends EventEmitter { this.config.showSnippetsBar = persistedShowSnippetsBar; } + // Load persisted orientation if available + const persistedOrientation = this.persistentConfig.getOrientation(); + if (persistedOrientation !== undefined) { + this.config.orientation = persistedOrientation; + } + this.tabElements = new TabElements(this); this.tabPanelsEl = document.createElement("div");