import "./Editors.css";
import type { EditorContentChange, Asset, FeedbackSubmission } from "../types/editor";
import type { Division, DivisionType } from "../types/sections";
export interface editorProps {
    /**
     * The docinfo element for a pretext document, which can contain macros and similar
     * document wide information.
     */
    docinfo?: string;
    /**
     * Optional user-level common docinfo/preamble that project docinfo can import.
     */
    commonDocinfo?: string;
    /**
     * Whether this project should use the user's common docinfo/preamble.
     */
    useCommonDocinfo?: boolean;
    /**
     * Called when the project-level "use common docinfo" choice changes.
     */
    onUseCommonDocinfoChange?: (value: boolean) => void;
    /**
     * Called when the user edits their common docinfo from the project dialog.
     */
    onCommonDocinfoChange?: (value: string) => void;
    /**
     * Called whenever content changes — a division edit, a structural reorder
     * (which rewrites a parent division's content), or a document-wide docinfo
     * edit.  The single {@link EditorContentChange} payload carries the affected
     * division's `xmlId` along with the derived content state, so the host can
     * update the right record in its divisions pool.
     */
    onContentChange: (change: EditorContentChange) => void;
    /** Document title shown in the menu bar title field. */
    title?: string;
    /** Called when the user edits the title field. */
    onTitleChange?: (value: string) => void;
    /** If provided, a Save button is rendered in the menu bar. */
    onSaveButton?: () => void;
    /** Label for the Save button.  Defaults to `"Save"`. */
    saveButtonLabel?: string;
    /** If provided, a Cancel button is rendered in the menu bar. */
    onCancelButton?: () => void;
    /** Label for the Cancel button.  Defaults to `"Cancel"`. */
    cancelButtonLabel?: string;
    /** Called when a user submits feedback from any built-in feedback link. */
    onFeedbackSubmit?: (feedback: FeedbackSubmission) => void | Promise<void>;
    /** Optional URL for the current project, included in feedback submissions. */
    projectUrl?: string;
    /**
     * If provided, `onSave` is called on Ctrl+S in addition to `onSaveButton`.
     * Useful when the host wants a keyboard shortcut to trigger saving without
     * necessarily showing an explicit Save button.
     */
    onSave?: () => void;
    /**
     * If provided, the right-hand panel shows a full iframe-based preview
     * instead of the Tiptap visual editor, and a rebuild button / Ctrl+Enter
     * shortcut become active.
     *
     * @param source - A standalone PreTeXt fragment document for just the
     * active division: wrapped in a synthetic `<pretext>`/`<book>`/`<article>`
     * root (as needed for the division's type) with `<docinfo>` inserted, but
     * with any `<plus:* ref="..."/>` placeholders inside the division left
     * unexpanded. Not the raw division content, and not the full document.
     * @param title - The current document title.
     * @param postToIframe - Helper to post a message into the preview iframe.
     */
    onPreviewRebuild?: (source: string, title: string, postToIframe: (url: string, data: unknown) => void) => void;
    /**
     * Whether this is an `"article"` (default) or `"book"` project.
     * When `"book"`, the TOC shows a chapter list that expands to show sections.
     */
    projectType?: "article" | "book";
    /**
     * Flat pool of all division records for this project.  The editor's content
     * is always sourced from these divisions.
     */
    divisions: Division[];
    /**
     * The `xmlId` of the root division (book, article, or slideshow).
     * When omitted the editor falls back to the first division with a root
     * type (`"book"`, `"article"`, `"slideshow"`).
     */
    rootDivisionId?: string;
    /**
     * The `xmlId` of the division currently open for editing (controlled).
     * When omitted the editor tracks active division internally (uncontrolled).
     */
    activeDivisionId?: string | null;
    /**
     * Called when the user clicks a division in the TOC to open it.
     * The host should update `activeDivisionId`.
     */
    onDivisionSelect?: (xmlId: string) => void;
    /**
     * Called when the user creates a new division via the TOC UI (including
     * an auto-create triggered by typing a new `<plus:TYPE ref="..."/>`
     * placeholder). `division` is the full local record — including the
     * `xmlId` the editor picked — and should be persisted as-is.
     *
     * The division is added to the local pool synchronously and immediately,
     * before this is called, so the host's `id` provisioning never blocks the
     * UI. If a host needs to mint its own stable `id` (e.g. a Rails record
     * id) for the division, it can return that id here; once the returned
     * promise resolves, the editor patches it into the division's `id` field
     * in place. `xmlId` is unaffected and is never remapped.
     */
    onDivisionAdd?: (division: Division) => Promise<string> | void;
    /**
     * Called when the user deletes a division via the TOC UI.
     */
    onDivisionRemove?: (xmlId: string) => void;
    /**
     * Called when the user renames, retypes, or changes the `xml:id` of a
     * division via the inline TOC edit form.
     */
    onDivisionUpdate?: (xmlId: string, changes: {
        title?: string;
        type?: DivisionType;
        xmlId?: string | null;
        sourceFormat?: import("../types/editor").SourceFormat;
        label?: string | null;
    }) => void;
    /**
     * Assets already associated with this project.  When omitted, the Assets
     * button and modal are hidden entirely.
     */
    projectAssets?: Asset[];
    /**
     * All assets available in the user's library (across all projects).
     */
    libraryAssets?: Asset[];
    /** Called after an asset tag is inserted at the cursor. */
    onAssetInsert?: (asset: Asset) => void;
    /** Called when the user picks a library asset not yet in this project. */
    onAssetAddFromLibrary?: (asset: Asset) => Promise<void> | void;
    /** Called when the user uploads an image file. */
    onAssetUpload?: (file: File) => Promise<Asset>;
    /**
     * Called when the user adds an image by URL. Should fetch the URL
     * server-side (to avoid CORS) and return the raw file bytes — it must
     * NOT create a persisted asset. The returned file is then committed via
     * `onAssetUpload`, the same as a local file pick.
     */
    onAssetFetchUrl?: (url: string) => Promise<File>;
    /** Called when the user creates a new Doenet activity. */
    onCreateDoenet?: (name: string, ref: string) => Promise<Asset>;
    /** Called when the user removes an asset from the project. */
    onAssetRemove?: (asset: Asset) => void;
    /** Called when the user saves edits to an asset's content (e.g. its `source`). */
    onAssetUpdate?: (asset: Asset) => Promise<void> | void;
    /** Called when the asset modal opens to fetch the latest project assets. */
    onLoadAssets?: () => Promise<Asset[]>;
    /** Called when the asset modal opens to fetch the full library asset list. */
    onLoadLibraryAssets?: () => Promise<Asset[]>;
}
/**
 * Top-level editor component.  Creates the per-instance Zustand store and
 * wraps the inner component in the store's Context provider.
 */
declare const Editors: (props: editorProps) => import("react").JSX.Element;
export default Editors;
