diff --git a/manifest.json b/manifest.json index 44cf3af..e634884 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "description": "Add a context-dependent sidecar panel.", "author": "Matthew Turk", "authorUrl": "https://matthewturk.github.io/", - "version": "0.2.2", + "version": "0.2.3", "minAppVersion": "0.15.0", "isDesktopOnly": false } diff --git a/package.json b/package.json index 10c49f6..649261d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sidecar-panel", "private": true, - "version": "0.2.2", + "version": "0.2.3", "main": "main.js", "type": "module", "scripts": { diff --git a/public/versions.json b/public/versions.json index c0d0f53..c20ef97 100644 --- a/public/versions.json +++ b/public/versions.json @@ -8,4 +8,5 @@ "0.2.0": "0.15.0", "0.2.1": "0.15.0", "0.2.2": "0.15.0", + "0.2.3": "0.15.0" } diff --git a/src/components/ContextualSidecarPanel.svelte b/src/components/ContextualSidecarPanel.svelte index 3c574a5..3c8a224 100644 --- a/src/components/ContextualSidecarPanel.svelte +++ b/src/components/ContextualSidecarPanel.svelte @@ -25,7 +25,7 @@ async function updateSidecarPanel(file: TFile | null) { if (!file) return; - if (destination) destination.innerHTML = ""; + if (destination) destination.empty(); let cache = app.metadataCache.getFileCache(file); if (cache) { diff --git a/src/main.ts b/src/main.ts index 42d8b93..598c55a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -54,12 +54,15 @@ export default class ContextualSidecarPanel extends Plugin { } async activateView() { - this.app.workspace.detachLeavesOfType(VIEW_TYPE_CONTEXTUAL_SIDECAR); - - await this.app.workspace.getRightLeaf(false).setViewState({ - type: VIEW_TYPE_CONTEXTUAL_SIDECAR, - active: true, - }); + if ( + this.app.workspace.getLeavesOfType(VIEW_TYPE_CONTEXTUAL_SIDECAR).length > + 0 + ) { + await this.app.workspace.getRightLeaf(false).setViewState({ + type: VIEW_TYPE_CONTEXTUAL_SIDECAR, + active: true, + }); + } this.app.workspace.revealLeaf( this.app.workspace.getLeavesOfType(VIEW_TYPE_CONTEXTUAL_SIDECAR)[0] @@ -76,9 +79,6 @@ class ContextualSidecarPanelSettingTab extends PluginSettingTab { display(): void { let { containerEl } = this; containerEl.empty(); - containerEl.createEl("h2", { - text: "Settings for Contextual Sidecar Panel", - }); // Some of this logic was inspired by the bwydoogh/obsidian-force-view-mode-of-note plugin.