()
| 509 | // Pick a local vault to move an external file into: any open local |
| 510 | // vault, else the active local vault, else the last-used vault on disk. |
| 511 | async function resolveActiveLocalVault(): Promise<VaultInfo | null> { |
| 512 | for (const win of BrowserWindow.getAllWindows()) { |
| 513 | if (win.isDestroyed()) continue |
| 514 | if (windowVaults.modeForWindow(win.id) !== 'local') continue |
| 515 | const vault = windowVaults.vaultForWindow(win.id) |
| 516 | if (vault) return vault |
| 517 | } |
| 518 | if (currentVault && currentWorkspaceMode === 'local') return currentVault |
| 519 | const cfg = await loadConfig() |
| 520 | if (cfg.vaultRoot) { |
| 521 | try { |
| 522 | await ensureVaultLayout(cfg.vaultRoot) |
| 523 | return vaultInfo(path.resolve(cfg.vaultRoot)) |
| 524 | } catch { |
| 525 | return null |
| 526 | } |
| 527 | } |
| 528 | return null |
| 529 | } |
| 530 | |
| 531 | // Open a standalone editor window for a markdown file that lives outside |
| 532 | // any vault. The window edits the file in place; the path is held here |
no test coverage detected