Skip to content

Commit

Permalink
Switch to Full Calendar view if exists when ribbon icon clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall committed Feb 6, 2024
1 parent 8997593 commit 0a5df63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
This is a FORK of [davish/obsidian-full-calendar-plugin](https://github.com/davish/obsidian-full-calendar).

While this may be useful to others, I cannot provide any maintenance guarantees.

## Additional Features

- On click of 'Open Full Calendar' ribbon icon, if 'Full Calendar' view already exists in workspace, switch to it
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export default class FullCalendarPlugin extends Plugin {
await Promise.all(
leaves.map((l) => (l.view as CalendarView).onOpen())
);

const leaf = leaves[0];
await leaf.setViewState({
type: FULL_CALENDAR_VIEW_TYPE,
active: true,
});
}
}
async onload() {
Expand Down

0 comments on commit 0a5df63

Please sign in to comment.