Drafts Script Reference
    Preparing search index...

    Class Autocomplete

    Create and update entries in the Editor's global autocomplete system

    // work with the default system autocomplete
    let autocomplete = Autocomplete.getDefault();
    // object with all autocomplete items, using label as key
    let items = autocomplete.getAll();
    // add new autocomplete item
    autocomplete.add("label", "template value");
    Index

    Constructors

    Query

    Update

    Constructors

    Query

    • Get all existing autocomplete items as an object with the item lobels as keys, and templates as values.

      Returns object

    Update

    • Create a new autocomplete item

      Parameters

      • label: string

        The label used in the autocomplete drop-down

      • template: string

        The template value used to insert text

      Returns boolean

    • Deletes aa autocomplete item. Returns true if successful, false if item with label does not exist.

      Parameters

      • label: string

        The label used in the autocomplete drop-down

      Returns boolean