]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/plugins/table/plugin.js
2 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
6 CKEDITOR
.plugins
.add( 'table', {
8 // jscs:disable maximumLineLength
9 lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
10 // jscs:enable maximumLineLength
11 icons: 'table', // %REMOVE_LINE_CORE%
12 hidpi: true, // %REMOVE_LINE_CORE%
13 init: function( editor
) {
14 if ( editor
.blockless
)
17 var lang
= editor
.lang
.table
;
19 editor
.addCommand( 'table', new CKEDITOR
.dialogCommand( 'table', {
21 allowedContent: 'table{width,height}[align,border,cellpadding,cellspacing,summary];' +
22 'caption tbody thead tfoot;' +
24 ( editor
.plugins
.dialogadvtab
? 'table' + editor
.plugins
.dialogadvtab
.allowedContent() : '' ),
25 requiredContent: 'table',
26 contentTransformations: [
27 [ 'table{width}: sizeToStyle', 'table[width]: sizeToAttribute' ]
31 function createDef( def
) {
32 return CKEDITOR
.tools
.extend( def
|| {}, {
34 refresh: function( editor
, path
) {
35 this.setState( path
.contains( 'table', 1 ) ? CKEDITOR
.TRISTATE_OFF : CKEDITOR
.TRISTATE_DISABLED
);
40 editor
.addCommand( 'tableProperties', new CKEDITOR
.dialogCommand( 'tableProperties', createDef() ) );
41 editor
.addCommand( 'tableDelete', createDef( {
42 exec: function( editor
) {
43 var path
= editor
.elementPath(),
44 table
= path
.contains( 'table', 1 );
49 // If the table's parent has only one child remove it as well (unless it's a table cell, or the editable element) (#5416, #6289, #12110)
50 var parent
= table
.getParent(),
51 editable
= editor
.editable();
53 if ( parent
.getChildCount() == 1 && !parent
.is( 'td', 'th' ) && !parent
.equals( editable
) )
56 var range
= editor
.createRange();
57 range
.moveToPosition( table
, CKEDITOR
.POSITION_BEFORE_START
);
63 editor
.ui
.addButton
&& editor
.ui
.addButton( 'Table', {
69 CKEDITOR
.dialog
.add( 'table', this.path
+ 'dialogs/table.js' );
70 CKEDITOR
.dialog
.add( 'tableProperties', this.path
+ 'dialogs/table.js' );
72 // If the "menu" plugin is loaded, register the menu items.
73 if ( editor
.addMenuItems
) {
74 editor
.addMenuItems( {
77 command: 'tableProperties',
83 label: lang
.deleteTable
,
84 command: 'tableDelete',
91 editor
.on( 'doubleclick', function( evt
) {
92 var element
= evt
.data
.element
;
94 if ( element
.is( 'table' ) )
95 evt
.data
.dialog
= 'tableProperties';
98 // If the "contextmenu" plugin is loaded, register the listeners.
99 if ( editor
.contextMenu
) {
100 editor
.contextMenu
.addListener( function() {
101 // menu item state is resolved on commands.
103 tabledelete: CKEDITOR
.TRISTATE_OFF
,
104 table: CKEDITOR
.TRISTATE_OFF