diff options
author | Aleksander Machniak <alec@alec.pl> | 2019-11-27 11:21:23 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2019-11-27 11:21:23 +0300 |
commit | 57476c09f9459cfb7c791a6ee6d5282f15dad67e (patch) | |
tree | c0a5e05acf63078839a8cd1c9b49cd59beb1aae1 /program | |
parent | 604e81489842473f2649471769051f42a3fb5309 (diff) |
Fix bug where cancelling switching from HTML to plain text didn't set the flag properly (#7077)
Diffstat (limited to 'program')
-rw-r--r-- | program/js/app.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/program/js/app.js b/program/js/app.js index fc7083e1d..d68d2295d 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4933,19 +4933,21 @@ function rcube_webmail() this.toggle_editor = function(props, obj, e) { // @todo: this should work also with many editors on page - var result = this.editor.toggle(props.html, props.noconvert || false), - control = $('#' + this.editor.id).data('control') || $(e ? e.target : []); + var mode, result = this.editor.toggle(props.html, props.noconvert || false), + control = $('#' + this.editor.id).data('control') || $(e ? e.target : []); - // satisfy the expectations of aftertoggle-editor event subscribers - props.mode = props.html && result ? 'html' : 'plain'; + if (result) + mode = props.html ? 'html' : 'plain'; + else + mode = props.html ? 'plain' : 'html'; // update internal format flag - $("[name='_is_html']").val(props.mode == 'html' ? 1 : 0); + $("[name='_is_html']").val(mode == 'html' ? 1 : 0); if (control.is('[type=checkbox]')) - control.prop('checked', props.mode == 'html'); + control.prop('checked', mode == 'html'); else - control.val(props.mode); + control.val(mode); return result; }; |