import type { CSL } from "./types.js"; import type { BibliographyApi } from "@fiduswriter/bibliography-manager"; import type { ImageApi } from "@fiduswriter/image-manager"; import type { Image } from "@fiduswriter/image-manager/types"; import type { EditorApp, EditorContactsApi, EditorDocumentApi, EditorDocumentImportApi } from "./types.js"; export interface StaticDocumentStyle { title: string; slug: string; contents: string; documentstylefile_set: Array<[string, string]>; } export interface StaticExportTemplate { title: string; file_type: string; template_file: string; } export interface StaticDocumentTemplate { title: string; } export interface StaticAppConfig { /** Locale code used by the editor, e.g. "en". */ locale: string; /** gettext function for UI strings. */ gettext: (msgid: string) => string; /** CSL engine instance. */ csl: CSL; /** * Function returning the document payload the editor should load. * Called whenever the editor refreshes document data from the server. */ documentData: () => Promise<{ doc: Record; doc_info: Record; time: number; }>; /** * Optional callback returning the current document content node. * Used by File > Download to extract a template definition from the document. */ getDocContent?: () => Record | undefined; /** Initial image entries keyed by image id. */ initialImages?: Record; /** Document styles available for the document template. */ documentStyles?: StaticDocumentStyle[]; /** Export templates available for the document template. */ exportTemplates?: StaticExportTemplate[]; /** Document templates keyed by import id. */ documentTemplates?: Record; /** Optional override for the template API response. */ getTemplateForDoc?: (docId: string | number, token: string | false) => Promise>; /** Application name. */ appName?: string; /** Routes table used by the app router. */ routes?: Record; /** * Optional handler called when the editor tries to save the document. * Defaults to a no-op that returns version 0. */ onSaveDocument?: (data: Record) => Promise<{ json: Record; status: number; }>; /** * Editor save mode: * - "external" (default): the host drives saving through * `onSaveDocument`; no autosave runs inside the editor. * - "direct": the editor autosaves (every 10 s and on page hide) via the * `saveDocument` connector. `onSaveDocument` is used as the save * connector and should return `{json: {version}, status}` (or * `{json, status: 409}` on version conflict, which triggers the * built-in merge). */ saveMode?: "external" | "direct"; /** * Whether to show the file-menu items that require a Fidus Writer * backend (Share, Save revision, Create copy). Defaults to `true`. * Standalone hosts (embedded editor without a backend) set this to * `false` to match the behavior of a normal external-mode editor. */ fileMenuItems?: boolean; /** * Optional API connector overrides. When provided, these replace the * corresponding in-memory connectors, letting the editor talk to a real * backend (e.g. Django) instead of the static in-memory stores. */ apiConnectors?: Partial<{ document: EditorDocumentApi; documentImport: EditorDocumentImportApi; image: ImageApi; bibliography: BibliographyApi; contacts: EditorContactsApi; }>; /** * Optional user preferences that control inline editing helpers. * Recognized keys include `inline_references` and `inline_math`. */ userPreferences?: Record; } /** * Create an {@link EditorApp} for a statically served Fidus Writer editor. * * This wires up in-memory API connectors so that the editor can run without a * backend server. It is used by the standalone demo and can be used by any * static deployment of `@fiduswriter/editor`. */ export declare function createStaticApp(config: StaticAppConfig): Promise; //# sourceMappingURL=static_app.d.ts.map