Files
tolaria/src/utils/windowMode.ts
Test 7c16ebd065 feat: open note in new window (Cmd+Shift+Click / Cmd+Shift+O)
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>
2026-03-19 08:47:25 +01:00

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 }
}