From c63493c899de714b05b0521bb38aab60d19030ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 20 Jan 2017 00:55:51 +0100 Subject: Validation initiale --- sources/adapters/jquery.js | 379 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 379 insertions(+) create mode 100644 sources/adapters/jquery.js (limited to 'sources/adapters') 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 `