Skip to content

Commit 3422104

Browse files
committed
Revealing existing leaf when activating the view
1 parent fd47640 commit 3422104

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

elm-virtual-list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 12aec0c96841258ed909480f3e30ab8502d70bb8

main.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -427,24 +427,16 @@ export default class IDSidePanelPlugin extends Plugin {
427427
}
428428

429429
async activateView() {
430-
if (this.getActivePanelView()) {
431-
return;
432-
}
433-
434-
// Get the right leaf or create one if it doesn't exist
435-
let leaf = this.app.workspace.getRightLeaf(false);
436-
430+
let leaf = this.app.workspace.getLeavesOfType(VIEW_TYPE_ID_PANEL)[0];
431+
437432
if (!leaf) {
438-
// Use getLeaf() to create a new leaf
439-
leaf = this.app.workspace.getLeaf(true);
433+
leaf = this.app.workspace.getRightLeaf(false) ?? this.app.workspace.getLeaf(true);
434+
await leaf.setViewState({
435+
type: VIEW_TYPE_ID_PANEL,
436+
active: true,
437+
});
440438
}
441-
442-
await leaf.setViewState({
443-
type: VIEW_TYPE_ID_PANEL,
444-
active: true,
445-
});
446-
447-
// Reveal the leaf to make it active
439+
448440
this.app.workspace.revealLeaf(leaf);
449441
await this.refreshView();
450442
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "note-id",
33
"name": "Note ID",
4-
"version": "1.0.8",
4+
"version": "1.0.9",
55
"minAppVersion": "0.15.0",
66
"description": "Displays notes by their ID, enabling structured sequences for manuscripts or Zettelkasten (\"Folgezettel\").",
77
"author": "Dominik Mayer",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-note-id",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"description": "Displays notes by their ID, enabling structured sequences for manuscripts or Zettelkasten (\"Folgezettel\").",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)