@mendix/extensions-api - v0.2.4
    Preparing search index...

    Interface IEditorApi

    API for retrieving information about, and opening documents in, the main working area of Studio Pro.

    interface IEditorApi {
        _apiId: "mendix.EditorApi";
        addEventListener<K extends "activeDocumentChanged">(
            eventType: K,
            listener: EventHandler<EditorApiEventMap, K>,
        ): DisposeListener;
        editDocument(documentId: string): Promise<void>;
        getActiveDocument(): Promise<null | ActiveDocumentInfo>;
        removeEventListener<K extends "activeDocumentChanged">(
            eventType: K,
            listener: EventHandler<EditorApiEventMap, K>,
        ): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _apiId: "mendix.EditorApi"

    Unique identifier that can be used to register or retrieve a specific API.

    Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

    Methods

    • Adds an event listener for the specified event type.

      Type Parameters

      • K extends "activeDocumentChanged"

      Parameters

      • eventType: K

        The type of event to listen for.

      • listener: EventHandler<EditorApiEventMap, K>

        The event listener to add.

      Returns DisposeListener

      A function that can be called to remove the event listener.

    • Opens the editor for the document with the given ID in the working area of Studio Pro.

      Parameters

      • documentId: string

        the ID of the document that should be edited.

      Returns Promise<void>

    • Gets information about the document the user is currently editing, or null if no document is currently opened.

      Returns Promise<null | ActiveDocumentInfo>

    • Removes an event listener for the specified event type.

      Type Parameters

      • K extends "activeDocumentChanged"

      Parameters

      • eventType: K

        The type of event to remove the listener from.

      • listener: EventHandler<EditorApiEventMap, K>

        The event listener to remove.

      Returns void