Sha256: 5032aa7868839b10db52487bae39d114bd1a2e86a5f057a802461289bf5e5e40

Contents?: true

Size: 1.75 KB

Versions: 27

Compression:

Stored size: 1.75 KB

Contents

/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

CKEDITOR.command = function( editor, commandDefinition )
{
	this.uiItems = [];

	this.exec = function( data )
	{
		if ( this.state == CKEDITOR.TRISTATE_DISABLED )
			return false;

		if ( this.editorFocus )     // Give editor focus if necessary (#4355).
			editor.focus();

		return ( commandDefinition.exec.call( this, editor, data ) !== false );
	};

	CKEDITOR.tools.extend( this, commandDefinition,
		// Defaults
		{
			modes : { wysiwyg : 1 },
			editorFocus : true,
			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

27 entries across 27 versions & 3 rubygems

Version Path
forge-cli-0.1.1 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.1.0 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.18 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.17 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.16 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.15 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.14 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.13 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.12 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.11 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.10 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.9 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.8 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.7 lib/forge/public/javascripts/ckeditor/_source/core/command.js
forge-cli-0.0.6 lib/forge/public/javascripts/ckeditor/_source/core/command.js
radiant-ck_editor_filter-extension-0.2.0 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/core/command.js
radiant-ck_editor_filter-extension-0.1.1 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/core/command.js
ckeditor-3.4.2.pre lib/generators/ckeditor/base/templates/ckeditor/_source/core/command.js
ckeditor-3.4.2 generators/ckeditor_install/templates/ckeditor/_source/core/command.js
ckeditor-3.4.1.pre lib/generators/ckeditor/base/templates/ckeditor/_source/core/command.js