Sha256: 9c6ab1df519b254c9b124ac50bc92f5a0a80b365236125709c96c3336b8b0e4c

Contents?: true

Size: 1.75 KB

Versions: 2

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.plugins.add( 'menubutton',
{
	requires : [ 'button', 'contextmenu' ],
	beforeInit : function( editor )
	{
		editor.ui.addHandler( CKEDITOR.UI_MENUBUTTON, CKEDITOR.ui.menuButton.handler );
	}
});

/**
 * Button UI element.
 * @constant
 * @example
 */
CKEDITOR.UI_MENUBUTTON = 5;

(function()
{
	var clickFn = function( editor )
	{
		var _ = this._;

		// Do nothing if this button is disabled.
		if ( _.state === CKEDITOR.TRISTATE_DISABLED )
			return;

		_.previousState = _.state;

		// Check if we already have a menu for it, otherwise just create it.
		var menu = _.menu;
		if ( !menu )
		{
			menu = _.menu = new CKEDITOR.plugins.contextMenu( editor );

			menu.onHide = CKEDITOR.tools.bind( function()
				{
					this.setState( _.previousState );
				},
				this );

			// Initialize the menu items at this point.
			if ( this.onMenu )
			{
				menu.addListener( this.onMenu );
			}
		}

		if ( _.on )
		{
			menu.hide();
			return;
		}

		this.setState( CKEDITOR.TRISTATE_ON );

		menu.show( CKEDITOR.document.getById( this._.id ), 4 );
	};


	CKEDITOR.ui.menuButton = CKEDITOR.tools.createClass(
	{
		base : CKEDITOR.ui.button,

		$ : function( definition )
		{
			// We don't want the panel definition in this object.
			var panelDefinition = definition.panel;
			delete definition.panel;

			this.base( definition );

			this.hasArrow = true;

			this.click = clickFn;
		},

		statics :
		{
			handler :
			{
				create : function( definition )
				{
					return new CKEDITOR.ui.menuButton( definition );
				}
			}
		}
	});
})();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-ck_editor_filter-extension-0.2.0 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/plugins/menubutton/plugin.js
radiant-ck_editor_filter-extension-0.1.1 public/javascripts/extensions/ck_editor_filter/ckeditor/_source/plugins/menubutton/plugin.js