Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
ckeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vanilla ckeditor-3.1.1
[ckeditor.git]
/
_source
/
plugins
/
menu
/
plugin.js
diff --git
a/_source/plugins/menu/plugin.js
b/_source/plugins/menu/plugin.js
index
f65d5db
..
ed91d1c
100644
(file)
--- a/
_source/plugins/menu/plugin.js
+++ b/
_source/plugins/menu/plugin.js
@@
-1,5
+1,5
@@
/*
\r
/*
\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
*/
\r
\r
For licensing, see LICENSE.html or http://ckeditor.com/license
\r
*/
\r
\r
@@
-8,43
+8,38
@@
CKEDITOR.plugins.add( 'menu',
beforeInit : function( editor )
\r
{
\r
var groups = editor.config.menu_groups.split( ',' ),
\r
beforeInit : function( editor )
\r
{
\r
var groups = editor.config.menu_groups.split( ',' ),
\r
- groupsOrder = {};
\r
+ groupsOrder = editor._.menuGroups = {},
\r
+ menuItems = editor._.menuItems = {};
\r
\r
for ( var i = 0 ; i < groups.length ; i++ )
\r
groupsOrder[ groups[ i ] ] = i + 1;
\r
\r
\r
for ( var i = 0 ; i < groups.length ; i++ )
\r
groupsOrder[ groups[ i ] ] = i + 1;
\r
\r
- editor._.menuGroups = groupsOrder;
\r
- editor._.menuItems = {};
\r
- },
\r
-
\r
- requires : [ 'floatpanel' ]
\r
-});
\r
+ editor.addMenuGroup = function( name, order )
\r
+ {
\r
+ groupsOrder[ name ] = order || 100;
\r
+ };
\r
\r
\r
-CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
\r
-{
\r
- addMenuGroup : function( name, order )
\r
- {
\r
- this._.menuGroups[ name ] = order || 100;
\r
- },
\r
+ editor.addMenuItem = function( name, definition )
\r
+ {
\r
+ if ( groupsOrder[ definition.group ] )
\r
+ menuItems[ name ] = new CKEDITOR.menuItem( this, name, definition );
\r
+ };
\r
\r
\r
- addMenuItem : function( name, definition )
\r
- {
\r
- if ( this._.menuGroups[ definition.group ] )
\r
- this._.menuItems[ name ] = new CKEDITOR.menuItem( this, name, definition );
\r
- },
\r
+ editor.addMenuItems = function( definitions )
\r
+ {
\r
+ for ( var itemName in definitions )
\r
+ {
\r
+ this.addMenuItem( itemName, definitions[ itemName ] );
\r
+ }
\r
+ };
\r
\r
\r
- addMenuItems : function( definitions )
\r
- {
\r
- for ( var itemName in definitions )
\r
- {
\r
- this.addMenuItem( itemName, definitions[ itemName ] );
\r
- }
\r
+ editor.getMenuItem = function( name )
\r
+ {
\r
+ return menuItems[ name ];
\r
+ };
\r
},
\r
\r
},
\r
\r
- getMenuItem : function( name )
\r
- {
\r
- return this._.menuItems[ name ];
\r
- }
\r
+ requires : [ 'floatpanel' ]
\r
});
\r
\r
(function()
\r
});
\r
\r
(function()
\r
@@
-67,11
+62,11
@@
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
{
\r
var menu = this._.subMenu,
\r
item = this.items[ index ],
\r
{
\r
var menu = this._.subMenu,
\r
item = this.items[ index ],
\r
- subItems = item.getItems && item.getItems();
\r
+ subItemDefs = item.getItems && item.getItems();
\r
\r
// If this item has no subitems, we just hide the submenu, if
\r
// available, and return back.
\r
\r
// If this item has no subitems, we just hide the submenu, if
\r
// available, and return back.
\r
- if ( !subItems )
\r
+ if ( !subItemDefs )
\r
{
\r
this._.panel.hideChild();
\r
return;
\r
{
\r
this._.panel.hideChild();
\r
return;
\r
@@
-89,9
+84,14
@@
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
}
\r
\r
// Add all submenu items to the menu.
\r
}
\r
\r
// Add all submenu items to the menu.
\r
- for ( var itemName in subItems )
\r
+ for ( var subItemName in subItemDefs )
\r
{
\r
{
\r
- menu.add( this.editor.getMenuItem( itemName ) );
\r
+ var subItem = this.editor.getMenuItem( subItemName );
\r
+ if ( subItem )
\r
+ {
\r
+ subItem.state = subItemDefs[ subItemName ];
\r
+ menu.add( subItem );
\r
+ }
\r
}
\r
\r
// Get the element representing the current item.
\r
}
\r
\r
// Get the element representing the current item.
\r
@@
-132,7
+132,7
@@
CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
{
\r
panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor, CKEDITOR.document.getBody(),
\r
{
\r
{
\r
panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor, CKEDITOR.document.getBody(),
\r
{
\r
- css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],
\r
+ css : editor.skin.editor.css,
\r
level : this._.level - 1,
\r
className : editor.skinClass + ' cke_contextmenu'
\r
},
\r
level : this._.level - 1,
\r
className : editor.skinClass + ' cke_contextmenu'
\r
},
\r
@@
-338,7
+338,13
@@
CKEDITOR.menuItem = CKEDITOR.tools.createClass(
if ( this.getItems )
\r
{
\r
output.push(
\r
if ( this.getItems )
\r
{
\r
output.push(
\r
- '<span class="cke_menuarrow"></span>' );
\r
+ '<span class="cke_menuarrow">',
\r
+ '<span>&#',
\r
+ ( this.editor.lang.dir == 'rtl' ?
\r
+ '9668' : // BLACK LEFT-POINTING POINTER
\r
+ '9658' ), // BLACK RIGHT-POINTING POINTER
\r
+ ';</span>',
\r
+ '</span>' );
\r
}
\r
\r
output.push(
\r
}
\r
\r
output.push(
\r
@@
-376,4
+382,4
@@
CKEDITOR.config.menu_groups =
'form,' +
\r
'tablecell,tablecellproperties,tablerow,tablecolumn,table,'+
\r
'anchor,link,image,flash,' +
\r
'form,' +
\r
'tablecell,tablecellproperties,tablerow,tablecolumn,table,'+
\r
'anchor,link,image,flash,' +
\r
- 'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea';
\r
+ 'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';
\r