2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
8 function removeRawAttribute( $node, attr )
\r
10 if ( CKEDITOR.env.ie )
\r
11 $node.removeAttribute( attr );
\r
13 delete $node[ attr ];
\r
16 var cellNodeRegex = /^(?:td|th)$/;
\r
18 function getSelectedCells( selection )
\r
20 // Walker will try to split text nodes, which will make the current selection
\r
21 // invalid. So save bookmarks before doing anything.
\r
22 var bookmarks = selection.createBookmarks();
\r
24 var ranges = selection.getRanges();
\r
28 function moveOutOfCellGuard( node )
\r
30 // Apply to the first cell only.
\r
31 if ( retval.length > 0 )
\r
34 // If we are exiting from the first </td>, then the td should definitely be
\r
36 if ( node.type == CKEDITOR.NODE_ELEMENT && cellNodeRegex.test( node.getName() )
\r
37 && !node.getCustomData( 'selected_cell' ) )
\r
39 CKEDITOR.dom.element.setMarker( database, node, 'selected_cell', true );
\r
40 retval.push( node );
\r
44 for ( var i = 0 ; i < ranges.length ; i++ )
\r
46 var range = ranges[ i ];
\r
48 if ( range.collapsed )
\r
50 // Walker does not handle collapsed ranges yet - fall back to old API.
\r
51 var startNode = range.getCommonAncestor();
\r
52 var nearestCell = startNode.getAscendant( 'td', true ) || startNode.getAscendant( 'th', true );
\r
54 retval.push( nearestCell );
\r
58 var walker = new CKEDITOR.dom.walker( range );
\r
60 walker.guard = moveOutOfCellGuard;
\r
62 while ( ( node = walker.next() ) )
\r
64 // If may be possible for us to have a range like this:
\r
65 // <td>^1</td><td>^2</td>
\r
66 // The 2nd td shouldn't be included.
\r
68 // So we have to take care to include a td we've entered only when we've
\r
69 // walked into its children.
\r
71 var parent = node.getParent();
\r
72 if ( parent && cellNodeRegex.test( parent.getName() ) && !parent.getCustomData( 'selected_cell' ) )
\r
74 CKEDITOR.dom.element.setMarker( database, parent, 'selected_cell', true );
\r
75 retval.push( parent );
\r
81 CKEDITOR.dom.element.clearAllMarkers( database );
\r
83 // Restore selection position.
\r
84 selection.selectBookmarks( bookmarks );
\r
89 function clearRow( $tr )
\r
91 // Get the array of row's cells.
\r
92 var $cells = $tr.cells;
\r
95 for ( var i = 0 ; i < $cells.length ; i++ )
\r
97 $cells[ i ].innerHTML = '';
\r
99 if ( !CKEDITOR.env.ie )
\r
100 ( new CKEDITOR.dom.element( $cells[ i ] ) ).appendBogus();
\r
104 function insertRow( selection, insertBefore )
\r
106 // Get the row where the selection is placed in.
\r
107 var row = selection.getStartElement().getAscendant( 'tr' );
\r
111 // Create a clone of the row.
\r
112 var newRow = row.clone( true );
\r
114 // Insert the new row before of it.
\r
115 newRow.insertBefore( row );
\r
117 // Clean one of the rows to produce the illusion of inserting an empty row
\r
118 // before or after.
\r
119 clearRow( insertBefore ? newRow.$ : row.$ );
\r
122 function deleteRows( selectionOrRow )
\r
124 if ( selectionOrRow instanceof CKEDITOR.dom.selection )
\r
126 var cells = getSelectedCells( selectionOrRow );
\r
127 var rowsToDelete = [];
\r
129 // Queue up the rows - it's possible and likely that we have duplicates.
\r
130 for ( var i = 0 ; i < cells.length ; i++ )
\r
132 var row = cells[ i ].getParent();
\r
133 rowsToDelete[ row.$.rowIndex ] = row;
\r
136 for ( i = rowsToDelete.length ; i >= 0 ; i-- )
\r
138 if ( rowsToDelete[ i ] )
\r
139 deleteRows( rowsToDelete[ i ] );
\r
142 else if ( selectionOrRow instanceof CKEDITOR.dom.element )
\r
144 var table = selectionOrRow.getAscendant( 'table' );
\r
146 if ( table.$.rows.length == 1 )
\r
149 selectionOrRow.remove();
\r
153 function insertColumn( selection, insertBefore )
\r
155 // Get the cell where the selection is placed in.
\r
156 var startElement = selection.getStartElement();
\r
157 var cell = startElement.getAscendant( 'td', true ) || startElement.getAscendant( 'th', true );
\r
162 // Get the cell's table.
\r
163 var table = cell.getAscendant( 'table' );
\r
164 var cellIndex = cell.$.cellIndex;
\r
166 // Loop through all rows available in the table.
\r
167 for ( var i = 0 ; i < table.$.rows.length ; i++ )
\r
169 var $row = table.$.rows[ i ];
\r
171 // If the row doesn't have enough cells, ignore it.
\r
172 if ( $row.cells.length < ( cellIndex + 1 ) )
\r
175 cell = new CKEDITOR.dom.element( $row.cells[ cellIndex ].cloneNode( false ) );
\r
177 if ( !CKEDITOR.env.ie )
\r
178 cell.appendBogus();
\r
180 // Get back the currently selected cell.
\r
181 var baseCell = new CKEDITOR.dom.element( $row.cells[ cellIndex ] );
\r
182 if ( insertBefore )
\r
183 cell.insertBefore( baseCell );
\r
185 cell.insertAfter( baseCell );
\r
189 function deleteColumns( selectionOrCell )
\r
191 if ( selectionOrCell instanceof CKEDITOR.dom.selection )
\r
193 var colsToDelete = getSelectedCells( selectionOrCell );
\r
194 for ( var i = colsToDelete.length ; i >= 0 ; i-- )
\r
196 if ( colsToDelete[ i ] )
\r
197 deleteColumns( colsToDelete[ i ] );
\r
200 else if ( selectionOrCell instanceof CKEDITOR.dom.element )
\r
202 // Get the cell's table.
\r
203 var table = selectionOrCell.getAscendant( 'table' );
\r
205 // Get the cell index.
\r
206 var cellIndex = selectionOrCell.$.cellIndex;
\r
209 * Loop through all rows from down to up, coz it's possible that some rows
\r
212 for ( i = table.$.rows.length - 1 ; i >= 0 ; i-- )
\r
215 var row = new CKEDITOR.dom.element( table.$.rows[ i ] );
\r
217 // If the cell to be removed is the first one and the row has just one cell.
\r
218 if ( !cellIndex && row.$.cells.length == 1 )
\r
224 // Else, just delete the cell.
\r
225 if ( row.$.cells[ cellIndex ] )
\r
226 row.$.removeChild( row.$.cells[ cellIndex ] );
\r
231 function insertCell( selection, insertBefore )
\r
233 var startElement = selection.getStartElement();
\r
234 var cell = startElement.getAscendant( 'td', true ) || startElement.getAscendant( 'th', true );
\r
239 // Create the new cell element to be added.
\r
240 var newCell = cell.clone();
\r
241 if ( !CKEDITOR.env.ie )
\r
242 newCell.appendBogus();
\r
244 if ( insertBefore )
\r
245 newCell.insertBefore( cell );
\r
247 newCell.insertAfter( cell );
\r
250 function deleteCells( selectionOrCell )
\r
252 if ( selectionOrCell instanceof CKEDITOR.dom.selection )
\r
254 var cellsToDelete = getSelectedCells( selectionOrCell );
\r
255 for ( var i = cellsToDelete.length - 1 ; i >= 0 ; i-- )
\r
256 deleteCells( cellsToDelete[ i ] );
\r
258 else if ( selectionOrCell instanceof CKEDITOR.dom.element )
\r
260 if ( selectionOrCell.getParent().getChildCount() == 1 )
\r
261 selectionOrCell.getParent().remove();
\r
263 selectionOrCell.remove();
\r
267 // Remove filler at end and empty spaces around the cell content.
\r
268 function trimCell( cell )
\r
270 var bogus = cell.getBogus();
\r
271 bogus && bogus.remove();
\r
275 function placeCursorInCell( cell, placeAtEnd )
\r
277 var range = new CKEDITOR.dom.range( cell.getDocument() );
\r
278 if ( !range[ 'moveToElementEdit' + ( placeAtEnd ? 'End' : 'Start' ) ]( cell ) )
\r
280 range.selectNodeContents( cell );
\r
281 range.collapse( placeAtEnd ? false : true );
\r
283 range.select( true );
\r
286 function buildTableMap( table )
\r
289 var aRows = table.$.rows ;
\r
291 // Row and Column counters.
\r
296 for ( var i = 0 ; i < aRows.length ; i++ )
\r
299 !aMap[r] && ( aMap[r] = [] );
\r
303 for ( var j = 0 ; j < aRows[i].cells.length ; j++ )
\r
305 var oCell = aRows[i].cells[j] ;
\r
308 while ( aMap[r][c] )
\r
311 var iColSpan = isNaN( oCell.colSpan ) ? 1 : oCell.colSpan ;
\r
312 var iRowSpan = isNaN( oCell.rowSpan ) ? 1 : oCell.rowSpan ;
\r
314 for ( var rs = 0 ; rs < iRowSpan ; rs++ )
\r
316 if ( !aMap[r + rs] )
\r
317 aMap[r + rs] = new Array() ;
\r
319 for ( var cs = 0 ; cs < iColSpan ; cs++ )
\r
321 aMap[r + rs][c + cs] = aRows[i].cells[j] ;
\r
325 c += iColSpan - 1 ;
\r
331 function cellInRow( tableMap, rowIndex, cell )
\r
333 var oRow = tableMap[ rowIndex ];
\r
334 if( typeof cell == 'undefined' )
\r
337 for ( var c = 0 ; oRow && c < oRow.length ; c++ )
\r
339 if ( cell.is && oRow[c] == cell.$ )
\r
341 else if( c == cell )
\r
342 return new CKEDITOR.dom.element( oRow[ c ] );
\r
344 return cell.is ? -1 : null;
\r
347 function cellInCol( tableMap, colIndex, cell )
\r
350 for ( var r = 0; r < tableMap.length; r++ )
\r
352 var row = tableMap[ r ];
\r
353 if( typeof cell == 'undefined' )
\r
354 oCol.push( row[ colIndex ] );
\r
355 else if( cell.is && row[ colIndex ] == cell.$ )
\r
357 else if( r == cell )
\r
358 return new CKEDITOR.dom.element( row[ colIndex ] );
\r
361 return ( typeof cell == 'undefined' )? oCol : cell.is ? -1 : null;
\r
364 function mergeCells( selection, mergeDirection, isDetect )
\r
366 var cells = getSelectedCells( selection );
\r
368 // Invalid merge request if:
\r
369 // 1. In batch mode despite that less than two selected.
\r
370 // 2. In solo mode while not exactly only one selected.
\r
371 // 3. Cells distributed in different table groups (e.g. from both thead and tbody).
\r
372 var commonAncestor;
\r
373 if ( ( mergeDirection ? cells.length != 1 : cells.length < 2 )
\r
374 || ( commonAncestor = selection.getCommonAncestor() )
\r
375 && commonAncestor.type == CKEDITOR.NODE_ELEMENT
\r
376 && commonAncestor.is( 'table' ) )
\r
382 firstCell = cells[ 0 ],
\r
383 table = firstCell.getAscendant( 'table' ),
\r
384 map = buildTableMap( table ),
\r
385 mapHeight = map.length,
\r
386 mapWidth = map[ 0 ].length,
\r
387 startRow = firstCell.getParent().$.rowIndex,
\r
388 startColumn = cellInRow( map, startRow, firstCell );
\r
390 if( mergeDirection )
\r
396 map[ mergeDirection == 'up' ?
\r
398 mergeDirection == 'down' ? ( startRow + 1 ) : startRow ] [
\r
399 mergeDirection == 'left' ?
\r
400 ( startColumn - 1 ):
\r
401 mergeDirection == 'right' ? ( startColumn + 1 ) : startColumn ];
\r
409 // 1. No cell could be merged.
\r
410 // 2. Same cell actually.
\r
411 if( !targetCell || firstCell.$ == targetCell )
\r
414 // Sort in map order regardless of the DOM sequence.
\r
415 cells[ ( mergeDirection == 'up' || mergeDirection == 'left' ) ?
\r
416 'unshift' : 'push' ]( new CKEDITOR.dom.element( targetCell ) );
\r
419 // Start from here are merging way ignorance (merge up/right, batch merge).
\r
420 var doc = firstCell.getDocument(),
\r
421 lastRowIndex = startRow,
\r
424 // Use a documentFragment as buffer when appending cell contents.
\r
425 frag = !isDetect && new CKEDITOR.dom.documentFragment( doc ),
\r
428 for ( var i = 0; i < cells.length; i++ )
\r
432 var tr = cell.getParent(),
\r
433 cellFirstChild = cell.getFirst(),
\r
434 colSpan = cell.$.colSpan,
\r
435 rowSpan = cell.$.rowSpan,
\r
436 rowIndex = tr.$.rowIndex,
\r
437 colIndex = cellInRow( map, rowIndex, cell );
\r
439 // Accumulated the actual places taken by all selected cells.
\r
440 dimension += colSpan * rowSpan;
\r
441 // Accumulated the maximum virtual spans from column and row.
\r
442 totalColSpan = Math.max( totalColSpan, colIndex - startColumn + colSpan ) ;
\r
443 totalRowSpan = Math.max( totalRowSpan, rowIndex - startRow + rowSpan );
\r
447 // Trim all cell fillers and check to remove empty cells.
\r
448 if( trimCell( cell ), cell.getChildren().count() )
\r
450 // Merge vertically cells as two separated paragraphs.
\r
451 if( rowIndex != lastRowIndex
\r
453 && !( cellFirstChild.isBlockBoundary
\r
454 && cellFirstChild.isBlockBoundary( { br : 1 } ) ) )
\r
456 var last = frag.getLast( CKEDITOR.dom.walker.whitespaces( true ) );
\r
457 if( last && !( last.is && last.is( 'br' ) ) )
\r
458 frag.append( new CKEDITOR.dom.element( 'br' ) );
\r
461 cell.moveChildren( frag );
\r
463 i ? cell.remove() : cell.setHtml( '' );
\r
465 lastRowIndex = rowIndex;
\r
470 frag.moveChildren( firstCell );
\r
472 if( !CKEDITOR.env.ie )
\r
473 firstCell.appendBogus();
\r
475 if( totalColSpan >= mapWidth )
\r
476 firstCell.removeAttribute( 'rowSpan' );
\r
478 firstCell.$.rowSpan = totalRowSpan;
\r
480 if( totalRowSpan >= mapHeight )
\r
481 firstCell.removeAttribute( 'colSpan' );
\r
483 firstCell.$.colSpan = totalColSpan;
\r
485 // Swip empty <tr> left at the end of table due to the merging.
\r
486 var trs = new CKEDITOR.dom.nodeList( table.$.rows ),
\r
487 count = trs.count();
\r
489 for ( i = count - 1; i >= 0; i-- )
\r
491 var tailTr = trs.getItem( i );
\r
492 if( !tailTr.$.cells.length )
\r
502 // Be able to merge cells only if actual dimension of selected
\r
503 // cells equals to the caculated rectangle.
\r
505 return ( totalRowSpan * totalColSpan ) == dimension;
\r
508 function verticalSplitCell ( selection, isDetect )
\r
510 var cells = getSelectedCells( selection );
\r
511 if( cells.length > 1 )
\r
513 else if( isDetect )
\r
516 var cell = cells[ 0 ],
\r
517 tr = cell.getParent(),
\r
518 table = tr.getAscendant( 'table' ),
\r
519 map = buildTableMap( table ),
\r
520 rowIndex = tr.$.rowIndex,
\r
521 colIndex = cellInRow( map, rowIndex, cell ),
\r
522 rowSpan = cell.$.rowSpan,
\r
530 newRowSpan = Math.ceil( rowSpan / 2 );
\r
531 newCellRowSpan = Math.floor( rowSpan / 2 );
\r
532 newRowIndex = rowIndex + newRowSpan;
\r
533 var newCellTr = new CKEDITOR.dom.element( table.$.rows[ newRowIndex ] ),
\r
534 newCellRow = cellInRow( map, newRowIndex ),
\r
537 newCell = cell.clone();
\r
539 // Figure out where to insert the new cell by checking the vitual row.
\r
540 for ( var c = 0; c < newCellRow.length; c++ )
\r
542 candidateCell = newCellRow[ c ];
\r
543 // Catch first cell actually following the column.
\r
544 if( candidateCell.parentNode == newCellTr.$
\r
547 newCell.insertBefore( new CKEDITOR.dom.element( candidateCell ) );
\r
551 candidateCell = null;
\r
554 // The destination row is empty, append at will.
\r
555 if( !candidateCell )
\r
556 newCellTr.append( newCell, true );
\r
560 newCellRowSpan = newRowSpan = 1;
\r
562 newCellTr = tr.clone();
\r
563 newCellTr.insertAfter( tr );
\r
564 newCellTr.append( newCell = cell.clone() );
\r
566 var cellsInSameRow = cellInRow( map, rowIndex );
\r
567 for ( var i = 0; i < cellsInSameRow.length; i++ )
\r
568 cellsInSameRow[ i ].rowSpan++;
\r
571 if( !CKEDITOR.env.ie )
\r
572 newCell.appendBogus();
\r
574 cell.$.rowSpan = newRowSpan;
\r
575 newCell.$.rowSpan = newCellRowSpan;
\r
576 if( newRowSpan == 1 )
\r
577 cell.removeAttribute( 'rowSpan' );
\r
578 if( newCellRowSpan == 1 )
\r
579 newCell.removeAttribute( 'rowSpan' );
\r
584 function horizontalSplitCell( selection, isDetect )
\r
586 var cells = getSelectedCells( selection );
\r
587 if( cells.length > 1 )
\r
589 else if( isDetect )
\r
592 var cell = cells[ 0 ],
\r
593 tr = cell.getParent(),
\r
594 table = tr.getAscendant( 'table' ),
\r
595 map = buildTableMap( table ),
\r
596 rowIndex = tr.$.rowIndex,
\r
597 colIndex = cellInRow( map, rowIndex, cell ),
\r
598 colSpan = cell.$.colSpan,
\r
605 newColSpan = Math.ceil( colSpan / 2 );
\r
606 newCellColSpan = Math.floor( colSpan / 2 );
\r
610 newCellColSpan = newColSpan = 1;
\r
611 var cellsInSameCol = cellInCol( map, colIndex );
\r
612 for ( var i = 0; i < cellsInSameCol.length; i++ )
\r
613 cellsInSameCol[ i ].colSpan++;
\r
615 newCell = cell.clone();
\r
616 newCell.insertAfter( cell );
\r
617 if( !CKEDITOR.env.ie )
\r
618 newCell.appendBogus();
\r
620 cell.$.colSpan = newColSpan;
\r
621 newCell.$.colSpan = newCellColSpan;
\r
622 if( newColSpan == 1 )
\r
623 cell.removeAttribute( 'colSpan' );
\r
624 if( newCellColSpan == 1 )
\r
625 newCell.removeAttribute( 'colSpan' );
\r
629 // Context menu on table caption incorrect (#3834)
\r
630 var contextMenuTags = { thead : 1, tbody : 1, tfoot : 1, td : 1, tr : 1, th : 1 };
\r
632 CKEDITOR.plugins.tabletools =
\r
634 init : function( editor )
\r
636 var lang = editor.lang.table;
\r
638 editor.addCommand( 'cellProperties', new CKEDITOR.dialogCommand( 'cellProperties' ) );
\r
639 CKEDITOR.dialog.add( 'cellProperties', this.path + 'dialogs/tableCell.js' );
\r
641 editor.addCommand( 'tableDelete',
\r
643 exec : function( editor )
\r
645 var selection = editor.getSelection();
\r
646 var startElement = selection && selection.getStartElement();
\r
647 var table = startElement && startElement.getAscendant( 'table', true );
\r
652 // Maintain the selection point at where the table was deleted.
\r
653 selection.selectElement( table );
\r
654 var range = selection.getRanges()[0];
\r
656 selection.selectRanges( [ range ] );
\r
658 // If the table's parent has only one child, remove it as well.
\r
659 if ( table.getParent().getChildCount() == 1 )
\r
660 table.getParent().remove();
\r
666 editor.addCommand( 'rowDelete',
\r
668 exec : function( editor )
\r
670 var selection = editor.getSelection();
\r
671 deleteRows( selection );
\r
675 editor.addCommand( 'rowInsertBefore',
\r
677 exec : function( editor )
\r
679 var selection = editor.getSelection();
\r
680 insertRow( selection, true );
\r
684 editor.addCommand( 'rowInsertAfter',
\r
686 exec : function( editor )
\r
688 var selection = editor.getSelection();
\r
689 insertRow( selection );
\r
693 editor.addCommand( 'columnDelete',
\r
695 exec : function( editor )
\r
697 var selection = editor.getSelection();
\r
698 deleteColumns( selection );
\r
702 editor.addCommand( 'columnInsertBefore',
\r
704 exec : function( editor )
\r
706 var selection = editor.getSelection();
\r
707 insertColumn( selection, true );
\r
711 editor.addCommand( 'columnInsertAfter',
\r
713 exec : function( editor )
\r
715 var selection = editor.getSelection();
\r
716 insertColumn( selection );
\r
720 editor.addCommand( 'cellDelete',
\r
722 exec : function( editor )
\r
724 var selection = editor.getSelection();
\r
725 deleteCells( selection );
\r
729 editor.addCommand( 'cellMerge',
\r
731 exec : function( editor )
\r
733 placeCursorInCell( mergeCells( editor.getSelection() ), true );
\r
737 editor.addCommand( 'cellMergeRight',
\r
739 exec : function( editor )
\r
741 placeCursorInCell( mergeCells( editor.getSelection(), 'right' ), true );
\r
745 editor.addCommand( 'cellMergeDown',
\r
747 exec : function( editor )
\r
749 placeCursorInCell( mergeCells( editor.getSelection(), 'down' ), true );
\r
753 editor.addCommand( 'cellVerticalSplit',
\r
755 exec : function( editor )
\r
757 placeCursorInCell( verticalSplitCell( editor.getSelection() ) );
\r
761 editor.addCommand( 'cellHorizontalSplit',
\r
763 exec : function( editor )
\r
765 placeCursorInCell( horizontalSplitCell( editor.getSelection() ) );
\r
769 editor.addCommand( 'cellInsertBefore',
\r
771 exec : function( editor )
\r
773 var selection = editor.getSelection();
\r
774 insertCell( selection, true );
\r
778 editor.addCommand( 'cellInsertAfter',
\r
780 exec : function( editor )
\r
782 var selection = editor.getSelection();
\r
783 insertCell( selection );
\r
787 // If the "menu" plugin is loaded, register the menu items.
\r
788 if ( editor.addMenuItems )
\r
790 editor.addMenuItems(
\r
794 label : lang.cell.menu,
\r
795 group : 'tablecell',
\r
797 getItems : function()
\r
799 var selection = editor.getSelection(),
\r
800 cells = getSelectedCells( selection );
\r
802 tablecell_insertBefore : CKEDITOR.TRISTATE_OFF,
\r
803 tablecell_insertAfter : CKEDITOR.TRISTATE_OFF,
\r
804 tablecell_delete : CKEDITOR.TRISTATE_OFF,
\r
805 tablecell_merge : mergeCells( selection, null, true ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
806 tablecell_merge_right : mergeCells( selection, 'right', true ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
807 tablecell_merge_down : mergeCells( selection, 'down', true ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
808 tablecell_split_vertical : verticalSplitCell( selection, true ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
809 tablecell_split_horizontal : horizontalSplitCell( selection, true ) ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
810 tablecell_properties : cells.length > 0 ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
\r
815 tablecell_insertBefore :
\r
817 label : lang.cell.insertBefore,
\r
818 group : 'tablecell',
\r
819 command : 'cellInsertBefore',
\r
823 tablecell_insertAfter :
\r
825 label : lang.cell.insertAfter,
\r
826 group : 'tablecell',
\r
827 command : 'cellInsertAfter',
\r
833 label : lang.cell.deleteCell,
\r
834 group : 'tablecell',
\r
835 command : 'cellDelete',
\r
841 label : lang.cell.merge,
\r
842 group : 'tablecell',
\r
843 command : 'cellMerge',
\r
847 tablecell_merge_right :
\r
849 label : lang.cell.mergeRight,
\r
850 group : 'tablecell',
\r
851 command : 'cellMergeRight',
\r
855 tablecell_merge_down :
\r
857 label : lang.cell.mergeDown,
\r
858 group : 'tablecell',
\r
859 command : 'cellMergeDown',
\r
863 tablecell_split_horizontal :
\r
865 label : lang.cell.splitHorizontal,
\r
866 group : 'tablecell',
\r
867 command : 'cellHorizontalSplit',
\r
871 tablecell_split_vertical :
\r
873 label : lang.cell.splitVertical,
\r
874 group : 'tablecell',
\r
875 command : 'cellVerticalSplit',
\r
879 tablecell_properties :
\r
881 label : lang.cell.title,
\r
882 group : 'tablecellproperties',
\r
883 command : 'cellProperties',
\r
889 label : lang.row.menu,
\r
890 group : 'tablerow',
\r
892 getItems : function()
\r
895 tablerow_insertBefore : CKEDITOR.TRISTATE_OFF,
\r
896 tablerow_insertAfter : CKEDITOR.TRISTATE_OFF,
\r
897 tablerow_delete : CKEDITOR.TRISTATE_OFF
\r
902 tablerow_insertBefore :
\r
904 label : lang.row.insertBefore,
\r
905 group : 'tablerow',
\r
906 command : 'rowInsertBefore',
\r
910 tablerow_insertAfter :
\r
912 label : lang.row.insertAfter,
\r
913 group : 'tablerow',
\r
914 command : 'rowInsertAfter',
\r
920 label : lang.row.deleteRow,
\r
921 group : 'tablerow',
\r
922 command : 'rowDelete',
\r
928 label : lang.column.menu,
\r
929 group : 'tablecolumn',
\r
931 getItems : function()
\r
934 tablecolumn_insertBefore : CKEDITOR.TRISTATE_OFF,
\r
935 tablecolumn_insertAfter : CKEDITOR.TRISTATE_OFF,
\r
936 tablecolumn_delete : CKEDITOR.TRISTATE_OFF
\r
941 tablecolumn_insertBefore :
\r
943 label : lang.column.insertBefore,
\r
944 group : 'tablecolumn',
\r
945 command : 'columnInsertBefore',
\r
949 tablecolumn_insertAfter :
\r
951 label : lang.column.insertAfter,
\r
952 group : 'tablecolumn',
\r
953 command : 'columnInsertAfter',
\r
957 tablecolumn_delete :
\r
959 label : lang.column.deleteColumn,
\r
960 group : 'tablecolumn',
\r
961 command : 'columnDelete',
\r
967 // If the "contextmenu" plugin is laoded, register the listeners.
\r
968 if ( editor.contextMenu )
\r
970 editor.contextMenu.addListener( function( element, selection )
\r
977 if ( element.getName() in contextMenuTags )
\r
980 tablecell : CKEDITOR.TRISTATE_OFF,
\r
981 tablerow : CKEDITOR.TRISTATE_OFF,
\r
982 tablecolumn : CKEDITOR.TRISTATE_OFF
\r
985 element = element.getParent();
\r
993 getSelectedCells : getSelectedCells
\r
996 CKEDITOR.plugins.add( 'tabletools', CKEDITOR.plugins.tabletools );
\r