Dropdown

Dropdown menus for toolbar and UI.

isPositionTop#

Returns whether the dropdown is positioned above its trigger (always false in current implementation).

Returns: boolean

app.dropdown.isPositionTop();

isOpen#

Returns whether the dropdown is currently open.

Returns: boolean

app.dropdown.isOpen();

isPalette#

Returns whether the current dropdown params use palette mode.

Returns: boolean

app.dropdown.isPalette();

getEl#

Returns the root dropdown DOM element.

Returns: HTMLElement

app.dropdown.getEl();

getName#

Returns the name of the currently configured dropdown panel.

Returns: string|false

app.dropdown.getName();

getSavedBlocks#

Returns the blocks array saved when the dropdown opened.

Returns: Block[]

app.dropdown.getSavedBlocks();

getSavedBlock#

Returns the current block saved when the dropdown opened.

Returns: Block|null

app.dropdown.getSavedBlock();

getForm#

Returns the form instance attached to the current dropdown params.

Returns: FormInstance|undefined

app.dropdown.getForm();

getTabForm#

Returns the form instance for a named tab.

Parameters:

  • name (string) — identifier name

Returns: FormInstance

app.dropdown.getTabForm('settings');

addTab#

Registers a tab definition before the dropdown is opened.

Parameters:

  • name (string) — identifier name
  • params (object) — command or form parameters
app.dropdown.addTab('settings', { title: 'Settings', form });

getTabBox#

Returns the DOM container element for a named tab.

Parameters:

  • name (string) — identifier name

Returns: HTMLElement|null

app.dropdown.getTabBox('settings');

setTabItems#

Re-renders items inside an open tab box by name.

Parameters:

  • name (string) — identifier name
  • items (Array) — list of items to process
app.dropdown.setTabItems('main', items);

create#

Configures dropdown content (title, items, form, tabs) before opening.

Parameters:

  • name (string) — identifier name
  • params (object) — command or form parameters
app.dropdown.create('format', { items });

open#

Opens the dropdown anchored to a button element or Button instance.

Parameters:

  • trigger (HTMLElement | string) — element or button that opened the dropdown
app.dropdown.open(buttonEl);

openAt#

Opens the dropdown at viewport coordinates, optionally following selection scroll.

Parameters:

  • x (any) — x
  • y (any) — y
  • keepScrollSnap (any) — keep scroll snap
  • followSelection (any) — follow selection
app.dropdown.openAt({ x: 100, y: 200 });

close#

Closes the dropdown, restores selection, and emits dropdown:close.

Parameters:

  • reason (any) — blur reason passed to event
  • skipRestore (any) — skip restore
app.dropdown.close();

updatePosition#

Recalculates dropdown position relative to trigger or openAt coordinates.

app.dropdown.updatePosition();

saveSelection#

Saves current block, blocks-in-selection, and caret offset before dropdown interaction.

app.dropdown.saveSelection();

restoreSelection#

Restores the caret offset saved when the dropdown opened.

app.dropdown.restoreSelection();