Block editor, markdown round trip, formulas/databases/kanban/canvas models, graph simulation (time-budgeted ticks for big vaults), shortcut registry, dialog focus handling, HTML to Markdown for paste and clipping. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
13 lines
609 B
JavaScript
13 lines
609 B
JavaScript
// In Electron, window.vault comes from electron/preload.cjs.
|
|
// In a plain browser (`npm run dev:web`) an in-memory mock stands in, so the UI can be worked on without Electron.
|
|
import { createMock } from './mock.js';
|
|
|
|
export const isDesktop = typeof window !== 'undefined' && !!window.vault;
|
|
export const api = isDesktop ? window.vault : createMock();
|
|
export const platform = isDesktop ? window.vault.platform : 'web';
|
|
|
|
export const errorText = (err) =>
|
|
String((err && err.message) || err || 'Something went wrong')
|
|
.replace(/^Error invoking remote method '[^']+': /, '')
|
|
.replace(/^Error: /, '');
|