CKEDITOR.ui.balloonPanel
A class that represents a floating, balloon-shaped panel capable of presenting defined content at a precise position in the document. It can be used to represent contextual data or forms i.e. related to an element in the editor's editable.
// Create an instance of the balloon panel.
var panel = new CKEDITOR.ui.balloonPanel( editor, {
title: 'My Panel',
content: '<p>This is my panel</p>'
} );
// Attach the panel to an element in DOM and show it immediately.
panel.attach( domElement );
Filtering
Properties
-
activeShowListeners : ObjectCKEDITOR.ui.balloonPanel#activeShowListenersEvent listeners associated with this balloon panel, active as long as the panel is shown. See addShowListener, activateShowListeners, deactivateShowListeners.
Defaults to
{} -
editor : ObjectCKEDITOR.ui.balloonPanel#editorThe editor for this balloon panel.
-
focusables : ObjectCKEDITOR.ui.balloonPanel#focusablesFocusable elements in this balloon panel. See registerFocusable, deregisterFocusable and CKEDITOR.focusManager.
Defaults to
{} -
height : StringCKEDITOR.ui.balloonPanel#height -
parts : ObjectCKEDITOR.ui.balloonPanel#parts -
rect : ObjectCKEDITOR.ui.balloonPanel#rect -
showListeners : ObjectCKEDITOR.ui.balloonPanel#showListenersEvent listeners associated with this balloon panel, activated on panel show. See addShowListener, activateShowListeners, deactivateShowListeners.
Defaults to
{} -
templateDefinitions : ObjectCKEDITOR.ui.balloonPanel#templateDefinitionsBalloon panel templates. Automatically converted into a CKEDITOR.template in the panel constructor.
-
templates : ObjectCKEDITOR.ui.balloonPanel#templatesTemplates for UI elements in this balloon panel. See templateDefinitions, parts.
Defaults to
{} -
triangleHeight : NumberCKEDITOR.ui.balloonPanel#triangleHeightThe default height of the triangle that points to the element in the editable.
Defaults to
20 -
triangleMinDistance : NumberCKEDITOR.ui.balloonPanel#triangleMinDistanceThe default distance between the triangle and the vertical edge of the panel.
Defaults to
40 -
triangleWidth : NumberCKEDITOR.ui.balloonPanel#triangleWidthThe default width of the triangle that points to the element in the editable.
Defaults to
20 -
width : NumberCKEDITOR.ui.balloonPanel#width
Methods
-
_getViewPaneRect( window ) → ObjectCKEDITOR.ui.balloonPanel#_getViewPaneRectParameters
window : window
Returns
ObjectReturns viewport position, taking scroll offset into account.
Propertiestop : Numberbottom : Numberleft : Numberright : Number
-
activateShowListener( id )CKEDITOR.ui.balloonPanel#activateShowListenerActivates an event listener associated with this balloon panel. See showListeners, activeShowListeners, deactivateShowListener, addShowListener, removeShowListener.
Parameters
id : Object
-
activateShowListeners()CKEDITOR.ui.balloonPanel#activateShowListenersActivates all event listeners associated with this balloon panel. See showListeners, activeShowListeners, deactivateShowListeners, addShowListener, removeShowListener.
-
addShowListener( listener ) → ObjectCKEDITOR.ui.balloonPanel#addShowListenerAdds an event listener associated with this balloon panel. This listener will be activated on panel
showand deactivated on panelhide. See showListeners, activeShowListeners, activateShowListeners, deactivateShowListeners.Parameters
listener : FunctionA function that, if called, attaches the listener and returns the listener object.
Returns
ObjectAn object containing the
removeListenermethod that removes the listener from the collection.
-
attach( elementOrSelection, [ options ] )CKEDITOR.ui.balloonPanel#attachPlaces the balloon panel next to a specified element or a selection so the tip of the balloon's triangle touches that element or the center of the selection. Once the panel is attached it gains focus.
Parameters
elementOrSelection : element | selectionThe element or selection to which the panel is attached. Since 4.11.0 instead of an element it is possible to pass a selection CKEDITOR.dom.selection.
[ options ] : Object | element | BooleanSince 4.8.0 this parameter works as an
optionsobject.If a
CKEDITOR.dom.element/Booleaninstance is given, this parameter acts as anoptions.focusElement.
-
blur()CKEDITOR.ui.balloonPanel#blurMoves the focus back to the editor's editable.
-
build()CKEDITOR.ui.balloonPanel#buildBuilds the UI of the balloon panel.
-
deactivateShowListener( id )CKEDITOR.ui.balloonPanel#deactivateShowListenerDeactivates an event listener associated with this balloon panel. See activateShowListener.
Parameters
id : Object
-
deactivateShowListeners()CKEDITOR.ui.balloonPanel#deactivateShowListenersRemoves all event listeners associated with this balloon panel. See activateShowListeners.
-
deregisterFocusable( element )CKEDITOR.ui.balloonPanel#deregisterFocusableUnregisters an element from editor's focus manager. See focusables.
Parameters
element : elementAn element to be registered.
-
destroy()CKEDITOR.ui.balloonPanel#destroyDestroys the balloon panel by removing it from DOM and purging all associated event listeners.
-
getHeight() → NumberCKEDITOR.ui.balloonPanel#getHeight -
getWidth() → NumberCKEDITOR.ui.balloonPanel#getWidth -
hide()CKEDITOR.ui.balloonPanel#hideHides the balloon panel and moves the focus back to the editable.
-
move( top, left )CKEDITOR.ui.balloonPanel#moveMoves the upper-left balloon panel corner to the specified absolute position.
Parameters
top : Numberleft : Number
-
registerFocusable( element )CKEDITOR.ui.balloonPanel#registerFocusableRegisters a new focusable element in the editor's focus manager so the instance does not blur once the child of the balloon panel gains focus. See focusables.
Parameters
element : elementAn element to be registered.
-
removeShowListener( id )CKEDITOR.ui.balloonPanel#removeShowListenerRemoves an event listener associated with this balloon panel visible state. See addShowListener.
Parameters
id : NumberAn ID of the listener.
-
resize( width, height )CKEDITOR.ui.balloonPanel#resizeResizes the balloon panel container to given dimensions. Use
'auto'to make the dimensions of the panel flexible.Parameters
width : Numberheight : Number
-
setTitle( title )CKEDITOR.ui.balloonPanel#setTitle -
setTriangle( side )CKEDITOR.ui.balloonPanel#setTriangleChanges the position of the balloon's triangle that points to the element in the editable.
Parameters
side : StringOne of 'left', 'right', 'top' or 'bottom'.
-
show()CKEDITOR.ui.balloonPanel#showShows the balloon panel.
-
This method will modify
elementRectif the element is outside ofeditorRect. If it is outside, it is going to change it into a rectangle that is withineditorRect.For example here
elementRectis going to be changed into a very narrow rectangle (with unmodified height) representation withineditorRect.+------------------------------------------+ | | | #| +----------+ | #| | | | #| | | | editorRect #| |elmentRect| | #| | | | #| | | | #| +----------+ | | +------------------------------------------+Parameters
elementRect : ObjectRectangle object that should be contained within
editorRect. This object might be modified.editorRect : ObjectReference container that should contain
elementRect.
-
private
_getAlignments( elementRect, panelWidth, panelHeight ) → ObjectCKEDITOR.ui.balloonPanel#_getAlignmentsReturns a dictionary containing different alignment positions.
Keys tell where the balloon is positioned relative to the element, e.g. this would be the result for "top center":
[Editor] +-------------------------------------+ | [Panel] | | +-----------------+ | | | | | | [El.] +--------v--------+ | | +-------------------------------+ | | | | | | | | | +--+-------------------------------+--+Sample result:
{ "right vcenter": { top: 529.5, left: 175 }, "left vcenter": { top: 529.5, left: 10}, "top hcenter": { top: 402, left: 92.5}, "top left": { top: 402, left: 102.5}, "top right": { top: 402, left: 82.5}, "bottom hcenter": { top: 643, left: 92.5}, "bottom left": { top: 643, left: 102.5}, "bottom right": { top: 643, left: 82.5} }Parameters
elementRect : ObjectpanelWidth : NumberpanelHeight : Number
Returns
Object