Fixed bug #14333: htmlArea RTE: justify after CTRL+A not working in Firefox
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 25 May 2010 13:49:07 +0000 (13:49 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 25 May 2010 13:49:07 +0000 (13:49 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7671 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js

index 6feaf8a..faa80c6 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-25  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14333: htmlArea RTE: justify after CTRL+A not working in Firefox
+
 2010-05-24  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Updated htmlArea RTE version to 1.9.3
 2010-05-24  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Updated htmlArea RTE version to 1.9.3
index 120310a..85e63ff 100644 (file)
@@ -1,3 +1,7 @@
+2010-05-25  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14333: htmlArea RTE: justify after CTRL+A not working in Firefox
+
 2010-05-24  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Updated htmlArea RTE version to 1.9.3
 2010-05-24  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Updated htmlArea RTE version to 1.9.3
index 79aec5b..4c6e41d 100644 (file)
@@ -3064,7 +3064,13 @@ HTMLArea.Editor.prototype.getEndBlocks = function(selection) {
        var range = this._createRange(selection);
        if (!Ext.isIE) {
                var parentStart = range.startContainer;
        var range = this._createRange(selection);
        if (!Ext.isIE) {
                var parentStart = range.startContainer;
+               if (/^(body)$/i.test(parentStart.nodeName)) {
+                       parentStart = parentStart.firstChild;
+               }
                var parentEnd = range.endContainer;
                var parentEnd = range.endContainer;
+               if (/^(body)$/i.test(parentEnd.nodeName)) {
+                       parentEnd = parentEnd.lastChild;
+               }
        } else {
                if (selection.type !== "Control" ) {
                        var rangeEnd = range.duplicate();
        } else {
                if (selection.type !== "Control" ) {
                        var rangeEnd = range.duplicate();
index cb4d280..33b5373 100644 (file)
@@ -655,37 +655,39 @@ HTMLArea.BlockElements = HTMLArea.Plugin.extend({
                if (endBlocks.start === endBlocks.end) {
                        --index;
                }
                if (endBlocks.start === endBlocks.end) {
                        --index;
                }
-               for (var block = startAncestors[index]; block; block = block.nextSibling) {
-                       if (HTMLArea.isBlockElement(block)) {
-                               switch (buttonId) {
-                                       case "Indent" :
-                                               if (!HTMLArea._hasClass(block, this.useClass[buttonId])) {
-                                                       HTMLArea._addClass(block, this.useClass[buttonId]);
-                                               }
-                                               break;
-                                       case "Outdent" :
-                                               if (HTMLArea._hasClass(block, this.useClass["Indent"])) {
-                                                       HTMLArea._removeClass(block, this.useClass["Indent"]);
-                                               }
-                                               break;
-                                       case "JustifyLeft"   :
-                                       case "JustifyCenter" :
-                                       case "JustifyRight"  :
-                                       case "JustifyFull"   :
-                                               this.toggleAlignmentClass(block, buttonId);
-                                               break;
-                                       default :
-                                               if (this.standardBlockElements.test(buttonId.toLowerCase()) && buttonId.toLowerCase() == block.nodeName.toLowerCase()) {
-                                                       this.cleanClasses(block);
-                                                       if (className) {
-                                                               HTMLArea._addClass(block, className);
+               if (!/^(body)$/i.test(startAncestors[index].nodeName)) {
+                       for (var block = startAncestors[index]; block; block = block.nextSibling) {
+                               if (HTMLArea.isBlockElement(block)) {
+                                       switch (buttonId) {
+                                               case "Indent" :
+                                                       if (!HTMLArea._hasClass(block, this.useClass[buttonId])) {
+                                                               HTMLArea._addClass(block, this.useClass[buttonId]);
                                                        }
                                                        }
-                                               }
-                                               break;
+                                                       break;
+                                               case "Outdent" :
+                                                       if (HTMLArea._hasClass(block, this.useClass["Indent"])) {
+                                                               HTMLArea._removeClass(block, this.useClass["Indent"]);
+                                                       }
+                                                       break;
+                                               case "JustifyLeft"   :
+                                               case "JustifyCenter" :
+                                               case "JustifyRight"  :
+                                               case "JustifyFull"   :
+                                                       this.toggleAlignmentClass(block, buttonId);
+                                                       break;
+                                               default :
+                                                       if (this.standardBlockElements.test(buttonId.toLowerCase()) && buttonId.toLowerCase() == block.nodeName.toLowerCase()) {
+                                                               this.cleanClasses(block);
+                                                               if (className) {
+                                                                       HTMLArea._addClass(block, className);
+                                                               }
+                                                       }
+                                                       break;
+                                       }
+                               }
+                               if (block == endAncestors[index]) {
+                                       break;
                                }
                                }
-                       }
-                       if (block == endAncestors[index]) {
-                               break;
                        }
                }
        },
                        }
                }
        },