Something went wrong. Try again.
A local-first note taking app
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536import type { DocumentHandle } from '../documents/types';import { resolveEditor } from './registry';import type { EditorProps } from './types';import { DocumentEditorError } from './ui/DocumentEditorError';
export type DocumentPaneProps = Omit<EditorProps, 'binding'> & { handle: DocumentHandle;};
// `mode`, `onOpenLink`, `wikiLinkVault` and `onOpenWikiLink` all flow through// the `...editorProps` spread below.
/** * Workspace-facing editor mount. Resolves a registered `Editor` by binding * `kind` — no document provider or sync-backend imports. */export function DocumentPane({ handle, ...editorProps }: DocumentPaneProps) { const binding = handle.getEditorBinding(); const editor = resolveEditor(binding);
if (!editor) { const message = import.meta.env.DEV ? `Unknown editor binding "${String(binding.kind)}" (not registered in editors/registry.ts).` : 'This document cannot be opened in the editor.'; return ( <DocumentEditorError className={editorProps.className} message={message} /> ); }
const { Component } = editor; return <Component binding={binding} {...editorProps} />;}