CKEDITOR.ui.balloonToolbar
A class representing an instance of the balloon toolbar.
The easiest way to create a balloon toolbar is by using the CKEDITOR.editor.balloonToolbars create method.
However, it is possible to maintain it manually, like below:
// The following example will show a balloon toolbar on any selection change. The toolbar is anchored to the
// last element in the selection, assuming that the editor variable is an instance of CKEDITOR.editor.
editor.on( 'instanceReady', function() {
var toolbar = new CKEDITOR.ui.balloonToolbar( editor );
toolbar.addItems( {
link: new CKEDITOR.ui.button( {
command: 'link'
} ),
unlink: new CKEDITOR.ui.button( {
command: 'unlink'
} )
} );
editor.on( 'selectionChange', function( evt ) {
var lastElement = evt.data.path.lastElement;
if ( lastElement ) {
toolbar.attach( lastElement );
}
} );
} );
Filtering
Properties
-
-
A view instance of the balloon toolbar.
Methods
-
since 4.8.0
constructor( editor, definition ) → balloonToolbarCKEDITOR.ui.balloonToolbar#constructorCreates a balloon toolbar instance.
Parameters
editor : editorThe editor instance for which the toolbar is created.
definition : ObjectAn object containing the panel definition. See CKEDITOR.ui.balloonPanel documentation for an example definition.
Returns
balloonToolbar
-
addItem( name, element )CKEDITOR.ui.balloonToolbar#addItemAdds an item to the balloon toolbar.
Parameters
name : StringThe menu item name.
element : button | richComboAn instance of the UI element.
-
addItems( elements )CKEDITOR.ui.balloonToolbar#addItemsAdds one or more items to the balloon toolbar.
Parameters
elements : ObjectAn object where keys are used as
itemNameand corresponding values as a definition for the addItem call.
-
attach( element, [ hidden ] )CKEDITOR.ui.balloonToolbar#attachDisplays the balloon toolbar, pointing it to the
element.Parameters
element : elementThe element to which the panel is attached.
[ hidden ] : BooleanDo not show the balloon toolbar after attaching it.
Defaults to
false
-
deleteItem( name )CKEDITOR.ui.balloonToolbar#deleteItemRemoves a particular menu item from the balloon toolbar.
Parameters
name : StringThe name of the menu item to be deleted.
-
destroy()CKEDITOR.ui.balloonToolbar#destroyHides the toolbar, removes it from the DOM, and clears all its items.
-
getItem( name ) → button | richComboCKEDITOR.ui.balloonToolbar#getItemRetrieves a particular menu item from the balloon toolbar.
Parameters
name : StringThe name of the desired menu item.
Returns
button | richCombo
-
hide()CKEDITOR.ui.balloonToolbar#hideHides the balloon toolbar.
-
refresh()CKEDITOR.ui.balloonToolbar#refreshRefreshes all command states so buttons state on the balloon toolbar are up to date.
-
Repositions the balloon toolbar, pointing to the previously attached
element. -
show()CKEDITOR.ui.balloonToolbar#showShows the balloon toolbar.