/**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR_Adapters.jQuery jQuery Adapter}.
*/
/**
* @class CKEDITOR_Adapters.jQuery
* @singleton
*
* The jQuery Adapter allows for easy use of basic CKEditor functions and access to the internal API.
* To find more information about the jQuery Adapter, go to the [jQuery Adapter section](#!/guide/dev_jquery)
* of the Developer's Guide or see the "Create Editors with jQuery" sample.
*
* @aside guide dev_jquery
*/
( function( $ ) {
if ( typeof $ == 'undefined' ) {
throw new Error( 'jQuery should be loaded before CKEditor jQuery adapter.' );
}
if ( typeof CKEDITOR == 'undefined' ) {
throw new Error( 'CKEditor should be loaded before CKEditor jQuery adapter.' );
}
/**
* Allows CKEditor to override `jQuery.fn.val()`. When set to `true`, the `val()` function
* used on textarea elements replaced with CKEditor uses the CKEditor API.
*
* This configuration option is global and is executed during the loading of the jQuery Adapter.
* It cannot be customized across editor instances.
*
* Read more in the [documentation](#!/guide/dev_jquery).
*
*
*
*
*
*
*
*
* @cfg {Boolean} [jqueryOverrideVal=true]
* @member CKEDITOR.config
*/
CKEDITOR.config.jqueryOverrideVal =
typeof CKEDITOR.config.jqueryOverrideVal == 'undefined' ? true : CKEDITOR.config.jqueryOverrideVal;
// jQuery object methods.
$.extend( $.fn, {
/**
* Returns an existing CKEditor instance for the first matched element.
* Allows to easily use the internal API. Does not return a jQuery object.
*
* Raises an exception if the editor does not exist or is not ready yet.
*
* @returns CKEDITOR.editor
* @deprecated Use {@link #editor editor property} instead.
*/
ckeditorGet: function() {
var instance = this.eq( 0 ).data( 'ckeditorInstance' );
if ( !instance )
throw 'CKEditor is not initialized yet, use ckeditor() with a callback.';
return instance;
},
/**
* A jQuery function which triggers the creation of CKEditor with `