cmc-sales/webroot/js/ckeditor/_source/plugins/table/plugin.js

79 lines
1.8 KiB
JavaScript
Raw Normal View History

2009-10-10 00:15:12 -07:00
/*
2011-05-16 20:19:32 -07:00
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
2009-10-10 00:15:12 -07:00
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'table',
{
init : function( editor )
{
var table = CKEDITOR.plugins.table,
lang = editor.lang.table;
editor.addCommand( 'table', new CKEDITOR.dialogCommand( 'table' ) );
editor.addCommand( 'tableProperties', new CKEDITOR.dialogCommand( 'tableProperties' ) );
editor.ui.addButton( 'Table',
{
label : lang.toolbar,
command : 'table'
});
CKEDITOR.dialog.add( 'table', this.path + 'dialogs/table.js' );
CKEDITOR.dialog.add( 'tableProperties', this.path + 'dialogs/table.js' );
// If the "menu" plugin is loaded, register the menu items.
if ( editor.addMenuItems )
{
editor.addMenuItems(
{
table :
{
label : lang.menu,
command : 'tableProperties',
group : 'table',
order : 5
},
tabledelete :
{
label : lang.deleteTable,
command : 'tableDelete',
group : 'table',
order : 1
}
} );
}
2011-05-16 20:19:32 -07:00
editor.on( 'doubleclick', function( evt )
{
var element = evt.data.element;
if ( element.is( 'table' ) )
evt.data.dialog = 'tableProperties';
});
2009-10-10 00:15:12 -07:00
// If the "contextmenu" plugin is loaded, register the listeners.
if ( editor.contextMenu )
{
editor.contextMenu.addListener( function( element, selection )
{
2011-05-16 20:19:32 -07:00
if ( !element || element.isReadOnly() )
2009-10-10 00:15:12 -07:00
return null;
2011-05-16 20:19:32 -07:00
var isTable = element.hasAscendant( 'table', 1 );
2009-10-10 00:15:12 -07:00
if ( isTable )
{
return {
tabledelete : CKEDITOR.TRISTATE_OFF,
table : CKEDITOR.TRISTATE_OFF
};
}
return null;
} );
}
}
} );