CKEDITOR.plugins.balloontoolbar.contextManager
A class for managers that take care of handling multiple contexts.
The manager also makes sure that only one toolbar is active (per manager) at a time and implement the logic used to determine the best fitting context for a given selection. Default priorities are as follows:
- Callback –
options.refresh - Widgets matching –
options.widgets - CSS matching –
options.cssSelector
It is worth noting that priorities could be further customized by explicitly providing CKEDITOR.plugins.balloontoolbar.contextDefinition.priority, so that it is possible to match a widget over a refresh callback.
Filtering
Properties
editor : editorCKEDITOR.plugins.balloontoolbar.contextManager#editorThe editor that the manager was created for.
-
-
An array of event listener references created by the manager.An array of objects returned by the CKEDITOR.event.on method.
Defaults to
[]
Methods
since 4.8.0
constructor( editor ) → contextManagerCKEDITOR.plugins.balloontoolbar.contextManager#constructorParameters
editor : editorThe editor instance which the toolbar is created for.
Returns
contextManager
add( context )CKEDITOR.plugins.balloontoolbar.contextManager#addcheck( [ selection ] )CKEDITOR.plugins.balloontoolbar.contextManager#checkChecks each registered context against
selectionto find the best match. By default only one toolbar per manager will be shown.Parameters
[ selection ] : selection | nullThe selection to be used for probing the toolbar. If none provided, a shrunk selection of the current editor will be used.
Defaults to
null
create( options ) → contextCKEDITOR.plugins.balloontoolbar.contextManager#createCreates a toolbar context based on provided
options, registers it in the manager and returns.// Shows Bold and Underline button for any selection. var context = contextManager.create( { buttons: 'Bold,Underline', refresh: function() { return true; } } );Parameters
options : contextDefinitionA configuration object that determines the conditions used to display the toolbar.
Returns
contextA context object created for this balloon toolbar configuration.
destroy()CKEDITOR.plugins.balloontoolbar.contextManager#destroyDestroys every context controlled by the manager and clears the context list.
hide()CKEDITOR.plugins.balloontoolbar.contextManager#hideHides every visible context controlled by the manager.
-
Adds a set of listeners integrating the manager with the editor, like the CKEDITOR.editor.selectionChange listener.
-
Destroys any context in _contexts and empties the managed contexts list.
-
Refreshes all contexts from _contexts.