JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0.1
[ckeditor.git] / _source / core / editor.js
index d9017c0..c4a5879 100644 (file)
@@ -113,6 +113,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                var skin = editor.config.skin.split( ',' ),\r
                        skinName = skin[ 0 ],\r
                        skinPath = CKEDITOR.getUrl( skin[ 1 ] || (\r
+                               '_source/' +    // @Packager.RemoveLine\r
                                'skins/' + skinName + '/' ) );\r
 \r
                editor.skinName = skinName;\r
@@ -435,6 +436,13 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                        return this._.commands[ commandName ] = new CKEDITOR.command( this, commandDefinition );\r
                },\r
 \r
+               /**\r
+                * Add a trunk of css text to the editor which will be applied to the wysiwyg editing document.\r
+                * Note: This function should be called before editor is loaded to take effect.\r
+                * @param css {String} CSS text.\r
+                * @example\r
+                * editorInstance.addCss( 'body { background-color: grey; }' );\r
+                */\r
                addCss : function( css )\r
                {\r
                        this._.styles.push( css );\r
@@ -566,11 +574,24 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                /**\r
                 * Sets the editor data. The data must be provided in raw format.\r
                 * @param {String} data HTML code to replace the curent content in the editor.\r
+                * @param {Function} callback Function to be called after the setData is completed.\r
                 * @example\r
                 * CKEDITOR.instances.editor1.<b>setData( '&lt;p&gt;This is the editor data.&lt;/p&gt;' )</b>;\r
+                * CKEDITOR.instances.editor1.setData( '&lt;p&gt;Some other editor data.&lt;/p&gt;', function()\r
+                * {\r
+                *              CKEDITOR.instances.editor1.checkDirty();        // true\r
+                * } );\r
                 */\r
-               setData : function( data )\r
+               setData : function( data , callback )\r
                {\r
+                       if( callback )\r
+                       {\r
+                               this.on( 'dataReady', function( evt )\r
+                               {\r
+                                       evt.removeListener();\r
+                                       callback.call( evt.editor );\r
+                               } );\r
+                       }\r
                        // Fire "setData" so data manipulation may happen.\r
                        var eventData = { dataValue : data };\r
                        this.fire( 'setData', eventData );\r