Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/yasgui/src/PersistentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/yasgui/src/Tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
6 changes: 6 additions & 0 deletions packages/yasgui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Loading