fix: open note windows from direct note paths

This commit is contained in:
lucaronin
2026-04-14 18:17:45 +02:00
parent 1f4ae56c1c
commit d9fd615d4c
5 changed files with 262 additions and 10 deletions

View File

@@ -1,5 +1,16 @@
import { isTauri } from '../mock-tauri'
export function buildNoteWindowUrl(notePath: string, vaultPath: string, noteTitle: string): string {
const params = new URLSearchParams({
window: 'note',
path: notePath,
vault: vaultPath,
title: noteTitle,
})
return `/?${params.toString()}`
}
/**
* Opens a note in a new Tauri window with a minimal editor-only layout.
* In browser mode (non-Tauri), this is a no-op.
@@ -9,10 +20,9 @@ export async function openNoteInNewWindow(notePath: string, vaultPath: string, n
const { WebviewWindow } = await import('@tauri-apps/api/webviewWindow')
const label = `note-${Date.now()}`
const url = `index.html?window=note&path=${encodeURIComponent(notePath)}&vault=${encodeURIComponent(vaultPath)}&title=${encodeURIComponent(noteTitle)}`
new WebviewWindow(label, {
url,
url: buildNoteWindowUrl(notePath, vaultPath, noteTitle),
title: noteTitle,
width: 800,
height: 700,