* felamimail: handle IE (8) problem regarding toggling editor modes in compose window

This commit is contained in:
Klaus Leithoff 2011-12-29 11:20:13 +00:00
parent 15be419929
commit a780e5a1f1
2 changed files with 18 additions and 4 deletions

View File

@ -607,7 +607,8 @@
}
else
{
$this->t->set_var("toggle_editormode", lang("Editor type").":&nbsp;<span><input name=\"_is_html\" value=\"".$ishtml."\" type=\"hidden\" /><input name=\"_editorselect\" onchange=\"fm_toggle_editor(this)\" ".($ishtml ? "checked=\"checked\"" : "")." id=\"_html\" value=\"html\" type=\"radio\"><label for=\"_html\">HTML</label><input name=\"_editorselect\" onchange=\"fm_toggle_editor(this)\" ".($ishtml ? "" : "checked=\"checked\"")." id=\"_plain\" value=\"plain\" type=\"radio\"><label for=\"_plain\">Plain text</label></span>");
// IE seems to need onclick to realize there is a change
$this->t->set_var("toggle_editormode", lang("Editor type").":&nbsp;<span><input name=\"_is_html\" value=\"".$ishtml."\" type=\"hidden\" /><input name=\"_editorselect\" onchange=\"fm_toggle_editor(this)\" onclick=\"fm_toggle_editor(this)\" ".($ishtml ? "checked=\"checked\"" : "")." id=\"_html\" value=\"html\" type=\"radio\"><label for=\"_html\">HTML</label><input name=\"_editorselect\" onchange=\"fm_toggle_editor(this)\" onclick=\"fm_toggle_editor(this)\" ".($ishtml ? "" : "checked=\"checked\"")." id=\"_plain\" value=\"plain\" type=\"radio\"><label for=\"_plain\">Plain text</label></span>");
}
$this->t->pparse("out","body_input");

View File

@ -685,6 +685,7 @@ function fm_set_editor_toggle_states()
}
}
var scaytStartup;
// Toggle between the HTML and Plain Text editors
function fm_toggle_editor(toggler)
{
@ -724,12 +725,20 @@ function fm_toggle_editor(toggler)
plaineditor.style.display = "none";
if (ckeditor)
{
// nothing to do
scaytStartup = ckeditor.config.scayt_autoStartup;
if (ckeditor.env.ie) ckeditor.config.scayt_autoStartup = false;
ckeditor.config.height = '338px'; // seems to fit the area
//ckeditor.config.resize_enabled = true;
}
else
{
scaytStartup = ckeditorConfig.scayt_autoStartup;
if (CKEDITOR.env.ie) ckeditorConfig.scayt_autoStartup = false;
ckeditorConfig.height = "338px"; // seems to fit the area
//ckeditorConfig.resize_enabled = true;
ckeditor = CKEDITOR.replace('body',ckeditorConfig);
}
//Copy the current ASCII data and recode it via a XAJAX request
var existingAscii = "<pre>" + plaineditor.value + "</pre>";
plaineditor.value= '';
@ -743,7 +752,8 @@ function fm_toggle_editor(toggler)
//Copy the current HTML data and recode it via a XAJAX request
var existingHtml = ckeditor.getData();
var ckeditor_span = document.getElementById('cke_body');
ckeditor.setData('');
//ckeditor.config.scayt_autoStartup = false;
ckeditor.setData('&nbsp;',function(){this.checkDirty();},true);
//Hide the old editor
ckeditor_span.style.display = "none";
// we need to destroy the ckeditor, as the/a submit is using the content of the ckeditor instance for content of body
@ -805,7 +815,7 @@ function showPlainEditor(_content)
plaineditor.style.display = "block";
plaineditor.value = _content;
plaineditor.focus();
hideAjaxLoader(document.getElementById('editorArea'));
}
@ -816,6 +826,9 @@ function showHTMLEditor(_content)
//Set the new content
ckeditor.setData(_content);
//alert((typeof scaytStartup)+'->'+ scaytStartup);
ckeditor.focus();
if ( typeof scaytStartup == boolean ) ckeditor.config.scayt_autoStartup = scaytStartup;
//Toggle the plain editor visiblity
ckeditor_span.style.display = 'block';