X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Feditor.js;h=c0653010ff1dbbb0e1e9e72ee5b75d9371481e24;hp=e21477830c15f7afe7d2dc92dfeaf656b61189c4;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d diff --git a/_source/core/editor.js b/_source/core/editor.js index e214778..c065301 100644 --- a/_source/core/editor.js +++ b/_source/core/editor.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -33,6 +33,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( !customConfig ) return false; + customConfig = CKEDITOR.getUrl( customConfig ); + var loadedConfig = loadConfigLoaded[ customConfig ] || ( loadConfigLoaded[ customConfig ] = {} ); // If the custom config has already been downloaded, reuse it. @@ -44,7 +46,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // If there is no other customConfig in the chain, fire the // "configLoaded" event. - if ( editor.config.customConfig == customConfig || !loadConfig( editor ) ) + if ( CKEDITOR.getUrl( editor.config.customConfig ) == customConfig || !loadConfig( editor ) ) editor.fireOnce( 'customConfigLoaded' ); } else @@ -124,7 +126,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.fireOnce( 'configLoaded' ); // Load language file. - loadLang( editor ); + loadSkin( editor ); }; var loadLang = function( editor ) @@ -246,7 +248,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Load the editor skin. editor.fire( 'pluginsLoaded' ); - loadSkin( editor ); + loadTheme( editor ); }); }); }; @@ -255,7 +257,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { CKEDITOR.skins.load( editor, 'editor', function() { - loadTheme( editor ); + loadLang( editor ); }); }; @@ -573,7 +575,11 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, }, /** - * Sets the editor data. The data must be provided in raw format. + * Sets the editor data. The data must be provided in raw format (HTML). + * Note: This's an asynchronous method, the {@param callback} + * function should be relied on if you want to interact with the editor + * after data is fully loaded. + * * @param {String} data HTML code to replace the curent content in the editor. * @param {Function} callback Function to be called after the setData is completed. * @example @@ -650,10 +656,15 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, var element = this.element; if ( element && this.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) { + var data = this.getData(); + + if( this.config.htmlEncodeOutput ) + data = CKEDITOR.tools.htmlEncode( data ); + if ( element.is( 'textarea' ) ) - element.setValue( this.getData() ); + element.setValue( data ); else - element.setHtml( this.getData() ); + element.setHtml( data ); } } }); @@ -670,3 +681,12 @@ CKEDITOR.on( 'loaded', function() pending[ i ]._init(); } }); + +/** + * Whether escape HTML when editor update original input element. + * @name CKEDITOR.config.htmlEncodeOutput + * @type {Boolean} + * @default false + * @example + * config.htmlEncodeOutput = true; + */