Floating context toolbar for text and block selection.
setCustomHtml#
Replaces the custom mount area with a DOM node or clears it when content is null.
Parameters:
- content (
object | string) — content to render (string, Node, or array)
app.context.setCustomHtml(customEl);
clearCustomHtml#
Clears the custom mount area in the context toolbar.
app.context.clearCustomHtml();
show#
Positions and fades in the context toolbar near a selection range or block element.
Parameters:
- range (
any) — range - block (
Block | HTMLElement) — block instance
app.context.show(range);
hide#
Clears custom HTML, unbinds scroll sync, and fades out the context toolbar.
app.context.hide();
add#
Registers a dynamic context button config by name.
Parameters:
- name (
string) — identifier name - config (
object) — configuration object
app.context.add('comment', { title: 'Comment', command: 'comment.add' });
remove#
Marks context button names as removed.
Parameters:
- ...names (
Array) — list of names to process
app.context.remove('comment');
addDynamic#
Queues a dynamic button for insertion when the context toolbar DOM exists.
Parameters:
- name (
string) — identifier name - config (
object) — configuration object
app.context.addDynamic('ai', { command: 'ai.run' });
removeDynamic#
Removes a dynamically inserted button from the context toolbar DOM.
Parameters:
- name (
string) — identifier name
app.context.removeDynamic('ai');
buildToolbar#
Rebuilds context toolbar buttons for the current block context.
Parameters:
- buttons (
object) — buttons - replace (
any) — replace - block (
Block | HTMLElement) — block instance
app.context.buildToolbar();
setActive#
Adds button name(s) to the API active overlay set.
Parameters:
- names (
Array) — list of names to process
app.context.setActive('bold');
clearActive#
Removes button name(s) from the API active overlay set.
Parameters:
- names (
Array) — list of names to process
app.context.clearActive('bold');
clearAllActive#
Clears all API-driven active button states.
app.context.clearAllActive();
setDisabled#
Disables context buttons via the uiButtonsState service.
Parameters:
- names (
Array) — list of names to process
app.context.setDisabled('link');
clearDisabled#
Re-enables named context buttons.
Parameters:
- names (
Array) — list of names to process
app.context.clearDisabled('link');
setDisabledAll#
Disables all context buttons except those listed in except.
Parameters:
- except (
Array) — names or types to exclude from the rule
app.context.setDisabledAll();
clearDisabledAll#
Clears disabled state on all context buttons except those listed in except.
Parameters:
- except (
Array) — names or types to exclude from the rule
app.context.clearDisabledAll();
updateButton#
Patches dynamic config and live button state by name.
Parameters:
- name (
string) — identifier name - patch (
object) — patch
app.context.updateButton('bold', { active: true });
getButton#
Returns the Button instance for a context button name.
Parameters:
- name (
string) — identifier name
Returns: Button|null
app.context.getButton('bold');
getButtonEl#
Returns the DOM element for a context button name.
Parameters:
- name (
string) — identifier name
Returns: HTMLElement|null
app.context.getButtonEl('bold');