From 962085baa17a622c83320e27acde0ac06219da39 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 23 Apr 2009 05:56:14 -0400
Subject: [PATCH] - Fix text wrapping in HTML editor after switching from plain text to HTML (#1485521)
---
CHANGELOG | 1 +
program/js/editor.js | 3 +--
program/js/app.js | 7 +++++++
skins/default/editor_content.css | 10 ++++++++++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index f96d590..5e9683c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Fix text wrapping in HTML editor after switching from plain text to HTML (#1485521)
- Fix auto-complete function hangs with plus sign (#1485815)
- Fix AJAX requests errors handler (#1485000)
- Speed up message list displaying on IE
diff --git a/program/js/app.js b/program/js/app.js
index 43e0aa9..65b7c83 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3789,6 +3789,13 @@
});
}
+ this.plain2html = function(plainText, id)
+ {
+ this.set_busy(true, 'converting');
+ $(document.getElementById(id)).val('<pre>'+plainText+'</pre>');
+ this.set_busy(false);
+ }
+
/********************************************************/
/********* remote request methods *********/
diff --git a/program/js/editor.js b/program/js/editor.js
index 7f937b2..6826af8 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -75,9 +75,8 @@
if (ishtml)
{
rcmail.display_spellcheck_controls(false);
- var htmlText = "<pre>" + composeElement.value + "</pre>";
- composeElement.value = htmlText;
+ rcmail.plain2html(composeElement.value, textAreaId);
tinyMCE.execCommand('mceAddControl', true, textAreaId);
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '1';
diff --git a/skins/default/editor_content.css b/skins/default/editor_content.css
index 31a0a59..099b424 100644
--- a/skins/default/editor_content.css
+++ b/skins/default/editor_content.css
@@ -13,3 +13,13 @@
margin-top: 2px;
}
+pre
+{
+ margin: 0;
+ padding: 0;
+ white-space: -o-pre-wrap !important;
+ white-space: -moz-pre-wrap !important;
+ white-space: pre-wrap !important;
+ white-space: pre;
+ word-wrap: break-word; /* IE (and Safari) */
+}
--
Gitblit v1.9.1