CKEDITOR.editor
Represents an editor instance. This constructor should be rarely used in favor of the CKEDITOR editor creation functions.
Filtering
Properties
-
The dynamic Enter mode which should be used in the current context (selection location). By default it equals the enterMode and it can be changed by the setActiveEnterMode method.
See also the setActiveEnterMode method for an explanation of dynamic settings.
-
The active filter instance which should be used in the current context (location selection). This instance will be used to make a decision which commands, buttons and other features can be enabled.
By default it equals the filter and it can be changed by the setActiveFilter method.
editor.on( 'activeFilterChange', function() { if ( editor.activeFilter.check( 'cite' ) ) // Do something when <cite> was enabled - e.g. enable a button. else // Otherwise do something else. } );See also the setActiveEnterMode method for an explanation of dynamic settings.
-
See the activeEnterMode property.
-
Indicates the human-readable title of this editor's application (the website's region that contains the editor and its whole UI). Although this is a read-only property, it can be initialized with CKEDITOR.config.applicationTitle.
Note: Please do not confuse this property with editor.name which identifies the literal instance in the CKEDITOR.instances.
-
The balloon toolbar manager for a given editor instance. It ensures that there is only one toolbar visible at a time.
Use the CKEDITOR.plugins.balloontoolbar.contextManager.create method to register a new toolbar context.
The following example will add a toolbar containing Link and Unlink buttons for any anchor or image:
editor.balloonToolbars.create( { buttons: 'Link,Unlink', cssSelector: 'a[href], img' } ); -
Indicates that the editor is running in an environment where no block elements are accepted inside the content.
This can be for example inline editor based on an
<h1>element. -
The configuration for this editor instance. It inherits all settings defined in CKEDITOR.config, combined with settings loaded from custom configuration files and those defined inline in the page when creating the editor.
var editor = CKEDITOR.instances.editor1; alert( editor.config.skin ); // e.g. 'moono' -
The outermost element in the DOM tree in which the editable element resides. It is provided by a specific editor creator after the editor UI is created and is not intended to be modified.
var editor = CKEDITOR.instances.editor1; alert( editor.container.getName() ); // 'span' -
Current state of the Copy Formatting plugin in this editor instance.
dataProcessor : dataProcessorCKEDITOR.editor#dataProcessorIf defined, points to the data processor which is responsible for translating and transforming the editor data on input and output. Generally it will point to an instance of CKEDITOR.htmlDataProcessor, which handles HTML data. The editor may also handle other data formats by using different data processors provided by specific plugins.
-
The document that stores the editor content.
- For the classic (
iframe-based) editor it is equal to the document inside theiframecontaining the editable element. - For the inline editor it is equal to CKEDITOR.document.
The document object is available after the contentDom event is fired and may be invalidated when the contentDomUnload event is fired (classic editor only).
editor.on( 'contentDom', function() { console.log( editor.document ); } ); - For the classic (
-
The original host page element upon which the editor is created. It is only supposed to be provided by the particular editor creator and is not subject to be modified.
-
This property indicates the way this instance is associated with the element. See also CKEDITOR.ELEMENT_MODE_INLINE and CKEDITOR.ELEMENT_MODE_REPLACE.
-
The main (static) Enter mode which is a validated version of the CKEDITOR.config.enterMode setting. Currently only one rule exists — blockless editors may have Enter modes set only to CKEDITOR.ENTER_BR.
-
The main filter instance used for input data filtering, data transformations, and activation of features.
It points to a CKEDITOR.filter instance set up based on editor configuration.
-
Controls the focus state of this editor instance. This property is rarely used for normal API operations. It is mainly targeted at developers adding UI elements to the editor interface.
-
A unique random string assigned to each editor instance on the page.
-
Controls keystroke typing in this editor instance.
-
An object that contains all language strings used by the editor interface.
alert( editor.lang.basicstyles.bold ); // e.g. 'Negrito' (if the language is set to Portuguese) -
The code for the language resources that have been loaded for the user interface elements of this editor instance.
alert( editor.langCode ); // e.g. 'en' -
The current editing mode. An editing mode basically provides different ways of editing or viewing the editor content.
alert( CKEDITOR.instances.editor1.mode ); // (e.g.) 'wysiwyg' -
A unique identifier of this editor instance.
Note: It will be originated from the
idornameattribute of the element, otherwise a name pattern of'editor{n}'will be used. -
Content filter which is used when external data is pasted or dropped into the editor or a forced paste as plain text occurs.
This object might be used on the fly to define rules for pasted external content. This object is available and used if the clipboard plugin is enabled and CKEDITOR.config.pasteFilter or CKEDITOR.config.forcePasteAsPlainText was defined.
To enable the filter:
var editor = CKEDITOR.replace( 'editor', { pasteFilter: 'plain-text' } );You can also modify the filter on the fly later on:
editor.pasteFilter = new CKEDITOR.filter( 'p h1 h2; a[!href]' );Note that the paste filter is only applied to external data. There are three data sources:
- copied and pasted in the same editor (internal),
- copied from one editor and pasted into another (cross-editor),
- coming from all other sources like websites, MS Word, etc. (external).
If Advanced Content Filter is not disabled, then it will also be applied to pasted and dropped data. The paste filter job is to "normalize" external data which often needs to be handled differently than content produced by the editor.
-
An object that contains references to all plugins used by this editor instance.
alert( editor.plugins.dialog.path ); // e.g. 'http://example.com/ckeditor/plugins/dialog/' // Check if a plugin is available. if ( editor.plugins.image ) { ... } -
Indicates the read-only state of this editor. This is a read-only property. See also setReadOnly.
-
See the enterMode property.
-
Indicates editor initialization status. The following statuses are available:
- unloaded: The initial state — the editor instance was initialized, but its components (configuration, plugins, language files) are not loaded yet.
- loaded: The editor components were loaded — see the loaded event.
- recreating: The editor editable area is recreating due to iframe reloading — see the CKEDITOR.config.observableParent configuration option.
- ready: The editor is fully initialized and ready — see the instanceReady event.
- destroyed: The editor was destroyed — see the destroy method.
Defaults to
'unloaded' -
The tabbing navigation order determined for this editor instance. This can be set by the
CKEDITOR.config.tabIndexsetting or taken from thetabindexattribute of the element associated with the editor.alert( editor.tabIndex ); // e.g. 0Defaults to
0 -
-
Indicates the human-readable title of this editor. Although this is a read-only property, it can be initialized with CKEDITOR.config.title.
Note: Please do not confuse this property with editor.name which identifies the instance in the CKEDITOR.instances literal.
-
The toolbar definition used by the editor. It is created from the CKEDITOR.config.toolbar option if it is set or automatically based on CKEDITOR.config.toolbarGroups.
-
The namespace containing UI features related to this editor instance.
-
An instance of the upload repository. It allows you to create and get file loaders.
var loader = editor.uploadRepository.create( file ); loader.loadAndUpload( 'http://foo/bar' ); -
An instance of widget repository. It contains all registered widget definitions and initialized instances.
editor.widgets.add( 'someName', { // Widget definition... } ); editor.widgets.registered.someName; // -> Widget definition
Static properties
Methods
constructor( [ instanceConfig ], [ element ], [ mode ] ) → editorCKEDITOR.editor#constructorCreates an editor class instance.
Parameters
[ instanceConfig ] : ObjectConfiguration values for this specific instance.
[ element ] : elementThe DOM element upon which this editor will be created.
[ mode ] : NumberThe element creation mode to be used by this editor.
Returns
editor
addCommand( commandName, commandDefinition )CKEDITOR.editor#addCommandAdds a command definition to the editor instance. Commands added with this function can be executed later with the execCommand method.
editorInstance.addCommand( 'sample', { exec: function( editor ) { alert( 'Executing a command for the editor name "' + editor.name + '"!' ); } } );Since 4.10.0 this method also accepts a CKEDITOR.command instance as a parameter.
Parameters
commandName : StringThe indentifier name of the command.
commandDefinition : commandDefinition | commandThe command definition or a
CKEDITOR.commandinstance.Adds the path to a stylesheet file to the exisiting CKEDITOR.config.contentsCss value.
Note: This method is available only with the
wysiwygareaplugin and only affects classic editors based on it (so it does not affect inline editors).editor.addContentsCss( 'assets/contents.css' );Parameters
cssPath : StringThe path to the stylesheet file which should be added.
Shorthand for CKEDITOR.filter.addFeature.
Parameters
feature : featureSee CKEDITOR.filter.addFeature.
Returns
BooleanSee CKEDITOR.filter.addFeature.
addMenuGroup( name, [ order ] )CKEDITOR.editor#addMenuGroupRegisters an item group to the editor context menu in order to make it possible to associate it with menu items later.
Parameters
name : StringSpecify a group name.
[ order ] : NumberDefine the display sequence of this group inside the menu. A smaller value gets displayed first.
Defaults to
100addMenuItem( name, definition )CKEDITOR.editor#addMenuItemAdds an item from the specified definition to the editor context menu.
Parameters
name : StringThe menu item name.
definition : ObjectThe menu item definition.
addMenuItems( definitions )CKEDITOR.editor#addMenuItemsAdds one or more items from the specified definition object to the editor context menu.
Parameters
definitions : ObjectObject where keys are used as itemName and corresponding values as definition for a addMenuItem call.
addMode( mode, exec )CKEDITOR.editor#addModeRegisters an editing mode. This function is to be used mainly by plugins.
Parameters
mode : StringThe mode name.
exec : FunctionThe function that performs the actual mode change.
Add to a collection of functions to decide whether a specific element should be considered as formatting element and thus could be removed during
removeFormatcommand.Note: Only available with the existence of
removeformatplugin.// Don't remove empty span. editor.addRemoveFormatFilter( function( element ) { return !( element.is( 'span' ) && CKEDITOR.tools.isEmpty( element.getAttributes() ) ); } );Parameters
func : FunctionThe function to be called, which will be passed an element to test.
applyStyle( style )CKEDITOR.editor#applyStyleApplies the style upon the editor's current selection. Shorthand for CKEDITOR.style.apply.
Parameters
style : style
attachStyleStateChange( style, callback )CKEDITOR.editor#attachStyleStateChangeRegisters a function to be called whenever the selection position changes in the editing area. The current state is passed to the function. The possible states are CKEDITOR.TRISTATE_ON and CKEDITOR.TRISTATE_OFF.
// Create a style object for the <b> element. var style = new CKEDITOR.style( { element: 'b' } ); var editor = CKEDITOR.instances.editor1; editor.attachStyleStateChange( style, function( state ) { if ( state == CKEDITOR.TRISTATE_ON ) alert( 'The current state for the B element is ON' ); else alert( 'The current state for the B element is OFF' ); } );Parameters
style : styleThe style to be watched.
callback : FunctionThe function to be called.
capture()CKEDITOR.editor#captureRegister event handler under the capturing stage on supported target.
checkDirty() → BooleanCKEDITOR.editor#checkDirtyChecks whether the current editor content contains changes when compared to the content loaded into the editor at startup, or to the content available in the editor when resetDirty was called.
function beforeUnload( evt ) { if ( CKEDITOR.instances.editor1.checkDirty() ) return evt.returnValue = "You will lose the changes made in the editor."; } if ( window.addEventListener ) window.addEventListener( 'beforeunload', beforeUnload, false ); else window.attachEvent( 'onbeforeunload', beforeUnload );Returns
Booleantrueif the content contains changes.createFakeElement( realElement, className, realElementType, isResizable ) → elementCKEDITOR.editor#createFakeElementCreates fake CKEDITOR.dom.element based on real element. Fake element is an img with special attributes, which keep real element properties.
Parameters
realElement : elementReal element to transform.
className : StringClass name which will be used as class of fake element.
realElementType : StringStores type of fake element.
isResizable : BooleanKeeps information if element is resizable.
Returns
elementFake element.
createFakeParserElement( realElement, className, realElementType, isResizable ) → elementCKEDITOR.editor#createFakeParserElementCreates fake CKEDITOR.htmlParser.element based on real element.
Parameters
realElement : elementReal element to transform.
className : StringClass name which will be used as class of fake element.
realElementType : StringStore type of fake element.
isResizable : BooleanKeep information if element is resizable.
Returns
elementFake htmlParser element.
createRange() → rangeCKEDITOR.editor#createRangeShortcut to create a CKEDITOR.dom.range instance from the editable element.
Returns
rangeThe DOM range created if the editable has presented. CKEDITOR.dom.range
define( name, meta )CKEDITOR.editor#definePredefine some intrinsic properties on a specific event name.
Parameters
name : StringThe event name
meta : Objectdestroy( [ noUpdate ] )CKEDITOR.editor#destroyDestroys the editor instance, releasing all resources used by it. If the editor replaced an element, the element will be recovered.
alert( CKEDITOR.instances.editor1 ); // e.g. object CKEDITOR.instances.editor1.destroy(); alert( CKEDITOR.instances.editor1 ); // undefinedParameters
[ noUpdate ] : BooleanIf the instance is replacing a DOM element, this parameter indicates whether or not to update the element with the instance content.
editable( [ elementOrEditable ] ) → element | nullCKEDITOR.editor#editableCreates, retrieves or detaches an editable element of the editor. This method should always be used instead of calling CKEDITOR.editable directly.
Parameters
[ elementOrEditable ] : element | editableThe DOM element to become the editable or a CKEDITOR.editable object.
Returns
element | nullThe editor's editable element, or
nullif not available.elementPath( [ startNode ] ) → elementPathCKEDITOR.editor#elementPathReturns an element path for the selection in the editor.
Parameters
[ startNode ] : nodeFrom which the path should start, if not specified defaults to editor selection's start element yielded by CKEDITOR.dom.selection.getStartElement.
Returns
elementPath
execCommand( commandName, [ data ] ) → BooleanCKEDITOR.editor#execCommandExecutes a command associated with the editor.
editorInstance.execCommand( 'bold' );Parameters
commandName : StringThe identifier name of the command.
[ data ] : ObjectThe data to be passed to the command. It defaults to an empty object starting from 4.7.0.
Returns
Booleantrueif the command was executed successfully,falseotherwise. CKEDITOR.editor.addCommandsince 4.5.0
extractSelectedHtml( [ toString ], [ removeEmptyBlock ] ) → documentFragment | String | nullCKEDITOR.editor#extractSelectedHtmlGets the selected HTML (it is returned as a document fragment or a string) and removes the selected part of the DOM. This method is designed to work as the user would expect the cut and delete functionalities to work.
See also:
- the getSelectedHtml method,
- the CKEDITOR.editable.extractHtmlFromRange method.
Parameters
[ toString ] : BooleanIf
true, then stringified HTML will be returned.[ removeEmptyBlock ] : BooleanDefault
falsemeans that the function will keep an empty block (if the entire content was removed) or it will create it (if a block element was removed) and set the selection in that block. Iftrue, the empty block will be removed or not created. In this case the function will not handle the selection.Defaults to
falseReturns
documentFragment | String | null
fire( eventName, [ data ], [ editor ] ) → Boolean | ObjectCKEDITOR.editor#fireFires an specific event in the object. All registered listeners are called at this point.
someObject.on( 'someEvent', function() { ... } ); someObject.on( 'someEvent', function() { ... } ); someObject.fire( 'someEvent' ); // Both listeners are called. someObject.on( 'someEvent', function( event ) { alert( event.data ); // 'Example' } ); someObject.fire( 'someEvent', 'Example' );Parameters
eventName : StringThe event name to fire.
[ data ] : ObjectData to be sent as the CKEDITOR.eventInfo.data when calling the listeners.
[ editor ] : editorThe editor instance to send as the CKEDITOR.eventInfo.editor when calling the listener.
Returns
Boolean | ObjectA boolean indicating that the event is to be canceled, or data returned by one of the listeners.
fireOnce( eventName, [ data ], [ editor ] ) → Boolean | ObjectCKEDITOR.editor#fireOnceFires an specific event in the object, releasing all listeners registered to that event. The same listeners are not called again on successive calls of it or of fire.
someObject.on( 'someEvent', function() { ... } ); someObject.fire( 'someEvent' ); // Above listener called. someObject.fireOnce( 'someEvent' ); // Above listener called. someObject.fire( 'someEvent' ); // No listeners called.Parameters
eventName : StringThe event name to fire.
[ data ] : ObjectData to be sent as the CKEDITOR.eventInfo.data when calling the listeners.
[ editor ] : editorThe editor instance to send as the CKEDITOR.eventInfo.editor when calling the listener.
Returns
Boolean | ObjectA booloan indicating that the event is to be canceled, or data returned by one of the listeners.
focus()CKEDITOR.editor#focusMoves the selection focus to the editing area space in the editor.
forceNextSelectionCheck()CKEDITOR.editor#forceNextSelectionCheckgetClipboardData( callbackOrOptions, callback )CKEDITOR.editor#getClipboardDataGets clipboard data by directly accessing the clipboard (IE only) or opening the paste dialog window.
editor.getClipboardData( function( data ) { if ( data ) alert( data.type + ' ' + data.dataValue ); } );Parameters
callbackOrOptions : Function | ObjectFor function, see the
callbackparameter documentation. The object was used before 4.7.0 with thetitleproperty, to set the paste dialog's title.callback : FunctionA function that will be executed with the
dataproperty of the paste event ornullif none of the capturing methods succeeded. Since 4.7.0 thecallbackshould be provided as a first argument, just like in the example above. This parameter will be removed in an upcoming major release.getColorFromDialog( callback, [ scope ] )CKEDITOR.editor#getColorFromDialogOpen up color dialog and to receive the selected color.
Parameters
callback : FunctionThe callback when color dialog is closed
[ scope ] : ObjectThe scope in which the callback will be bound.
getCommand( commandName ) → commandCKEDITOR.editor#getCommandGets one of the registered commands. Note that after registering a command definition with addCommand, it is transformed internally into an instance of CKEDITOR.command, which will then be returned by this function.
Parameters
commandName : StringThe name of the command to be returned. This is the same name that is used to register the command with
addCommand.Returns
commandThe command object identified by the provided name.
since 4.6.0
getCommandKeystroke( command, [ all ] ) → Number | Number[] | nullCKEDITOR.editor#getCommandKeystrokeReturns the keystroke that is assigned to a specified CKEDITOR.command. If no keystroke is assigned, it returns
null.Since version 4.7.0 this function also accepts a
commandparameter as a string.Parameters
command : command | StringThe CKEDITOR.command instance or a string with the command name.
[ all ] : BooleanIf
true, the function will return an array of assigned keystrokes. Available since 4.11.0.Defaults to
falseReturns
Number | Number[] | nullDepending on the
allparameter value:false– The first keystroke assigned to the provided command ornullif there is no keystroke.true– An array of all assigned keystrokes or an empty array if there is no keystroke.
getData( internal ) → StringCKEDITOR.editor#getDataGets the editor data. The data will be in "raw" format. It is the same data that is posted by the editor.
if ( CKEDITOR.instances.editor1.getData() == '' ) alert( 'There is no data available.' );Parameters
internal : BooleanIf set to
true, it will prevent firing the beforeGetData and getData events, so the real content of the editor will not be read and cached data will be returned. The method will work much faster, but this may result in the editor returning the data that is not up to date. This parameter should thus only be set totruewhen you are certain that the cached data is up to date.Returns
StringThe editor data.
getMenuItem( name ) → ObjectCKEDITOR.editor#getMenuItemRetrieves a particular menu item definition from the editor context menu.
Parameters
name : StringThe name of the desired menu item.
Returns
Object
getResizable( forContents ) → elementCKEDITOR.editor#getResizableGets the element that can be used to check the editor size. This method is mainly used by the Editor Resize plugin, which adds a UI handle that can be used to resize the editor.
Parameters
forContents : BooleanWhether to return the "contents" part of the theme instead of the container.
Returns
elementThe resizable element.
since 4.5.0
getSelectedHtml( [ toString ] ) → documentFragment | StringCKEDITOR.editor#getSelectedHtmlGets the selected HTML (it is returned as a document fragment or a string). This method is designed to work as the user would expect the copy functionality to work. For instance, if the following selection was made:
<p>a<b>b{c}d</b>e</p>The following HTML will be returned:
<b>c</b>As you can see, the information about the bold formatting was preserved, even though the selection was anchored inside the
<b>element.See also:
- the extractSelectedHtml method,
- the CKEDITOR.editable.getHtmlFromRange method.
Parameters
[ toString ] : BooleanIf
true, then stringified HTML will be returned.Returns
documentFragment | String
Retrieves the CKEDITOR.dom.range instances that represent the current selection.
Note: This function is an alias for the CKEDITOR.dom.selection.getRanges method.
Parameters
[ onlyEditables ] : BooleanIf set to
true, this function retrieves editable ranges only.Returns
ArrayRange instances that represent the current selection.
getSelection( forceRealSelection ) → selection | nullCKEDITOR.editor#getSelectionRetrieve the editor selection in scope of editable element.
Note: Since the native browser selection provides only one single selection at a time per document, so if editor's editable element has lost focus, this method will return a null value unless the lockSelection has been called beforehand so the saved selection is retrieved.
var selection = CKEDITOR.instances.editor1.getSelection(); alert( selection.getType() );Parameters
forceRealSelection : BooleanReturn real selection, instead of saved or fake one.
Returns
selection | nullA selection object or null if not available for the moment.
getSnapshot() → StringCKEDITOR.editor#getSnapshotGets the "raw data" currently available in the editor. This is a fast method which returns the data as is, without processing, so it is not recommended to use it on resulting pages. Instead it can be used combined with the loadSnapshot method in order to automatically save the editor data from time to time while the user is using the editor, to avoid data loss, without risking performance issues.
alert( editor.getSnapshot() );See also:
Returns
StringEditor "raw data".
getStylesSet( callback )CKEDITOR.editor#getStylesSetGets the current
stylesSetfor this instance.editor.getStylesSet( function( stylesDefinitions ) {} );See also stylesSet event.
Parameters
callback : FunctionThe function to be called with the styles data.
getUiColor() → StringCKEDITOR.editor#getUiColorGets the color of the editor user interface.
CKEDITOR.instances.editor1.getUiColor();Returns
StringuiColor The editor UI color or
undefinedif the UI color is not set.hasListeners( eventName ) → BooleanCKEDITOR.editor#hasListenersChecks if there is any listener registered to a given event.
var myListener = function() { ... }; someObject.on( 'someEvent', myListener ); alert( someObject.hasListeners( 'someEvent' ) ); // true alert( someObject.hasListeners( 'noEvent' ) ); // falseParameters
eventName : StringThe event name.
Returns
Boolean
insertElement( element )CKEDITOR.editor#insertElementInserts an element into the currently selected position in the editor in WYSIWYG mode.
var element = CKEDITOR.dom.element.createFromHtml( '<img src="hello.png" border="0" title="Hello" />' ); CKEDITOR.instances.editor1.insertElement( element );Fires the insertElement event. The element is inserted in the listener with a default priority (10), so you can add listeners with lower or higher priorities in order to execute some code before or after the element is inserted.
Parameters
element : elementThe element to be inserted into the editor.
insertHtml( html, [ mode ], [ range ] )CKEDITOR.editor#insertHtmlInserts HTML code into the currently selected position in the editor in WYSIWYG mode.
Example:
CKEDITOR.instances.editor1.insertHtml( '<p>This is a new paragraph.</p>' );Fires the insertHtml and afterInsertHtml events. The HTML is inserted in the insertHtml event's listener with a default priority (10) so you can add listeners with lower or higher priorities in order to execute some code before or after the HTML is inserted.
Parameters
html : StringHTML code to be inserted into the editor.
[ mode ] : StringThe mode in which the HTML code will be inserted. One of the following:
'html'– The inserted content will completely override the styles at the selected position.'unfiltered_html'– Like'html'but the content is not filtered with CKEDITOR.filter.'text'– The inserted content will inherit the styles applied in the selected position. This mode should be used when inserting "htmlified" plain text (HTML without inline styles and styling elements like<b>,<strong>,<span style="...">).
Defaults to
'html'[ range ] : rangeIf specified, the HTML will be inserted into the range instead of into the selection. The selection will be placed at the end of the insertion (like in the normal case). Introduced in CKEditor 4.5.
Inserts text content into the currently selected position in the editor in WYSIWYG mode. The styles of the selected element will be applied to the inserted text. Spaces around the text will be left untouched.
CKEDITOR.instances.editor1.insertText( ' line1 \n\n line2' );Fires the insertText and afterInsertHtml events. The text is inserted in the insertText event's listener with a default priority (10) so you can add listeners with lower or higher priorities in order to execute some code before or after the text is inserted.
Parameters
text : StringText to be inserted into the editor.
Determines if the current editor instance is destroyed.
Returns
Booleantrue if the editor is destroyed.
Provides information whether the editor's container is detached.
Returns
Booleantrue if the editor's container is detached.
loadSnapshot( snapshot )CKEDITOR.editor#loadSnapshotLoads "raw data" into the editor. The data is loaded with processing straight to the editing area. It should not be used as a way to load any kind of data, but instead in combination with getSnapshot-produced data.
var data = editor.getSnapshot(); editor.loadSnapshot( data );Parameters
snapshot : Object
lockSelection( [ sel ] ) → BooleanCKEDITOR.editor#lockSelectionLocks the selection made in the editor in order to make it possible to manipulate it without browser interference. A locked selection is cached and remains unchanged until it is released with the unlockSelection method.
Parameters
[ sel ] : selectionSpecify the selection to be locked.
Returns
Booleantrueif selection was locked.on( eventName, listenerFunction, [ scopeObj ], [ listenerData ], [ priority ] ) → ObjectCKEDITOR.editor#onRegisters a listener to a specific event in the current object.
someObject.on( 'someEvent', function() { alert( this == someObject ); // true } ); someObject.on( 'someEvent', function() { alert( this == anotherObject ); // true }, anotherObject ); someObject.on( 'someEvent', function( event ) { alert( event.listenerData ); // 'Example' }, null, 'Example' ); someObject.on( 'someEvent', function() { ... } ); // 2nd called someObject.on( 'someEvent', function() { ... }, null, null, 100 ); // 3rd called someObject.on( 'someEvent', function() { ... }, null, null, 1 ); // 1st calledNote: CKEditor's event system has a limitation that one function cannot be used as a listener for the same event more than once. Hence, to reuse it with multiple listeners, it should be wrapped into additional wrapper function:
function listener( evt ) { ... }; someObject.on( 'someEvent', function() { listener(); } ); someObject.on( 'someEvent', function( evt ) { listener( evt ); } );Parameters
eventName : StringThe event name to which listen.
listenerFunction : FunctionThe function listening to the event. A single CKEDITOR.eventInfo object instanced is passed to this function containing all the event data.
[ scopeObj ] : ObjectThe object used to scope the listener call (the
thisobject). If omitted, the current object is used.[ listenerData ] : ObjectData to be sent as the CKEDITOR.eventInfo.listenerData when calling the listener.
[ priority ] : NumberThe listener priority. Lower priority listeners are called first. Listeners with the same priority value are called in registration order.
Defaults to
10Returns
ObjectAn object containing the
removeListenerfunction, which can be used to remove the listener at any time.once()CKEDITOR.editor#onceSimiliar with on but the listener will be called only once upon the next event firing.
openDialog( dialogName, callback, [ forceModel ] ) → dialogCKEDITOR.editor#openDialogLoads and opens a registered dialog.
CKEDITOR.instances.editor1.openDialog( 'smiley' );Parameters
dialogName : StringThe registered name of the dialog.
callback : FunctionThe function to be invoked after a dialog instance is created.
[ forceModel ] : element | widget | ObjectForces opening the dialog using the given model as a subject. The forced model will take precedence before the CKEDITOR.dialog.definition.getModel method. Available since 4.13.0.
Returns