From 667ed37f77d0ca2557243a488822dad61ed6f625 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sun, 01 May 2016 10:39:10 -0400 Subject: [PATCH] Fix bug where Encrypt button appears when switching editor to HTML (#5235) --- CHANGELOG | 1 + program/js/app.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5600604..71ac25a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - Fix bug where getting HTML editor content could steal focus from other form controls (#5223) - Fix bug where contact search menu fields where always unchecked in Larry skin - Fix autoloading of 'html' class +- Fix bug where Encrypt button appears when switching editor to HTML (#5235) RELEASE 1.2-rc -------------- diff --git a/program/js/app.js b/program/js/app.js index e2c8930..e6203de 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1362,7 +1362,7 @@ if (!aborted && this.triggerEvent('after'+command, props) === false) ret = false; - this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted }); + this.triggerEvent('actionafter', { props:props, action:command, aborted:aborted, ret:ret }); return ret === false ? false : obj ? false : true; }; @@ -3477,6 +3477,12 @@ // enable encrypted compose toggle this.enable_command('compose-encrypted', !is_html); } + + // make sure to disable encryption button after toggling editor into HTML mode + this.addEventListener('actionafter', function(args) { + if (args.ret && args.action == 'toggle-editor') + ref.enable_command('compose-encrypted', !args.props.html); + }); } }; @@ -4294,8 +4300,6 @@ if (result) { // update internal format flag $("input[name='_is_html']").val(props.html ? 1 : 0); - // enable encrypted compose toggle - this.enable_command('compose-encrypted', !props.html); } return result; -- Gitblit v1.9.1