CKEDITOR.plugins.balloontoolbar.contextDefinition
This is an abstract class that describes the definition of a balloon toolbar context.
Note that context matching options have a different priority by default, see more details in CKEDITOR.plugins.balloontoolbar.contextManager.
Filtering
Properties
cssSelector : String | nullCKEDITOR.plugins.balloontoolbar.contextDefinition#cssSelectorA CSS selector. If any element in the path matches against it, the toolbar will be shown.
Defaults to
nullpriority : NumberCKEDITOR.plugins.balloontoolbar.contextDefinition#priorityA number based on CKEDITOR.plugins.balloontoolbar.PRIORITY.
var defA = { buttons: 'Bold', refresh: function() { return true; } }; // Even though the previous definition uses the refresh function, it will not take // priority over this definition, as it explicitly states the high priority. var defB = { buttons: 'NumberedList,BulletedList', cssSelector: 'li', priority: CKEDITOR.plugins.balloontoolbar.PRIORITY.HIGH };Defaults to
CKEDITOR.plugins.balloontoolbar.PRIORITY.MEDIUMwidgets : String[] | String | nullCKEDITOR.plugins.balloontoolbar.contextDefinition#widgetsAn array of widget names that should show the related toolbar. Alternatively it can be passed as a comma-separated string.
Defaults to
null
Methods
refresh( editor, path, selection ) → Boolean | elementCKEDITOR.plugins.balloontoolbar.contextDefinition#refreshAn optional function that determines whether the toolbar should be visible for a given
path.An example below will show the toolbar only for paths containing
<strong>elements.// Assuming that the editor is a CKEDITOR.editor instance. // Show the toolbar only if there is a <strong> element in the path. editor.balloontoolbar.create( { buttons: 'Bold,Underline', refresh: function( editor, path ) { return path.contains( 'strong' ); } } ); // In this case the toolbar will always be visible, pointing at the editable, despite the selection. editor.balloontoolbar.create( { buttons: 'Bold,Underline', refresh: function( editor, path ) { return editor.editable(); } } );Parameters
editor : editorAn editor that controls this context.
path : elementPathThe path for the currently probed selection.
selection : selectionA selection object used for probing.
Returns
Boolean | elementReturning
truemeans that the balloon toolbar should be shown, pointing at the last element in the selection. Returningfalsemeans that no toolbar should be shown. It may also return a CKEDITOR.dom.element instance; in that case the toolbar will be shown and point at a given element.