Fixed bug #16045: htmlArea RTE: Merging table cells using context menu doesn't work...
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 18 Jan 2011 23:33:12 +0000 (23:33 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 18 Jan 2011 23:33:12 +0000 (23:33 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10133 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js

index 5c114bb..d0ab03f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-18  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #16045: htmlArea RTE: Merging table cells using context menu doesn't work in Firefox
+
 2011-01-18  Steffen Gebert  <steffen@steffen-gebert.de>
 
        * Fixed bug #17041: CSH tooltip often gets in the way of the field it is supposed to provide help for (Thanks to Stanislas Rolland)
index 4c21178..5cdf533 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-18  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #16045: htmlArea RTE: Merging table cells using context menu doesn't work in Firefox
+
 2011-01-07  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #16945: htmlArea RTE: Incorrect default tab label in image insertion dialogue
index 8efb161..b08ff07 100644 (file)
@@ -211,7 +211,31 @@ HTMLArea.Editor.prototype.getSelectionType = function(selection) {
        }
        return type;
 };
-
+/*
+ * Return the ranges of the selection
+ */
+HTMLArea.Editor.prototype.getSelectionRanges = function(selection) {
+       if (!selection) {
+               var selection = this._getSelection();
+       }
+       var ranges = [];
+       for (var i = selection.rangeCount; --i >= 0;) {
+               ranges.push(selection.getRangeAt(i));
+       }
+       return ranges;
+};
+/*
+ * Add ranges to the selection
+ */
+HTMLArea.Editor.prototype.setSelectionRanges = function(ranges, selection) {
+       if (!selection) {
+               var selection = this._getSelection();
+       }
+       this.emptySelection(selection);
+       for (var i = ranges.length; --i >= 0;) {
+               this.addRangeToSelection(selection, ranges[i]);
+       }
+};
 /*
  * Retrieves the selected element (if any), just in the case that a single element (object like and image or a table) is selected.
  */
index 32eafe3..946b800 100644 (file)
@@ -185,6 +185,9 @@ HTMLArea.ContextMenu = HTMLArea.Plugin.extend({
         */
        showMenu: function (event, target) {
                this.showContextItems(target);
+               if (!Ext.isIE) {
+                       this.ranges = this.editor.getSelectionRanges();
+               }
                var iframeEl = this.editor.iframe.getEl();
                this.menu.showAt([Ext.get(target).getX() + iframeEl.getX(), Ext.get(target).getY() + iframeEl.getY()]);
        },
@@ -240,6 +243,9 @@ HTMLArea.ContextMenu = HTMLArea.Plugin.extend({
         * Handler invoked when a menu item is clicked on
         */
        onItemClick: function (item, event) {
+               if (!Ext.isIE) {
+                       this.editor.setSelectionRanges(this.ranges);
+               }
                var button = this.getButton(item.getItemId());
                if (button) {
                        button.fireEvent('HTMLAreaEventContextMenu', button, event);