Fixed bug #14799: htmlArea RTE: Color dialogue may raise a js error in IE
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 21 Jun 2010 15:48:30 +0000 (15:48 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 21 Jun 2010 15:48:30 +0000 (15:48 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8003 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Color/typo3color.js

index 95e6955..baf6fee 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-21  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14799: htmlArea RTE: Color dialogue may raise a js error in IE
+
 2010-06-21  Ernesto Baschny  <ernst@cron-it.de>
 
        * Fixed bug #8893: eval "timesec" sets seconds to zero (Thanks to Ralf Hettinger and Andy Grunwald)
index dfdc8be..67d0c38 100644 (file)
@@ -1,3 +1,7 @@
+2010-06-21  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14799: htmlArea RTE: Color dialogue may raise a js error in IE
+
 2010-06-20  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14797: htmlArea RTE: Toolbar combo boxes do not float left in IE6 (Thnaks to Jigal van Hemert).
index 5a5b95a..7bbf1e2 100644 (file)
@@ -3515,9 +3515,9 @@ HTMLArea.util.Color = function () {
                                return (d < 16) ? ('0' + d.toString(16)) : d.toString(16);
                        };
                        if (typeof(v) == 'number') {
-                               var r = v & 0xFF;
+                               var b = v & 0xFF;
                                var g = (v >> 8) & 0xFF;
-                               var b = (v >> 16) & 0xFF;
+                               var r = (v >> 16) & 0xFF;
                                return '#' + hex(r) + hex(g) + hex(b);
                        }
                        if (v.substr(0, 3) === 'rgb') {
index 1625609..a976b60 100644 (file)
@@ -258,7 +258,11 @@ HTMLArea.TYPO3Color = HTMLArea.Plugin.extend({
         */
        showColor: function (color) {
                if (color) {
-                       this.dialog.find('itemId', 'show-color')[0].el.setStyle('backgroundColor', '#' + color);
+                       var newColor = color;
+                       if (newColor.indexOf('#') == 0) {
+                               newColor = newColor.substr(1);
+                       }
+                       this.dialog.find('itemId', 'show-color')[0].el.setStyle('backgroundColor', HTMLArea.util.Color.colorToHex(parseInt(newColor, 16)));
                }
        },
        /*
@@ -340,7 +344,10 @@ HTMLArea.TYPO3Color = HTMLArea.Plugin.extend({
                var buttonId = this.dialog.arguments.buttonId;
                var color = this.dialog.find('itemId', 'color')[0].getValue();
                if (color) {
-                       color = '#' + color;
+                       if (color.indexOf('#') == 0) {
+                               color = color.substr(1);
+                       }
+                       color = HTMLArea.util.Color.colorToHex(parseInt(color, 16));
                }
                this.editor.focus();
                var     element,