Hiyve Components - v1.0.0
    Preparing search index...

    Interface Editor

    interface Editor {
        extensionManager: ExtensionManager;
        extensionStorage: Record<string, any>;
        isCapturingTransaction: boolean;
        isFocused: boolean;
        isInitialized: boolean;
        options: EditorOptions;
        schema: Schema;
        view: EditorView;
        get $doc(): NodePos;
        get commands(): SingleCommands;
        get isDestroyed(): boolean;
        get isEditable(): boolean;
        get isEmpty(): boolean;
        get state(): EditorState;
        get storage(): Record<string, any>;
        $node(
            selector: string,
            attributes?: { [key: string]: any },
        ): NodePos | null;
        $nodes(
            selector: string,
            attributes?: { [key: string]: any },
        ): NodePos[] | null;
        $pos(pos: number): NodePos;
        can(): CanCommands;
        captureTransaction(fn: () => void): Transaction | null;
        chain(): ChainedCommands;
        createNodeViews(): void;
        destroy(): void;
        emit<EventName extends keyof EditorEvents>(
            event: EventName,
            ...args: CallbackType<EditorEvents, EventName>,
        ): this;
        getAttributes(
            nameOrType: string | MarkType | NodeType,
        ): Record<string, any>;
        getCharacterCount(): number;
        getHTML(): string;
        getJSON(): JSONContent;
        getText(
            options?: {
                blockSeparator?: string;
                textSerializers?: Record<string, TextSerializer>;
            },
        ): string;
        isActive(name: string, attributes?: {}): boolean;
        isActive(attributes: {}): boolean;
        off<EventName extends keyof EditorEvents>(
            event: EventName,
            fn?: CallbackFunction<EditorEvents, EventName>,
        ): this;
        on<EventName extends keyof EditorEvents>(
            event: EventName,
            fn: CallbackFunction<EditorEvents, EventName>,
        ): this;
        once<EventName extends keyof EditorEvents>(
            event: EventName,
            fn: CallbackFunction<EditorEvents, EventName>,
        ): this;
        prependClass(): void;
        registerPlugin(
            plugin: Plugin,
            handlePlugins?: (
                newPlugin: Plugin,
                plugins: Plugin<any>[],
            ) => Plugin<any>[],
        ): EditorState;
        removeAllListeners(): void;
        setEditable(editable: boolean, emitUpdate?: boolean): void;
        setOptions(options?: Partial<EditorOptions>): void;
        unregisterPlugin(
            nameOrPluginKeyToRemove:
                | string
                | PluginKey<any>
                | (string | PluginKey<any>)[],
        ): EditorState | undefined;
    }

    Hierarchy

    • EventEmitter<EditorEvents>
      • Editor
    Index

    Properties

    extensionManager: ExtensionManager
    extensionStorage: Record<string, any>
    isCapturingTransaction: boolean
    isFocused: boolean
    isInitialized: boolean

    The editor is considered initialized after the create event has been emitted.

    options: EditorOptions
    schema: Schema
    view: EditorView

    Accessors

    • get $doc(): NodePos

      Returns NodePos

    • get commands(): SingleCommands

      An object of all registered commands.

      Returns SingleCommands

    • get isDestroyed(): boolean

      Check if the editor is already destroyed.

      Returns boolean

    • get isEditable(): boolean

      Returns whether the editor is editable.

      Returns boolean

    • get isEmpty(): boolean

      Check if there is no content.

      Returns boolean

    • get state(): EditorState

      Returns the editor state.

      Returns EditorState

    • get storage(): Record<string, any>

      Returns the editor storage.

      Returns Record<string, any>

    Methods

    • Parameters

      • selector: string
      • Optionalattributes: { [key: string]: any }

      Returns NodePos | null

    • Parameters

      • selector: string
      • Optionalattributes: { [key: string]: any }

      Returns NodePos[] | null

    • Parameters

      • pos: number

      Returns NodePos

    • Check if a command or a command chain can be executed. Without executing it.

      Returns CanCommands

    • Parameters

      • fn: () => void

      Returns Transaction | null

    • Create a command chain to call multiple commands at once.

      Returns ChainedCommands

    • Creates all node views.

      Returns void

    • Destroy the editor.

      Returns void

    • Type Parameters

      • EventName extends keyof EditorEvents

      Parameters

      Returns this

    • Get attributes of the currently selected node or mark.

      Parameters

      • nameOrType: string | MarkType | NodeType

      Returns Record<string, any>

    • Get the number of characters for the current document.

      Returns number

    • Get the document as HTML.

      Returns string

    • Get the document as JSON.

      Returns JSONContent

    • Get the document as text.

      Parameters

      • Optionaloptions: { blockSeparator?: string; textSerializers?: Record<string, TextSerializer> }

      Returns string

    • Returns if the currently selected node or mark is active.

      Parameters

      • name: string

        Name of the node or mark

      • Optionalattributes: {}

        Attributes of the node or mark

      Returns boolean

    • Returns if the currently selected node or mark is active.

      Parameters

      • attributes: {}

        Attributes of the node or mark

      Returns boolean

    • Type Parameters

      • EventName extends keyof EditorEvents

      Parameters

      Returns this

    • Type Parameters

      • EventName extends keyof EditorEvents

      Parameters

      Returns this

    • Type Parameters

      • EventName extends keyof EditorEvents

      Parameters

      Returns this

    • Prepend class name to element.

      Returns void

    • Register a ProseMirror plugin.

      Parameters

      • plugin: Plugin

        A ProseMirror plugin

      • OptionalhandlePlugins: (newPlugin: Plugin, plugins: Plugin<any>[]) => Plugin<any>[]

        Control how to merge the plugin into the existing plugins.

      Returns EditorState

      The new editor state

    • Returns void

    • Update editable state of the editor.

      Parameters

      • editable: boolean
      • OptionalemitUpdate: boolean

      Returns void

    • Update editor options.

      Parameters

      • Optionaloptions: Partial<EditorOptions>

        A list of options

      Returns void

    • Unregister a ProseMirror plugin.

      Parameters

      • nameOrPluginKeyToRemove: string | PluginKey<any> | (string | PluginKey<any>)[]

        The plugins name

      Returns EditorState | undefined

      The new editor state or undefined if the editor is destroyed