From d9344fc349e8c5765898c90bf5061e56cd21c8a0 Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Tue, 15 Apr 2008 17:22:00 -0400
Subject: [PATCH] HTML editing fixes, upgrade to TinyMCE v3.0.6

---
 program/js/tiny_mce/themes/advanced/js/color_picker.js |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/program/js/tiny_mce/themes/advanced/jscripts/color_picker.js b/program/js/tiny_mce/themes/advanced/js/color_picker.js
similarity index 93%
rename from program/js/tiny_mce/themes/advanced/jscripts/color_picker.js
rename to program/js/tiny_mce/themes/advanced/js/color_picker.js
index 00fc823..da833dc 100644
--- a/program/js/tiny_mce/themes/advanced/jscripts/color_picker.js
+++ b/program/js/tiny_mce/themes/advanced/js/color_picker.js
@@ -1,6 +1,8 @@
+tinyMCEPopup.requireLangPack();
+
 var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
 
-var colors = new Array(
+var colors = [
 	"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
 	"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
 	"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
@@ -28,7 +30,7 @@
 	"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
 	"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
 	"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
-);
+];
 
 var named = {
 	'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
@@ -57,10 +59,9 @@
 };
 
 function init() {
-	var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+	var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
 
-	if (tinyMCE.isMSIE)
-		tinyMCEPopup.resizeToInnerSize();
+	tinyMCEPopup.resizeToInnerSize();
 
 	generatePicker();
 
@@ -75,9 +76,13 @@
 }
 
 function insertAction() {
-	var color = document.getElementById("color").value;
+	var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
 
-	tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
+	tinyMCEPopup.restoreSelection();
+
+	if (f)
+		f(color);
+
 	tinyMCEPopup.close();
 }
 
@@ -86,7 +91,7 @@
 		document.getElementById("colorname").innerHTML = name;
 
 	document.getElementById("preview").style.backgroundColor = color;
-	document.getElementById("color").value = color;
+	document.getElementById("color").value = color.toLowerCase();
 }
 
 function convertRGBToHex(col) {
@@ -152,9 +157,9 @@
 		+ '<tr>';
 
 	for (i=0; i<colors.length; i++) {
-		h += '<td bgcolor="' + colors[i] + '">'
-			+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');">'
-			+ '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] +  '" alt="' + colors[i] +  '" /></a></td>';
+		h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+			+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
+			+ '</a></td>';
 		if ((i+1) % 18 == 0)
 			h += '</tr><tr>';
 	}
@@ -190,9 +195,9 @@
 	x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
 	y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
 
-	partWidth = document.getElementById('colorpicker').width / 6;
+	partWidth = document.getElementById('colors').width / 6;
 	partDetail = detail / 2;
-	imHeight = document.getElementById('colorpicker').height;
+	imHeight = document.getElementById('colors').height;
 
 	r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
 	g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255	+ (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
@@ -237,4 +242,4 @@
 	document.getElementById('color').value = color;
 }
 
-window.focus();
\ No newline at end of file
+tinyMCEPopup.onInit.add(init);

--
Gitblit v1.9.1