From 7adcb81e4f83f98c468889aaa5a85558ba88c770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 25 Jan 2016 17:45:33 +0100 Subject: Initial commit --- sources/core/editor_basic.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sources/core/editor_basic.js (limited to 'sources/core/editor_basic.js') diff --git a/sources/core/editor_basic.js b/sources/core/editor_basic.js new file mode 100644 index 00000000..f81efb35 --- /dev/null +++ b/sources/core/editor_basic.js @@ -0,0 +1,36 @@ +/** + * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +if ( !CKEDITOR.editor ) { + // Documented at editor.js. + CKEDITOR.editor = function() { + // Push this editor to the pending list. It'll be processed later once + // the full editor code is loaded. + CKEDITOR._.pending.push( [ this, arguments ] ); + + // Call the CKEDITOR.event constructor to initialize this instance. + CKEDITOR.event.call( this ); + }; + + // Both fire and fireOnce will always pass this editor instance as the + // "editor" param in CKEDITOR.event.fire. So, we override it to do that + // automaticaly. + CKEDITOR.editor.prototype.fire = function( eventName, data ) { + if ( eventName in { instanceReady: 1, loaded: 1 } ) + this[ eventName ] = true; + + return CKEDITOR.event.prototype.fire.call( this, eventName, data, this ); + }; + + CKEDITOR.editor.prototype.fireOnce = function( eventName, data ) { + if ( eventName in { instanceReady: 1, loaded: 1 } ) + this[ eventName ] = true; + + return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this ); + }; + + // "Inherit" (copy actually) from CKEDITOR.event. + CKEDITOR.event.implementOn( CKEDITOR.editor.prototype ); +} -- cgit v1.2.3