ckeditor/_source/plugins/menu/plugin.js

(开头部分) 15KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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

CKEDITOR.plugins.add( 'menu',
{
	beforeInit : function( editor )
	{
		var groups = editor.config.menu_groups.split( ',' ),
			groupsOrder = editor._.menuGroups = {},
			menuItems = editor._.menuItems = {};

		for ( var i = 0 ; i < groups.length ; i++ )
			groupsOrder[ groups[ i ] ] = i + 1;

		/**
		 * Registers an item group to the editor context menu in order to make it
		 * possible to associate it with menu items later.
		 * @name CKEDITOR.editor.prototype.addMenuGroup
		 * @param {String} name Specify a group name.
		 * @param {Number} [order=100] Define the display sequence of this group
		 *  	inside the menu. A smaller value gets displayed first.
		 */
		editor.addMenuGroup = function( name, order )
			{
				groupsOrder[ name ] = order || 100;
			};

		/**
		 * Adds an item from the specified definition to the editor context menu.
		 * @name CKEDITOR.editor.prototype.addMenuItem
		 * @param {String} name The menu item name.
		 * @param {CKEDITOR.menu.definition} definition The menu item definition.
		 */
		editor.addMenuItem = function( name, definition )
			{
				if ( groupsOrder[ definition.group ] )
					menuItems[ name ] = new CKEDITOR.menuItem( this, name, definition );
			};

		/**
		 * Adds one or more items from the specified definition array to the editor context menu.
		 * @name CKEDITOR.editor.prototype.addMenuItems
		 * @param {Array} definitions List of definitions for each menu item as if {@link CKEDITOR.editor.addMenuItem} is called.
		 */
		editor.addMenuItems = function( definitions )
			{
				for ( var itemName in definitions )
				{
					this.addMenuItem( itemName, definitions[ itemName ] );
				}
			};

		/**
		 * Retrieves a particular menu item definition from the editor context menu.
		 * @name CKEDITOR.editor.prototype.getMenuItem
		 * @param {String} name The name of the desired menu item.
		 * @return {CKEDITOR.menu.definition}
		 */
后面还有 481 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。