locomotive-aloha-rails 0.20.1.2 → 0.20.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. data/Rakefile +1 -1
  2. data/lib/aloha/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/aloha/css/aloha.css +3 -0
  4. data/vendor/assets/javascripts/aloha/css/ext-aloha.css +3 -0
  5. data/vendor/assets/javascripts/aloha/lib/aloha-bootstrap.js +4565 -3934
  6. data/vendor/assets/javascripts/aloha/lib/aloha.js +1357 -702
  7. data/vendor/assets/javascripts/aloha/lib/aloha/command.js +16 -13
  8. data/vendor/assets/javascripts/aloha/lib/aloha/core.js +23 -3
  9. data/vendor/assets/javascripts/aloha/lib/aloha/ecma5shims.js +23 -7
  10. data/vendor/assets/javascripts/aloha/lib/aloha/editable.js +57 -14
  11. data/vendor/assets/javascripts/aloha/lib/aloha/engine.js +9 -5
  12. data/vendor/assets/javascripts/aloha/lib/aloha/floatingmenu.js +288 -96
  13. data/vendor/assets/javascripts/aloha/lib/aloha/jquery.js +11 -1
  14. data/vendor/assets/javascripts/aloha/lib/aloha/markup.js +318 -40
  15. data/vendor/assets/javascripts/aloha/lib/aloha/repositorymanager.js +11 -10
  16. data/vendor/assets/javascripts/aloha/lib/aloha/selection.js +20 -1
  17. data/vendor/assets/javascripts/aloha/lib/aloha/sidebar.js +11 -1
  18. data/vendor/assets/javascripts/aloha/lib/jquery-plugin.js +10 -7
  19. data/vendor/assets/javascripts/aloha/lib/util/dom.js +18 -6
  20. data/vendor/assets/javascripts/aloha/lib/util/range.js +6 -6
  21. data/vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/ext-all-debug.js +26 -2
  22. data/vendor/assets/javascripts/aloha/lib/vendor/jquery.store.js +39 -15
  23. data/vendor/assets/javascripts/aloha/plugins/common/abbr/lib/abbr-plugin.js +1 -0
  24. data/vendor/assets/javascripts/aloha/plugins/common/align/lib/align-plugin.js +344 -334
  25. data/vendor/assets/javascripts/aloha/plugins/common/block/css/block.css +65 -12
  26. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/block-plugin.js +12 -15
  27. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/block.js +796 -180
  28. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockcontenthandler.js +54 -13
  29. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockmanager.js +315 -78
  30. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/editor.js +111 -8
  31. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/editormanager.js +2 -0
  32. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/jquery-ui-1.8.16.custom.min.js +198 -0
  33. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/sidebarattributeeditor.js +7 -20
  34. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/lib/characterpicker-plugin.js +15 -3
  35. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/sanitizecontenthandler.js +3 -2
  36. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/wordcontenthandler.js +111 -5
  37. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml-plugin.js +29 -0
  38. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml.js +306 -0
  39. data/vendor/assets/javascripts/aloha/plugins/common/format/lib/format-plugin.js +59 -5
  40. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/i18n.js +1 -1
  41. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/lib/horizontalruler-plugin.js +18 -3
  42. data/vendor/assets/javascripts/aloha/plugins/common/image/img/crop-buttons.gif +0 -0
  43. data/vendor/assets/javascripts/aloha/plugins/common/image/lib/image-plugin.js +1629 -1601
  44. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/jcrop/jquery.jcrop.css +11 -0
  45. data/vendor/assets/javascripts/aloha/plugins/common/link/extra/linklist.js +8 -6
  46. data/vendor/assets/javascripts/aloha/plugins/common/link/lib/link-plugin.js +26 -10
  47. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/de/i18n.js +5 -1
  48. data/vendor/assets/javascripts/aloha/plugins/common/paste/lib/paste-plugin.js +3 -4
  49. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-cell.js +13 -12
  50. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-plugin.js +108 -61
  51. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-selection.js +61 -1
  52. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table.js +1 -0
  53. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/de/i18n.js +28 -1
  54. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/i18n.js +36 -10
  55. data/vendor/assets/javascripts/aloha/plugins/extra/browser/css/browser.jqgrid.css +292 -292
  56. data/vendor/assets/javascripts/aloha/plugins/extra/browser/lib/browser.js +28 -5
  57. data/vendor/assets/javascripts/aloha/plugins/extra/browser/lib/locale.js +2 -2
  58. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/grid.locale.de.js +6 -1
  59. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/grid.locale.en.js +5 -0
  60. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/jquery.jqGrid.js +5 -0
  61. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/jquery.jstree.js +6 -1
  62. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/jquery.ui.js +6 -1
  63. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/ui-layout.js +6 -1
  64. data/vendor/assets/javascripts/aloha/plugins/extra/cite/lib/cite-plugin.js +18 -4
  65. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/lib/formatlesspaste-plugin.js +1 -1
  66. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/lib/linkbrowser-plugin.js +14 -2
  67. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/demo/js/aloha-config.js +2 -2
  68. data/vendor/assets/javascripts/aloha/plugins/extra/toc/lib/toc-plugin.js +382 -0
  69. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/de/i18n.js +3 -0
  70. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/i18n.js +4 -0
  71. metadata +15 -11
  72. data/vendor/assets/javascripts/aloha/plugins/extra/toc/i18n/de.json +0 -1
  73. data/vendor/assets/javascripts/aloha/plugins/extra/toc/i18n/en.json +0 -1
  74. data/vendor/assets/javascripts/aloha/plugins/extra/toc/src/toc.js +0 -350
@@ -19,6 +19,17 @@
19
19
  *height: 9px;
20
20
  }
21
21
 
22
+ .cnr-crop-apply {
23
+ background-image: url(../../img/crop-buttons.gif) !important;
24
+ background-position: -2px -2px !important;
25
+ }
26
+
27
+
28
+ .cnr-crop-cancel {
29
+ background-image: url(../../img/crop-buttons.gif) !important;
30
+ background-position: 23px -2px !important;
31
+ }
32
+
22
33
  .jcrop-tracker { width: 100%; height: 100%; }
23
34
 
24
35
  .custom .jcrop-vline,
@@ -48,6 +48,13 @@ function ( Aloha, jQuery ) {
48
48
  * additional properties to the items
49
49
  */
50
50
  init: function () {
51
+
52
+ if ( typeof Aloha.settings.repositories !== 'undefined'
53
+ && typeof Aloha.settings.repositories.linklist !== 'undefined'
54
+ && typeof Aloha.settings.repositories.linklist.data !== 'undefined' ) {
55
+ urlset = Aloha.settings.repositories.linklist.data;
56
+ }
57
+
51
58
  // Add ECMA262-5 Array method filter if not supported natively.
52
59
  // But we will be very conservative and add to this single array
53
60
  // object so that we do not tamper with the native Array prototype
@@ -69,11 +76,6 @@ function ( Aloha, jQuery ) {
69
76
  };
70
77
  }
71
78
 
72
- if ( typeof Aloha.settings.repositories != 'undefined'
73
- && typeof Aloha.settings.repositories.linklist.data != 'undefined' ) {
74
- urlset = Aloha.settings.repositories.linklist.data;
75
- }
76
-
77
79
  var l = urlset.length;
78
80
 
79
81
  // generate folder structure
@@ -224,4 +226,4 @@ function ( Aloha, jQuery ) {
224
226
 
225
227
  } ) )();
226
228
 
227
- } );
229
+ } );
@@ -272,10 +272,8 @@ define( [
272
272
  foundMarkup = that.findLinkMarkup( rangeObject );
273
273
 
274
274
  if ( foundMarkup ) {
275
- that.insertLinkButton.hide();
276
- that.formatLinkButton.setPressed( true );
277
- FloatingMenu.setScope( 'link' );
278
-
275
+ that.toggleLinkScope( true );
276
+
279
277
  // remember the current tab selected by the user
280
278
  var currentTab = FloatingMenu.userActivatedTab;
281
279
 
@@ -306,9 +304,11 @@ define( [
306
304
  }
307
305
  }, 200 );
308
306
  }
307
+ Aloha.trigger( 'aloha-link-selected' );
309
308
  } else {
310
- that.formatLinkButton.setPressed( false );
309
+ that.toggleLinkScope( false );
311
310
  that.hrefField.setTargetObject( null );
311
+ Aloha.trigger( 'aloha-link-unselected' );
312
312
  }
313
313
  }
314
314
 
@@ -316,6 +316,25 @@ define( [
316
316
  } );
317
317
  },
318
318
 
319
+ /**
320
+ * lets you toggle the link scope to true (link buttons are visible)
321
+ * or false (link buttons are hidden)
322
+ * @param show bool true to show link buttons, false otherwise
323
+ */
324
+ toggleLinkScope: function ( show ) {
325
+ if ( show ) {
326
+ this.insertLinkButton.hide();
327
+ this.hrefField.show();
328
+ this.removeLinkButton.show();
329
+ this.formatLinkButton.setPressed( true );
330
+ } else {
331
+ this.insertLinkButton.show();
332
+ this.hrefField.hide();
333
+ this.removeLinkButton.hide();
334
+ this.formatLinkButton.setPressed( false );
335
+ }
336
+ },
337
+
319
338
  /**
320
339
  * Add event handlers to the given link object
321
340
  * @param link object
@@ -393,9 +412,6 @@ define( [
393
412
  1
394
413
  );
395
414
 
396
- // add the new scope for links
397
- FloatingMenu.createScope( 'link', 'Aloha.continuoustext' );
398
-
399
415
  this.hrefField = new Aloha.ui.AttributeField( {
400
416
  'name': 'href',
401
417
  'width': 320,
@@ -406,7 +422,7 @@ define( [
406
422
  this.hrefField.setObjectTypeFilter( this.objectTypeFilter );
407
423
  // add the input field for links
408
424
  FloatingMenu.addButton(
409
- 'link',
425
+ 'Aloha.continuoustext',
410
426
  this.hrefField,
411
427
  i18n.t( 'floatingmenu.tab.link' ),
412
428
  1
@@ -422,7 +438,7 @@ define( [
422
438
  } );
423
439
  // add a button for removing the currently set link
424
440
  FloatingMenu.addButton(
425
- 'link',
441
+ 'Aloha.continuoustext',
426
442
  this.removeLinkButton,
427
443
  i18n.t( 'floatingmenu.tab.link' ),
428
444
  1
@@ -1 +1,5 @@
1
- define({"button.createulist.tooltip":"Unsortierte Liste einf\u00fcgen","button.createolist.tooltip":"Sortierte Liste einf\u00fcgen"});
1
+ define({"button.createulist.tooltip":"Unsortierte Liste einf\u00fcgen",
2
+ "button.createolist.tooltip":"Sortierte Liste einf\u00fcgen",
3
+ "button.indentlist.tooltip":"Liste niedriger schieben",
4
+ "button.outdentlist.tooltip":"Liste h\u00F6her schieben",
5
+ "floatingmenu.tab.list":"Liste"});
@@ -84,8 +84,6 @@ function ( Aloha, Plugin, jQuery, Commands, console ) {
84
84
  pasteDivContents = pasteDivContents.substring( 6 );
85
85
  }
86
86
 
87
- pasteDivContents = jQuery.trim( pasteDivContents );
88
-
89
87
  // Detects a situation where we are about to paste into a selection
90
88
  // that looks like this: <p> [</p>...
91
89
  // The nbsp inside the <p> node was placed there to make the empty
@@ -142,7 +140,7 @@ function ( Aloha, Plugin, jQuery, Commands, console ) {
142
140
 
143
141
  jQuery( 'body' ).append( $pasteDiv );
144
142
 
145
- // subscribe to the event editableCreated to redirect paste events
143
+ // subscribe to the event aloha-editable-created to redirect paste events
146
144
  // into our hidden pasteDiv
147
145
  // TODO: move to paste command
148
146
  // http://support.mozilla.com/en-US/kb/Granting%20JavaScript%20access%20to%20the%20clipboard
@@ -186,8 +184,9 @@ function ( Aloha, Plugin, jQuery, Commands, console ) {
186
184
  window.setTimeout( function () {
187
185
  getPastedContent();
188
186
  Aloha.activeEditable.smartContentChange( event );
189
- event.stopPropagation();
190
187
  }, 10 );
188
+
189
+ event.stopPropagation();
191
190
  } );
192
191
  }
193
192
  } );
@@ -115,7 +115,6 @@ function (jQuery, Utils) {
115
115
  // Disabled the dragging of content, since it makes cell selection difficult
116
116
  this.wrapper.get( 0 ).ondragstart = function () { return false };
117
117
  }
118
-
119
118
  return this;
120
119
  };
121
120
 
@@ -126,14 +125,17 @@ function (jQuery, Utils) {
126
125
  * @return void
127
126
  */
128
127
  TableCell.prototype.deactivate = function() {
129
- var wrapper = this.obj.children('.aloha-table-cell-editable');
128
+ var wrapper = jQuery(this.obj.children('.aloha-table-cell-editable'));
130
129
 
131
130
  if (wrapper.length) {
132
- // get the inner html of the contenteditable div
133
- var innerHtml = wrapper.html();
134
-
131
+ // unwrap cell contents without re-creating dom nodes
132
+ wrapper.parent().append(
133
+ wrapper.contents()
134
+ );
135
+
135
136
  // remove the contenteditable div and its attached events
136
137
  wrapper.remove();
138
+
137
139
 
138
140
  // remove the click event of the
139
141
  this.obj.unbind('click');
@@ -141,10 +143,6 @@ function (jQuery, Utils) {
141
143
  if (jQuery.trim(this.obj.attr('class')) == '') {
142
144
  this.obj.removeAttr('class');
143
145
  }
144
-
145
- // set the inner html of the contenteditable div as html for the table-data
146
- // field
147
- this.obj.html(innerHtml);
148
146
  }
149
147
  }
150
148
 
@@ -203,7 +201,7 @@ function (jQuery, Utils) {
203
201
  this.hasFocus = false;
204
202
 
205
203
  // remove "active class"
206
- this.obj.removeClass('aloha-table-cell-active');
204
+ this.obj.removeClass('aloha-table-cell_active');
207
205
  };
208
206
 
209
207
  /**
@@ -228,20 +226,23 @@ function (jQuery, Utils) {
228
226
  */
229
227
  TableCell.prototype._startCellSelection = function(){
230
228
  if(!this.tableObj.selection.cellSelectionMode){
231
-
229
+
232
230
  //unselect currently selected cells
233
231
  this.tableObj.selection.unselectCells();
234
232
 
235
233
  // activate cell selection mode
236
234
  this.tableObj.selection.cellSelectionMode = true;
237
-
235
+
238
236
  //bind a global mouseup event handler to stop cell selection
239
237
  var that = this;
240
238
  jQuery('body').bind('mouseup.cellselection', function(){
241
239
  that._endCellSelection();
240
+
242
241
  });
243
242
 
244
243
  this.tableObj.selection.baseCellPosition = [this._virtualY(), this._virtualX()];
244
+
245
+
245
246
  }
246
247
  };
247
248
 
@@ -156,6 +156,32 @@ define( [
156
156
  0 !== TablePlugin.activeTable.selection.selectedCells.length ) {
157
157
  TablePlugin.updateFloatingMenuScope();
158
158
  }
159
+
160
+ // check if selected cells are split/merge able and set button status
161
+ if ( typeof TablePlugin.activeTable !== 'undefined' &&
162
+ TablePlugin.activeTable.selection ) {
163
+
164
+ if ( TablePlugin.activeTable.selection.cellsAreSplitable() ) {
165
+ that.btnSplitcells.enable();
166
+ that.btnRowsplitcells.enable();
167
+ that.btnTablesplitcells.enable();
168
+ } else {
169
+ that.btnSplitcells.disable();
170
+ that.btnRowsplitcells.disable();
171
+ that.btnTablesplitcells.disable();
172
+ }
173
+
174
+ if ( TablePlugin.activeTable.selection.cellsAreMergeable() ) {
175
+ that.btnMergecells.enable();
176
+ that.btnRowmergecells.enable();
177
+ that.btnTablemergecells.enable();
178
+ } else {
179
+ that.btnMergecells.disable();
180
+ that.btnRowmergecells.disable();
181
+ that.btnTablemergecells.disable();
182
+ }
183
+ }
184
+
159
185
  });
160
186
 
161
187
  Aloha.bind( 'aloha-selection-changed', function (event, rangeObject) {
@@ -200,6 +226,14 @@ define( [
200
226
 
201
227
  // subscribe for the 'editableActivated' event to activate all tables in the editable
202
228
  Aloha.bind( 'aloha-editable-activated', function (event, props) {
229
+ // disable all split / merge buttons
230
+ that.btnSplitcells.disable();
231
+ that.btnRowsplitcells.disable();
232
+ that.btnTablesplitcells.disable();
233
+ that.btnMergecells.disable();
234
+ that.btnRowmergecells.disable();
235
+ that.btnTablemergecells.disable();
236
+
203
237
  props.editable.obj.find('table').each(function () {
204
238
  // shortcut for TableRegistry
205
239
  var tr = TablePlugin.TableRegistry;
@@ -576,10 +610,7 @@ define( [
576
610
  1
577
611
  );
578
612
 
579
- // Add merge/split cells buttons
580
- FloatingMenu.addButton(
581
- this.name + '.row',
582
- new Aloha.ui.Button({
613
+ this.btnRowmergecells = new Aloha.ui.Button({
583
614
  'name' : 'rowmergecells',
584
615
  'iconClass' : 'aloha-button aloha-button-merge-cells',
585
616
  'size' : 'small',
@@ -590,14 +621,17 @@ define( [
590
621
  that.activeTable.selection.mergeCells();
591
622
  }
592
623
  }
593
- }),
624
+ });
625
+
626
+ // Add merge/split cells buttons
627
+ FloatingMenu.addButton(
628
+ this.name + '.row',
629
+ this.btnRowmergecells,
594
630
  i18n.t('floatingmenu.tab.table'),
595
631
  1
596
632
  );
597
633
 
598
- FloatingMenu.addButton(
599
- this.name + '.row',
600
- new Aloha.ui.Button({
634
+ this.btnRowsplitcells = new Aloha.ui.Button({
601
635
  'name' : 'rowsplitcells',
602
636
  'iconClass' : 'aloha-button aloha-button-split-cells',
603
637
  'size' : 'small',
@@ -608,7 +642,11 @@ define( [
608
642
  that.activeTable.selection.splitCells();
609
643
  }
610
644
  }
611
- }),
645
+ });
646
+
647
+ FloatingMenu.addButton(
648
+ this.name + '.row',
649
+ this.btnRowsplitcells,
612
650
  i18n.t('floatingmenu.tab.table'),
613
651
  1
614
652
  );
@@ -626,16 +664,19 @@ define( [
626
664
  var sc = that.activeTable.selection.selectedCells;
627
665
  // if a selection was made, transform the selected cells
628
666
  for (var i = 0; i < sc.length; i++) {
629
- for (var j = 0; j < sc[i].length; j++) {
630
- // remove all row formattings
631
- for (var f = 0; f < that.rowConfig.length; f++) {
632
- jQuery(sc[i][j]).removeClass(that.rowConfig[f].cssClass);
633
- }
634
- // set new style
635
- jQuery(sc[i][j]).addClass(itemConf.cssClass);
636
- }
667
+ if ( jQuery(sc[i]).attr('class').indexOf(itemConf.cssClass) > -1 ) {
668
+ jQuery(sc[i]).removeClass(itemConf.cssClass);
669
+ } else {
670
+ jQuery(sc[i]).addClass(itemConf.cssClass);
671
+ // remove all row formattings
672
+ for (var f = 0; f < that.rowConfig.length; f++) {
673
+ if (that.rowConfig[f].cssClass != itemConf.cssClass) {
674
+ jQuery(sc[i]).removeClass(that.rowConfig[f].cssClass);
675
+ }
676
+ }
677
+
678
+ }
637
679
  }
638
-
639
680
  // selection could have changed.
640
681
  that.activeTable.selectRows();
641
682
  }
@@ -651,21 +692,18 @@ define( [
651
692
  iconClass: 'aloha-button aloha-button-removeFormat',
652
693
  wide: true,
653
694
  click: function () {
654
- if (that.activeTable) {
655
- var sc = that.activeTable.selection.selectedCells;
656
- // if a selection was made, transform the selected cells
657
- for (var i = 0; i < sc.length; i++) {
658
- for (var j = 0; j < sc[i].length; j++) {
659
- for (var f = 0; f < that.rowConfig.length; f++) {
660
- jQuery(sc[i][j]).removeClass(that.rowConfig[f].cssClass);
661
- }
662
- }
663
- }
664
-
665
- // selection could have changed.
666
- that.activeTable.selectRows();
667
- }
668
- }
695
+ if (that.activeTable) {
696
+ var sc = that.activeTable.selection.selectedCells;
697
+ // if a selection was made, transform the selected cells
698
+ for (var i = 0; i < sc.length; i++) {
699
+ for (var f = 0; f < that.rowConfig.length; f++) {
700
+ jQuery(sc[i]).removeClass(that.rowConfig[f].cssClass);
701
+ }
702
+ }
703
+ // selection could have changed.
704
+ that.activeTable.selectRows();
705
+ }
706
+ }
669
707
  });
670
708
  }
671
709
 
@@ -801,10 +839,7 @@ define( [
801
839
  1
802
840
  );
803
841
 
804
- // Add merge/split cells buttons
805
- FloatingMenu.addButton(
806
- this.name + '.column',
807
- new Aloha.ui.Button({
842
+ this.btnTablemergecells = new Aloha.ui.Button({
808
843
  'name' : 'tablemergecells',
809
844
  'iconClass' : 'aloha-button aloha-button-merge-cells',
810
845
  'size' : 'small',
@@ -815,14 +850,17 @@ define( [
815
850
  that.activeTable.selection.mergeCells();
816
851
  }
817
852
  }
818
- }),
853
+ });
854
+
855
+ // Add merge/split cells buttons
856
+ FloatingMenu.addButton(
857
+ this.name + '.column',
858
+ this.btnTablemergecells,
819
859
  i18n.t('floatingmenu.tab.table'),
820
860
  1
821
861
  );
822
862
 
823
- FloatingMenu.addButton(
824
- this.name + '.column',
825
- new Aloha.ui.Button({
863
+ this.btnTablesplitcells = new Aloha.ui.Button({
826
864
  'name' : 'tablesplitcells',
827
865
  'iconClass' : 'aloha-button aloha-button-split-cells',
828
866
  'size' : 'small',
@@ -833,7 +871,11 @@ define( [
833
871
  that.activeTable.selection.splitCells();
834
872
  }
835
873
  }
836
- }),
874
+ });
875
+
876
+ FloatingMenu.addButton(
877
+ this.name + '.column',
878
+ this.btnTablesplitcells,
837
879
  i18n.t('floatingmenu.tab.table'),
838
880
  1
839
881
  );
@@ -852,13 +894,16 @@ define( [
852
894
  var sc = that.activeTable.selection.selectedCells;
853
895
  // if a selection was made, transform the selected cells
854
896
  for (var i = 0; i < sc.length; i++) {
855
- for (var j = 0; j < sc[i].length; j++) {
856
- // remove all columnformattings
897
+ if ( jQuery(sc[i]).attr('class').indexOf(itemConf.cssClass) > -1 ) {
898
+ jQuery(sc[i]).removeClass(itemConf.cssClass);
899
+ } else {
900
+ jQuery(sc[i]).addClass(itemConf.cssClass);
901
+ // remove all column formattings
857
902
  for (var f = 0; f < that.columnConfig.length; f++) {
858
- jQuery(sc[i][j]).removeClass(that.columnConfig[f].cssClass);
903
+ if (that.columnConfig[f].cssClass != itemConf.cssClass) {
904
+ jQuery(sc[i]).removeClass(that.columnConfig[f].cssClass);
905
+ }
859
906
  }
860
- // set new style
861
- jQuery(sc[i][j]).addClass(itemConf.cssClass);
862
907
  }
863
908
  }
864
909
  // selection could have changed.
@@ -882,13 +927,10 @@ define( [
882
927
  var sc = that.activeTable.selection.selectedCells;
883
928
  // if a selection was made, transform the selected cells
884
929
  for (var i = 0; i < sc.length; i++) {
885
- for (var j = 0; j < sc[i].length; j++) {
886
- for (var f = 0; f < that.columnConfig.length; f++) {
887
- jQuery(sc[i][j]).removeClass(that.columnConfig[f].cssClass);
888
- }
930
+ for (var f = 0; f < that.columnConfig.length; f++) {
931
+ jQuery(sc[i]).removeClass(that.columnConfig[f].cssClass);
889
932
  }
890
933
  }
891
-
892
934
  // selection could have changed.
893
935
  that.activeTable.selectColumns();
894
936
  }
@@ -1004,10 +1046,7 @@ define( [
1004
1046
  );
1005
1047
  };
1006
1048
 
1007
- // Add merge/split cells buttons
1008
- FloatingMenu.addButton(
1009
- this.name + '.cell',
1010
- new Aloha.ui.Button({
1049
+ this.btnMergecells = new Aloha.ui.Button({
1011
1050
  'name' : 'mergecells',
1012
1051
  'iconClass' : 'aloha-button aloha-button-merge-cells',
1013
1052
  'size' : 'small',
@@ -1018,14 +1057,17 @@ define( [
1018
1057
  that.activeTable.selection.mergeCells();
1019
1058
  }
1020
1059
  }
1021
- }),
1060
+ });
1061
+
1062
+ // Add merge/split cells buttons
1063
+ FloatingMenu.addButton(
1064
+ this.name + '.cell',
1065
+ this.btnMergecells,
1022
1066
  i18n.t('floatingmenu.tab.table'),
1023
1067
  1
1024
1068
  );
1025
1069
 
1026
- FloatingMenu.addButton(
1027
- this.name + '.cell',
1028
- new Aloha.ui.Button({
1070
+ this.btnSplitcells = new Aloha.ui.Button({
1029
1071
  'name' : 'splitcells',
1030
1072
  'iconClass' : 'aloha-button aloha-button-split-cells',
1031
1073
  'size' : 'small',
@@ -1036,7 +1078,11 @@ define( [
1036
1078
  that.activeTable.selection.splitCells();
1037
1079
  }
1038
1080
  }
1039
- }),
1081
+ });
1082
+
1083
+ FloatingMenu.addButton(
1084
+ this.name + '.cell',
1085
+ this.btnSplitcells,
1040
1086
  i18n.t('floatingmenu.tab.table'),
1041
1087
  1
1042
1088
  );
@@ -1107,6 +1153,7 @@ define( [
1107
1153
  1
1108
1154
  );
1109
1155
  }
1156
+
1110
1157
  };
1111
1158
 
1112
1159
  /**