Skip to main content

Toolbar Methods

add#

Adds a new control to the toolbar

void add(object config, number index, string parent);

ParameterTypeDescription
configobjectan object with the control config
indexnumberthe index of the position to place the control into
parentstringthe id of a parent control (for the menuItem type)
richtext.toolbar.data.add({    type: "button",    value: "Count Characters",    id: "calc"}, 24);

Related samples: Custom Button


remove#

Removes a control from the toolbar

void remove(string id);

ParameterTypeDescription
idstringthe id of the control
richtext.toolbar.data.remove("undo");

update#

Updates configuration options of the control

void update(string id, object new_config);

ParameterTypeDescription
idstringthe id of the control
configobjectan object with new configuration of the control
var icons = [    ["bold", "fas fa-bold"],    ["underline", "fas fa-underline"],    ["italic", "fas fa-italic"],    ["strike", "fas fa-strikethrough"]];
for (var i=0; i<icons.length; i++) {   var toolbarId = icons[i][0];   var iconName = icons[i][1];   richtext.toolbar.data.update(toolbarId, {icon: iconName});}

Related samples: Custom Icons