JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / core / command.js
index 3c54807..d58c684 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -49,9 +49,25 @@ CKEDITOR.command = function( editor, commandDefinition )
                if ( this.editorFocus )     // Give editor focus if necessary (#4355).\r
                        editor.focus();\r
 \r
+               if ( this.fire( 'exec' ) === true )\r
+                       return true;\r
+\r
                return ( commandDefinition.exec.call( this, editor, data ) !== false );\r
        };\r
 \r
+       /**\r
+        * Explicitly update the status of the command, by firing the {@link CKEDITOR.command#event:refresh} event,\r
+        * as well as invoke the {@link CKEDITOR.commandDefinition.prototype.refresh} method if defined, this method\r
+        * is to allow different parts of the editor code to contribute in command status resolution.\r
+        */\r
+       this.refresh = function()\r
+       {\r
+               if ( this.fire( 'refresh' ) === true )\r
+                       return true;\r
+\r
+               return ( commandDefinition.refresh && commandDefinition.refresh.apply( this, arguments ) !== false );\r
+       };\r
+\r
        CKEDITOR.tools.extend( this, commandDefinition,\r
                // Defaults\r
                /** @lends CKEDITOR.command.prototype */\r
@@ -188,7 +204,7 @@ CKEDITOR.command.prototype =
 CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );\r
 \r
 /**\r
- * Indicates the preivous command state.\r
+ * Indicates the previous command state.\r
  * @name CKEDITOR.command.prototype.previousState\r
  * @type Number\r
  * @see #state\r