X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fcommand.js;h=d58c684e9346d766b85440653360da259c9385a1;hp=c0868f0f922ae219f6e548705ee3139a2e942988;hb=2f22c0c38f17e75be5541089076885442aaa2377;hpb=e73319a12b56100b29ef456fd74114fe5519e01c diff --git a/_source/core/command.js b/_source/core/command.js index c0868f0..d58c684 100644 --- a/_source/core/command.js +++ b/_source/core/command.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -49,9 +49,25 @@ CKEDITOR.command = function( editor, commandDefinition ) if ( this.editorFocus ) // Give editor focus if necessary (#4355). editor.focus(); + if ( this.fire( 'exec' ) === true ) + return true; + return ( commandDefinition.exec.call( this, editor, data ) !== false ); }; + /** + * Explicitly update the status of the command, by firing the {@link CKEDITOR.command#event:refresh} event, + * as well as invoke the {@link CKEDITOR.commandDefinition.prototype.refresh} method if defined, this method + * is to allow different parts of the editor code to contribute in command status resolution. + */ + this.refresh = function() + { + if ( this.fire( 'refresh' ) === true ) + return true; + + return ( commandDefinition.refresh && commandDefinition.refresh.apply( this, arguments ) !== false ); + }; + CKEDITOR.tools.extend( this, commandDefinition, // Defaults /** @lends CKEDITOR.command.prototype */