[6779] | 1 | /*
|
---|
| 2 | Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
|
---|
| 3 | For licensing, see LICENSE.html or http://ckeditor.com/license
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | CKEDITOR.plugins.add( 'table',
|
---|
| 7 | {
|
---|
| 8 | init : function( editor )
|
---|
| 9 | {
|
---|
| 10 | var table = CKEDITOR.plugins.table,
|
---|
| 11 | lang = editor.lang.table;
|
---|
| 12 |
|
---|
| 13 | editor.addCommand( 'table', new CKEDITOR.dialogCommand( 'table' ) );
|
---|
| 14 | editor.addCommand( 'tableProperties', new CKEDITOR.dialogCommand( 'tableProperties' ) );
|
---|
| 15 |
|
---|
| 16 | editor.ui.addButton( 'Table',
|
---|
| 17 | {
|
---|
| 18 | label : lang.toolbar,
|
---|
| 19 | command : 'table'
|
---|
| 20 | });
|
---|
| 21 |
|
---|
| 22 | CKEDITOR.dialog.add( 'table', this.path + 'dialogs/table.js' );
|
---|
| 23 | CKEDITOR.dialog.add( 'tableProperties', this.path + 'dialogs/table.js' );
|
---|
| 24 |
|
---|
| 25 | // If the "menu" plugin is loaded, register the menu items.
|
---|
| 26 | if ( editor.addMenuItems )
|
---|
| 27 | {
|
---|
| 28 | editor.addMenuItems(
|
---|
| 29 | {
|
---|
| 30 | table :
|
---|
| 31 | {
|
---|
| 32 | label : lang.menu,
|
---|
| 33 | command : 'tableProperties',
|
---|
| 34 | group : 'table',
|
---|
| 35 | order : 5
|
---|
| 36 | },
|
---|
| 37 |
|
---|
| 38 | tabledelete :
|
---|
| 39 | {
|
---|
| 40 | label : lang.deleteTable,
|
---|
| 41 | command : 'tableDelete',
|
---|
| 42 | group : 'table',
|
---|
| 43 | order : 1
|
---|
| 44 | }
|
---|
| 45 | } );
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | // If the "contextmenu" plugin is loaded, register the listeners.
|
---|
| 49 | if ( editor.contextMenu )
|
---|
| 50 | {
|
---|
| 51 | editor.contextMenu.addListener( function( element, selection )
|
---|
| 52 | {
|
---|
| 53 | if ( !element )
|
---|
| 54 | return null;
|
---|
| 55 |
|
---|
| 56 | var isTable = element.is( 'table' ) || element.hasAscendant( 'table' );
|
---|
| 57 |
|
---|
| 58 | if ( isTable )
|
---|
| 59 | {
|
---|
| 60 | return {
|
---|
| 61 | tabledelete : CKEDITOR.TRISTATE_OFF,
|
---|
| 62 | table : CKEDITOR.TRISTATE_OFF
|
---|
| 63 | };
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | return null;
|
---|
| 67 | } );
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 | } );
|
---|