Documentation
Toolbar Button
isActive #
Returns: Boolean
Check if the button is active.
var button = this.toolbar.getButton('bold');
var is = button.isActive();
isDisabled #
Returns: Boolean
Check if the button is disabled.
var button = this.toolbar.getButton('bold');
var is = button.isDisabled();
hasIcon #
Returns: Boolean
Check if the button has an icon.
var button = this.toolbar.getButton('bold');
var icon = button.hasIcon();
setDropdown #
dropdown | Object |
Returns: Object
Set the object with data to create the button dropdown. The dropdown data object can contain items with the following values:
- title
String
- the title text of dropdown item.
- api
String
- the name of API to module or plugin method, for example:
module.block.format
.
- the name of API to module or plugin method, for example:
- message
String
- the name of message which is broadcasting to app when the item is clicked, for example:
myitemclicked
.
- the name of message which is broadcasting to app when the item is clicked, for example:
- args
Mixed
- arguments which will be passed with api method or message.
var dropdownData = {
item1: {
title: 'My dropdown item 1',
api: 'plugin.myplugin.method1'
},
item2: {
title: 'My dropdown item 2',
api: 'plugin.myplugin.method2'
}
};
var button = this.toolbar.getButton('bold');
var dropdown = button.setDropdown(dropdownData);
setMessage #
message | String | args Mixed (optional) |
Set the name of message which is broadcasting to app when the button is clicked.
var button = this.toolbar.getButton('bold');
button.setMessage('mybuttonmessage');
setApi #
api | String | args Mixed (optional) |
Set the name of API to module or plugin method.
var button = this.toolbar.getButton('bold');
button.setApi('module.block.format', { tag: 'pre' });
setTitle #
tooltip | String |
Set a title to the button.
var button = this.toolbar.getButton('bold');
button.setTitle('My button');
setTooltip #
tooltip | String |
Set a tooltip title to the button.
var button = this.toolbar.getButton('bold');
button.setTooltip('My button tooltip');
setIcon #
icon | String |
Set an icon HTML to the button.
var button = this.toolbar.getButton('bold');
button.setIcon('<i class="fa fa-bath"></i>');
setActive #
Set the button is active.
var button = this.toolbar.getButton('bold');
button.setActive();
setInactive #
Set the button is not active.
var button = this.toolbar.getButton('bold');
button.setInactive();
hideTooltip #
Hide the button tooltip.
var button = this.toolbar.getButton('bold');
button.hideTooltip();
getDropdown #
Returns: Object
Boolean
Get the object of button dropdown, if the button has one.
var button = this.toolbar.getButton('bold');
var dropdown = button.getDropdown();
disable #
Disable the button.
var button = this.toolbar.getButton('bold');
button.disable();
enable #
Enable the button.
var button = this.toolbar.getButton('bold');
button.enable();