Add multi-window support: notes can be opened in dedicated secondary Tauri windows with editor-only layout (no sidebar, no note list). Triggers: Cmd+Shift+Click on notes, Cmd+K → "Open in New Window", Cmd+Shift+O shortcut, Note → "Open in New Window" menu bar item. Secondary windows have their own auto-save, theme, and wikilink navigation. Closing a secondary window does not affect the main window. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
768 B
TypeScript
25 lines
768 B
TypeScript
/**
|
|
* Detects whether the current window is a secondary "note window" (opened via
|
|
* "Open in New Window") by inspecting URL query parameters.
|
|
*/
|
|
|
|
export interface NoteWindowParams {
|
|
notePath: string
|
|
vaultPath: string
|
|
noteTitle: string
|
|
}
|
|
|
|
export function isNoteWindow(): boolean {
|
|
return new URLSearchParams(window.location.search).get('window') === 'note'
|
|
}
|
|
|
|
export function getNoteWindowParams(): NoteWindowParams | null {
|
|
const params = new URLSearchParams(window.location.search)
|
|
if (params.get('window') !== 'note') return null
|
|
const notePath = params.get('path')
|
|
const vaultPath = params.get('vault')
|
|
const noteTitle = params.get('title') ?? 'Untitled'
|
|
if (!notePath || !vaultPath) return null
|
|
return { notePath, vaultPath, noteTitle }
|
|
}
|