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

Version Path
browsercms-3.3.4 public/bcms/ckeditor/core/command.js
browsercms-3.4.0.rc2 vendor/assets/javascripts/bcms/ckeditor/core/command.js
browsercms-3.4.0.rc1 vendor/assets/javascripts/bcms/ckeditor/core/command.js
browsercms-3.3.3 public/bcms/ckeditor/core/command.js
browsercms-3.1.5 public/bcms/ckeditor/core/command.js
browsercms-3.1.4 public/bcms/ckeditor/core/command.js
browsercms-3.3.2 public/bcms/ckeditor/core/command.js
browsercms-3.3.1 public/bcms/ckeditor/core/command.js
browsercms-3.3.0 public/bcms/ckeditor/core/command.js
browsercms-3.1.3 public/bcms/ckeditor/core/command.js
browsercms-3.3.0.beta public/bcms/ckeditor/core/command.js
bcms_content_syncing-1.0.0 public/bcms/ckeditor/core/command.js
drujensen-browsercms-3.2.0 public/bcms/ckeditor/core/command.js
browsercmsi-3.1.2 public/bcms/ckeditor/core/command.js
browsercms-3.1.2 public/bcms/ckeditor/core/command.js
browsercms-3.1.1 public/bcms/ckeditor/core/command.js
browsercmsi-3.1.1 public/bcms/ckeditor/core/command.js
browsercmsi-3.1.0 public/bcms/ckeditor/core/command.js
browsercms-3.1.0 public/bcms/ckeditor/core/command.js
bcms_fckeditor-1.0.1 public/bcms/ckeditor/core/command.js