From d1d9fd84b7329db9956c616ed6e4a6d2a0e485c9 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 08 Apr 2011 03:44:19 -0400
Subject: [PATCH] - Prevent javascript error if TinyMCE is not initialized (#1487862)
---
program/js/app.js | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/program/js/app.js b/program/js/app.js
index 384f45f..4ac7b0a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3021,11 +3021,11 @@
this.compose_field_hash = function(save)
{
// check input fields
- var value_to = $("[name='_to']").val();
- var value_cc = $("[name='_cc']").val();
- var value_bcc = $("[name='_bcc']").val();
- var value_subject = $("[name='_subject']").val();
- var str = '';
+ var ed, str = '',
+ value_to = $("[name='_to']").val(),
+ value_cc = $("[name='_cc']").val(),
+ value_bcc = $("[name='_bcc']").val(),
+ value_subject = $("[name='_subject']").val();
if (value_to)
str += value_to+':';
@@ -3036,9 +3036,8 @@
if (value_subject)
str += value_subject+':';
- var editor = tinyMCE.get(this.env.composebody);
- if (editor)
- str += editor.getContent();
+ if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)))
+ str += ed.getContent();
else
str += $("[name='_message']").val();
@@ -3984,11 +3983,11 @@
this.env.contactfolders[newkey] = this.env.contactfolders[key];
this.env.contactfolders[newkey].id = prop.newid;
this.env.group = prop.newid;
-
+
var newprop = $.extend({}, prop);
newprop.id = prop.newid;
newprop.type = 'group';
-
+
link = $('<a>').attr('href', '#')
.attr('rel', prop.source+':'+prop.newid)
.bind('click', function() { return rcmail.command('listgroup', newprop, this);})
@@ -4008,7 +4007,7 @@
{
if (!elem)
elem = $('.ff_' + col);
-
+
elem.focus(function(){ ref.focus_textfield(this); })
.blur(function(){ ref.blur_textfield(this); })
.each(function(){ this._placeholder = this.title = ref.env.coltypes[col].label; ref.blur_textfield(this); });
--
Gitblit v1.9.1