release v1.8.0: reuse open tabs for periodic notes
This commit is contained in:
1 parent
695141383f
commit
984a0ab44f
10 files changed
+75
-32
No files matched your search
+5
-4
@@ -53,6 +53,7 @@ Detaches all leaves of `WAYPOINT_VIEW_TYPE`.
|
||||
interface WaypointSettings {
|
||||
calendar: CalendarSettings; // week start, indicator visibility/style, daily indicator colour
|
||||
daily: PeriodNoteSettings;
|
||||
reusePeriodicNoteTabs: boolean; // defaults to false; all periodic-note openers reuse an open tab
|
||||
weekly: PeriodNoteSettings;
|
||||
monthly: PeriodNoteSettings;
|
||||
quarterly: PeriodNoteSettings;
|
||||
@@ -132,7 +133,7 @@ The bookmark tree is stored under `waypointData.bookmarks` and rendered recursiv
|
||||
| `waypoint-go-to-quarterly` | Go to quarterly note | `Mod+Shift+Alt+Q` |
|
||||
| `waypoint-go-to-yearly` | Go to yearly note | `Mod+Shift+Alt+Y` |
|
||||
|
||||
All call `openPeriodNote(period, moment())` — opens or creates the current period's note.
|
||||
All five commands call `openPeriodNote(period, moment())` — opening or creating the current period's note. **Periodic Notes → Use existing tabs** defaults to off. When enabled, the shared opener focuses a Markdown tab for the exact configured file path, including in another pane or window, without reopening the file or resetting its editor position. This also applies to next/previous navigation and regular calendar clicks. With no matching tab, normal note creation/opening is unchanged. Explicit open-in-new-tab actions still win; existing duplicate tabs are not closed.
|
||||
|
||||
### Next/Previous period (no default hotkeys)
|
||||
|
||||
@@ -237,7 +238,7 @@ getDateSystemIndicators(dates: moment.Moment[]): Map<string, DateSystemIndicator
|
||||
openDateSystemNote(
|
||||
system: DateSystemSettings,
|
||||
date: moment.Moment,
|
||||
opts?: { title?: string; leaf?: WorkspaceLeaf },
|
||||
opts?: { title?: string; leaf?: WorkspaceLeaf; reuseExistingLeaf?: boolean },
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
@@ -252,7 +253,7 @@ openDateSystemNote(
|
||||
1. **Filename** — `splitNameFormat(system.nameFormat)`, format `before` and `after` against `date`, and for a many-per-date system join `sanitizeTitle(opts.title)` between them. Append `.md`; prepend `system.folder` when it is set.
|
||||
2. **Existing note** — a `vault.getFileByPath()` hit is opened as-is, never overwritten. A date that already has notes can still gain another in a many-per-date system, because the title makes the filename unique.
|
||||
3. **Missing note** — created via `createDatedNote`, then opened.
|
||||
4. **Leaf** — `opts.leaf` when supplied (middle-click and Ctrl/Cmd-click pass an explicit tab leaf), otherwise `workspace.getLeaf(false)`.
|
||||
4. **Leaf** — an explicit `opts.leaf` always wins (middle-click and Ctrl/Cmd-click pass a tab leaf). Otherwise, when `opts.reuseExistingLeaf` is true, scan Markdown leaves by `getViewState().state.file` so deferred tabs also match; compare the complete file path, not the basename. Await `workspace.revealLeaf(existing)` to reveal/load the tab, then call `workspace.setActiveLeaf(existing, { focus: true })` to activate it and focus its editor. Return without calling `openFile`, preserving editor position. With no matching tab, or when reuse is disabled, open in `workspace.getLeaf(false)` as before.
|
||||
|
||||
### Note creation (`createDatedNote`)
|
||||
|
||||
@@ -273,7 +274,7 @@ openPeriodNote(
|
||||
): Promise<void>
|
||||
```
|
||||
|
||||
Single unified opener — there is no separate `openPeriodNoteInLeaf`, and since the date-systems refactor there is no separate creation path either. `openPeriodNote` synthesizes the period's `PeriodNoteSettings` into a `DateSystemSettings` (`folder`, `nameFormat`, `templateFile` and `typeProperty` carry over verbatim; a period format never contains `{title}`, so a period maps to exactly one filename) and delegates to `openDateSystemNote(system, date, { leaf })`.
|
||||
Single unified opener — there is no separate `openPeriodNoteInLeaf`, and since the date-systems refactor there is no separate creation path either. `openPeriodNote` synthesizes the period's `PeriodNoteSettings` into a `DateSystemSettings` (`folder`, `nameFormat`, `templateFile` and `typeProperty` carry over verbatim; a period format never contains `{title}`, so a period maps to exactly one filename) and delegates to `openDateSystemNote(system, date, { leaf, reuseExistingLeaf: settings.reusePeriodicNoteTabs })`. All five periodic-note types therefore share the same tab-reuse policy, with an explicit `leaf` taking precedence.
|
||||
|
||||
Filename building, the existence check, template-or-frontmatter creation and leaf selection are therefore documented once, under Date Systems above.
|
||||
|
||||
|
||||
Reference in new issue
Block a user