X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fpiedsjaloux-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fadapters%2Fjquery.js;fp=sources%2Fadapters%2Fjquery.js;h=4a7796b1f8b9cb19e8035954e4d476fdd94a972e;hp=0000000000000000000000000000000000000000;hb=317f8f8f0651488f226b5280a8f036c7c135c639;hpb=1096cdefb1c9a3f3c4ca6807e272da6c92e5ed9c diff --git a/sources/adapters/jquery.js b/sources/adapters/jquery.js new file mode 100644 index 0000000..4a7796b --- /dev/null +++ b/sources/adapters/jquery.js @@ -0,0 +1,379 @@ +/** + * @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 `