Sha256: 9cee3b373c3b4fa77d9a6cf45519568bb6e1b425715e83a76297fa02db51af8d
Contents?: true
Size: 1.7 KB
Versions: 22
Compression:
Stored size: 1.7 KB
Contents
/* Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.command = function( editor, commandDefinition ) { this.exec = function( data ) { if ( this.state == CKEDITOR.TRISTATE_DISABLED ) return false; // The editor will always have the focus when executing a command. editor.focus(); return ( commandDefinition.exec.call( this, editor, data ) !== false ); }; CKEDITOR.tools.extend( this, commandDefinition, // Defaults { modes : { wysiwyg : 1 }, state : CKEDITOR.TRISTATE_OFF }); // Call the CKEDITOR.event constructor to initialize this instance. CKEDITOR.event.call( this ); }; CKEDITOR.command.prototype = { enable : function() { if ( this.state == CKEDITOR.TRISTATE_DISABLED ) this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState ); }, disable : function() { this.setState( CKEDITOR.TRISTATE_DISABLED ); }, setState : function( newState ) { // Do nothing if there is no state change. if ( this.state == newState ) return false; this.previousState = this.state; // Set the new state. this.state = newState; // Fire the "state" event, so other parts of the code can react to the // change. this.fire( 'state' ); return true; }, toggleState : function() { if ( this.state == CKEDITOR.TRISTATE_OFF ) this.setState( CKEDITOR.TRISTATE_ON ); else if ( this.state == CKEDITOR.TRISTATE_ON ) this.setState( CKEDITOR.TRISTATE_OFF ); } }; CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
Version data entries
22 entries across 22 versions & 6 rubygems