2026-03-19 08:47:25 +01:00
|
|
|
import { isTauri } from '../mock-tauri'
|
2026-04-24 16:25:36 +02:00
|
|
|
import { shouldUseLinuxWindowChrome } from './platform'
|
2026-03-19 08:47:25 +01:00
|
|
|
|
2026-04-14 18:17:45 +02:00
|
|
|
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()}`
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-19 08:47:25 +01:00
|
|
|
/**
|
|
|
|
|
* Opens a note in a new Tauri window with a minimal editor-only layout.
|
|
|
|
|
* In browser mode (non-Tauri), this is a no-op.
|
|
|
|
|
*/
|
|
|
|
|
export async function openNoteInNewWindow(notePath: string, vaultPath: string, noteTitle: string): Promise<void> {
|
|
|
|
|
if (!isTauri()) return
|
|
|
|
|
|
|
|
|
|
const { WebviewWindow } = await import('@tauri-apps/api/webviewWindow')
|
|
|
|
|
const label = `note-${Date.now()}`
|
|
|
|
|
|
|
|
|
|
new WebviewWindow(label, {
|
2026-04-14 18:17:45 +02:00
|
|
|
url: buildNoteWindowUrl(notePath, vaultPath, noteTitle),
|
2026-03-19 08:47:25 +01:00
|
|
|
title: noteTitle,
|
|
|
|
|
width: 800,
|
|
|
|
|
height: 700,
|
|
|
|
|
resizable: true,
|
2026-03-19 08:48:20 +01:00
|
|
|
titleBarStyle: 'overlay',
|
2026-03-19 08:47:25 +01:00
|
|
|
hiddenTitle: true,
|
2026-04-24 16:25:36 +02:00
|
|
|
decorations: !shouldUseLinuxWindowChrome(),
|
2026-03-19 08:47:25 +01:00
|
|
|
})
|
|
|
|
|
}
|