summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/app.js23
2 files changed, 14 insertions, 10 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b0326589d..7e33e8a40 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,6 +32,7 @@ CHANGELOG Roundcube Webmail
- Fix identities_level=4 handling in new_user_dialog plugin (#1489840)
- Fix various db_prefix issues (#1489839)
- Fix too small length of users.preferences column data type on MySQL
+- Fix redundant warning when switching from html to text in empty editor (#1489819)
RELEASE 1.0.0
-------------
diff --git a/program/js/app.js b/program/js/app.js
index 2451a6d3d..082a28ceb 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3458,17 +3458,8 @@ function rcube_webmail()
$(tinyMCE.get(props.id).getBody()).css('font-family', rcmail.env.default_font);
}, 500);
}
- else {
- var thisMCE = tinyMCE.get(props.id), existingHtml;
-
- if (existingHtml = thisMCE.getContent()) {
- if (!confirm(this.get_label('editorwarning'))) {
- return false;
- }
- this.html2plain(existingHtml, props.id);
- }
+ else if (this.html2plain(tinyMCE.get(props.id).getContent(), props.id))
tinyMCE.execCommand('mceRemoveControl', false, props.id);
- }
return true;
};
@@ -6831,6 +6822,16 @@ function rcube_webmail()
this.html2plain = function(htmlText, id)
{
+ // warn the user (if converted content is not empty)
+ if (!htmlText || !(htmlText.replace(/<[^>]+>|&nbsp;|\s/g, '')).length) {
+ // without setTimeout() here, textarea is filled with initial (onload) content
+ setTimeout(function() { $('#'+id).val(''); }, 50);
+ return true;
+ }
+
+ if (!confirm(this.get_label('editorwarning')))
+ return false;
+
var url = '?_task=utils&_action=html2text',
lock = this.set_busy(true, 'converting');
@@ -6840,6 +6841,8 @@ function rcube_webmail()
error: function(o, status, err) { ref.http_error(o, status, err, lock); },
success: function(data) { ref.set_busy(false, null, lock); $('#'+id).val(data); ref.log(data); }
});
+
+ return true;
};
this.plain2html = function(plain, id)