LBF custom template (nation notes) fancybox replace.
[openemr.git] / library / custom_template / ckeditor / _source / plugins / table / plugin.js
blobde280381b968f9e6e51a2a3b32ab8c6146befacc
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
6 CKEDITOR.plugins.add( 'table',
8         init : function( editor )
9         {
10                 var table = CKEDITOR.plugins.table,
11                         lang = editor.lang.table;
13                 editor.addCommand( 'table', new CKEDITOR.dialogCommand( 'table' ) );
14                 editor.addCommand( 'tableProperties', new CKEDITOR.dialogCommand( 'tableProperties' ) );
16                 editor.ui.addButton( 'Table',
17                         {
18                                 label : lang.toolbar,
19                                 command : 'table'
20                         });
22                 CKEDITOR.dialog.add( 'table', this.path + 'dialogs/table.js' );
23                 CKEDITOR.dialog.add( 'tableProperties', this.path + 'dialogs/table.js' );
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                                         },
38                                         tabledelete :
39                                         {
40                                                 label : lang.deleteTable,
41                                                 command : 'tableDelete',
42                                                 group : 'table',
43                                                 order : 1
44                                         }
45                                 } );
46                 }
48                 editor.on( 'doubleclick', function( evt )
49                         {
50                                 var element = evt.data.element;
52                                 if ( element.is( 'table' ) )
53                                         evt.data.dialog = 'tableProperties';
54                         });
56                 // If the "contextmenu" plugin is loaded, register the listeners.
57                 if ( editor.contextMenu )
58                 {
59                         editor.contextMenu.addListener( function( element, selection )
60                                 {
61                                         if ( !element || element.isReadOnly() )
62                                                 return null;
64                                         var isTable = element.hasAscendant( 'table', 1 );
66                                         if ( isTable )
67                                         {
68                                                 return {
69                                                         tabledelete : CKEDITOR.TRISTATE_OFF,
70                                                         table : CKEDITOR.TRISTATE_OFF
71                                                 };
72                                         }
74                                         return null;
75                                 } );
76                 }
77         }
78 } );