From a01b3bf9aee82b142724eb769a40a4d6df5d9e26 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 23 Jul 2009 02:57:20 -0400
Subject: [PATCH] - removed hardcoded 'compose-body' identifier (#1485996)
---
program/steps/mail/compose.inc | 6 ++++--
program/js/editor.js | 9 +++++----
program/js/app.js | 17 ++++++++++-------
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/program/js/app.js b/program/js/app.js
index 8a9a580..b192297 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -913,7 +913,7 @@
break;
case 'spellcheck':
- if (window.tinyMCE && tinyMCE.get('compose-body')) {
+ if (window.tinyMCE && tinyMCE.get(this.env.composebody)) {
tinyMCE.execCommand('mceSpellCheck', true);
}
else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) {
@@ -2156,14 +2156,17 @@
}
// check for empty body
- if ((!window.tinyMCE || !tinyMCE.get('compose-body')) && input_message.val() == '' && !confirm(this.get_label('nobodywarning')))
+ if ((!window.tinyMCE || !tinyMCE.get(this.env.composebody))
+ && input_message.val() == '' && !confirm(this.get_label('nobodywarning')))
{
input_message.focus();
return false;
}
- else if (window.tinyMCE && tinyMCE.get('compose-body') && !tinyMCE.get('compose-body').getContent() && !confirm(this.get_label('nobodywarning')))
+ else if (window.tinyMCE && tinyMCE.get(this.env.composebody)
+ && !tinyMCE.get(this.env.composebody).getContent()
+ && !confirm(this.get_label('nobodywarning')))
{
- tinyMCE.get('compose-body').focus();
+ tinyMCE.get(this.env.composebody).focus();
return false;
}
@@ -2171,7 +2174,7 @@
this.stop_spellchecking();
// move body from html editor to textarea (just to be sure, #1485860)
- if (window.tinyMCE && tinyMCE.get('compose-body'))
+ if (window.tinyMCE && tinyMCE.get(this.env.composebody))
tinyMCE.triggerSave();
return true;
@@ -2234,7 +2237,7 @@
if (value_subject)
str += value_subject+':';
- var editor = tinyMCE.get('compose-body');
+ var editor = tinyMCE.get(this.env.composebody);
if (editor)
str += editor.getContent();
else
@@ -2297,7 +2300,7 @@
}
else
{
- var editor = tinyMCE.get('compose-body');
+ var editor = tinyMCE.get(this.env.composebody);
if (this.env.signatures)
{
diff --git a/program/js/editor.js b/program/js/editor.js
index ed7c4f9..eeb16ec 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -73,10 +73,11 @@
function rcmail_editor_tabindex()
{
if (rcmail.env.task == 'mail') {
- var textarea = tinyMCE.get('compose-body').getElement();
- var editor = tinyMCE.get('compose-body').getContentAreaContainer().childNodes[0];
- if (textarea && editor)
- editor.tabIndex = textarea.tabIndex;
+ var editor = tinyMCE.get(rcmail.env.composebody);
+ var textarea = editor.getElement();
+ var node = editor.getContentAreaContainer().childNodes[0];
+ if (textarea && node)
+ node.tabIndex = textarea.tabIndex;
}
}
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 1d3a3df..1e05c43 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -353,7 +353,7 @@
unset($attrib['form']);
if (empty($attrib['id']))
- $attrib['id'] = 'rcmComposeMessage';
+ $attrib['id'] = 'rcmComposeBody';
$attrib['name'] = '_message';
@@ -413,6 +413,8 @@
$textarea = new html_textarea($attrib);
$out .= $textarea->show($body);
$out .= $form_end ? "\n$form_end" : '';
+
+ $OUTPUT->set_env('composebody', $attrib['id']);
// include HTML editor
rcube_html_editor();
@@ -874,7 +876,7 @@
$useHtml = ($useHtml && $MESSAGE->has_html_part());
if (empty($attrib['editorid']))
- $attrib['editorid'] = 'rcmComposeMessage';
+ $attrib['editorid'] = 'rcmComposeBody';
if (empty($attrib['name']))
$attrib['name'] = 'editorSelect';
--
Gitblit v1.9.1