import { ComponentType, ReactNode } from "react"; import { Editor, Extension, Keymap, Priority } from "@prosekit/core"; import { MarkViewContext, NodeViewContext } from "@prosemirror-adapter/react"; import { CoreMarkViewUserOptions, CoreNodeViewUserOptions } from "@prosemirror-adapter/core"; import { ProseMirrorNode } from "@prosekit/pm/model"; import { EditorState } from "@prosekit/pm/state"; interface ProseKitProps { editor: Editor; children?: ReactNode; } /** * The root component for a ProseKit editor. */ export declare const ProseKit: ComponentType; interface ReactMarkViewProps extends MarkViewContext {} type ReactMarkViewComponent = ComponentType; /** * Options for {@link defineReactMarkView}. */ interface ReactMarkViewOptions extends CoreMarkViewUserOptions { /** * The name of the mark type. */ name: string; } /** * Defines a mark view using a React component. */ export declare function defineReactMarkView(options: ReactMarkViewOptions): Extension; interface ReactNodeViewProps extends NodeViewContext {} type ReactNodeViewComponent = ComponentType; /** * Options for {@link defineReactNodeView}. */ interface ReactNodeViewOptions extends CoreNodeViewUserOptions { /** * The name of the node type. */ name: string; } /** * Defines a node view using a React component. */ export declare function defineReactNodeView(options: ReactNodeViewOptions): Extension; interface UseExtensionOptions { /** * The editor to add the extension to. If not provided, it will use the * editor from the nearest `` component. */ editor?: Editor; /** * Optional priority to add the extension with. */ priority?: Priority; } /** * Add an extension to the editor. */ export declare function useExtension( /** * The extension to add to the editor. If it changes, the previous * extension will be removed and the new one (if not null) will be added. */ extension: Extension | null, options?: UseExtensionOptions): void; /** * Calls the given handler whenever the editor document changes. */ export declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void; interface UseEditorDerivedOptions { /** * The editor to add the extension to. If not provided, it will use the * editor from the nearest `` component. */ editor?: Editor; } /** * Runs a function to derive a value from the editor instance after editor state * changes. * * This is useful when you need to render something based on the editor state, * for example, whether the selected text is wrapped in an italic mark. * * It returns the derived value that updates whenever the editor state changes. */ export declare function useEditorDerivedValue( /** * A function that receives the editor instance and returns a derived value. * * It will be called whenever the editor's document state changes, or when it * mounts. * * This function should be memoized. */ derive: (editor: Editor) => Derived, options?: UseEditorDerivedOptions): Derived; /** * Retrieves the editor instance from the nearest ProseKit component. */ export declare function useEditor(options?: { /** * Whether to update the component when the editor is mounted or editor state * is updated. * * Note this this option doesn't work with [React * compiler](https://react.dev/learn/react-compiler) because the returned * editor will be the same instance after state updates. If you're using React * compiler, you should use {@link useEditorDerivedValue} instead. * * @default false */ update?: boolean; }): Editor; export declare function useKeymap(keymap: Keymap, options?: UseExtensionOptions): void; /** * Calls the given handler whenever the editor state changes. */ export declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void; /** * @internal */ type PropsWithClassName

= P & { className?: string | undefined; }; export type { PropsWithClassName, ProseKitProps, ReactMarkViewComponent, ReactMarkViewOptions, ReactMarkViewProps, ReactNodeViewComponent, ReactNodeViewOptions, ReactNodeViewProps, UseEditorDerivedOptions, UseExtensionOptions }; //# sourceMappingURL=index.d.ts.map