Toolbar

Main toolbar buttons and sticky behavior.

add#

Registers a dynamic toolbar button config by name.

Parameters:

  • name (string) — identifier name
  • config (object) — configuration object
app.toolbar.add('myBtn', { title: 'Custom', command: 'my.command' });

remove#

Marks button names as removed from the toolbar.

Parameters:

  • ...names (Array) — list of names to process
app.toolbar.remove('bold', 'italic');

addDynamic#

Queues a dynamic button for insertion when the toolbar DOM exists.

Parameters:

  • name (string) — identifier name
  • config (object) — configuration object
app.toolbar.addDynamic('pluginBtn', { icon: '…', command: 'plugin.run' });

removeDynamic#

Removes a dynamically inserted button from the toolbar DOM.

Parameters:

  • name (string) — identifier name
app.toolbar.removeDynamic('pluginBtn');

setActive#

Adds button name(s) to the API active overlay set.

Parameters:

  • names (Array) — list of names to process
app.toolbar.setActive('bold');

clearActive#

Removes button name(s) from the API active overlay set.

Parameters:

  • names (Array) — list of names to process
app.toolbar.clearActive('bold');

clearAllActive#

Clears all API-driven active button states.

app.toolbar.clearAllActive();

setDisabled#

Disables toolbar buttons via the uiButtonsState service.

Parameters:

  • names (Array) — list of names to process
app.toolbar.setDisabled('link');

clearDisabled#

Re-enables named toolbar buttons.

Parameters:

  • names (Array) — list of names to process
app.toolbar.clearDisabled('link');

setDisabledAll#

Disables all toolbar buttons except those listed in except.

Parameters:

  • except (Array) — names or types to exclude from the rule
app.toolbar.setDisabledAll({ except: ['source'] });

clearDisabledAll#

Clears disabled state on all buttons except those listed in except.

Parameters:

  • except (Array) — names or types to exclude from the rule
app.toolbar.clearDisabledAll();

updateButton#

Patches dynamic config and live button state (command, icon, pressed, active, disabled) by name.

Parameters:

  • name (string) — identifier name
  • patch (object) — patch
app.toolbar.updateButton('bold', { pressed: true });

getButton#

Returns the Button instance for a toolbar button name.

Parameters:

  • name (string) — identifier name

Returns: Button|null

app.toolbar.getButton('bold');

getButtonEl#

Returns the DOM element for a toolbar button name.

Parameters:

  • name (string) — identifier name

Returns: HTMLElement|null

app.toolbar.getButtonEl('bold');