Skip to content

Commit

Permalink
default to Scenes tab on initial open for MSs (#206)
Browse files Browse the repository at this point in the history
Fixes #141
kevboh authored Oct 19, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 62987f3 commit e38e33b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -9,9 +9,11 @@ import {
normalizePath,
} from "obsidian";
import debounce from "lodash/debounce";
import once from "lodash/once";
import pick from "lodash/pick";
import { derived, type Unsubscriber } from "svelte/store";
import { get } from "svelte/store";

import {
VIEW_TYPE_LONGFORM_EXPLORER,
ExplorerPane,
@@ -268,10 +270,20 @@ export default class LongformPlugin extends Plugin {
this.userScriptObserver.beginObserving();
this.watchProjects();

const defaultToScenes = once(function (d: Draft) {
if (d && d.format === "scenes") {
selectedTab.set("Scenes");
}
});

this.unsubscribeSelectedDraft = selectedDraft.subscribe(async (d) => {
if (!get(initialized) || !d) {
return;
}

// On initial load, default to Scenes tab for multi-scene projects.
defaultToScenes(d);

pluginSettings.update((s) => ({
...s,
selectedDraftVaultPath: d.vaultPath,

0 comments on commit e38e33b

Please sign in to comment.