diff options
author | Aleksander Machniak <alec@alec.pl> | 2019-11-12 11:14:48 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2019-11-18 17:30:23 +0300 |
commit | 22d629a0e9963f94c619b87080dd1f6c05174f10 (patch) | |
tree | 7563fcc6ebdbd927875494b7c02bb3fefa5322bf /program | |
parent | 110eebdd1b106b590a8dc660e005e29696e44a22 (diff) |
Elastic: Fix regression in the new editor widget (#7021)
Diffstat (limited to 'program')
-rw-r--r-- | program/js/app.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/program/js/app.js b/program/js/app.js index 75ad1f12b..36d14c1fb 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4938,21 +4938,19 @@ 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); + var 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 ? 'html' : 'plain'; + props.mode = props.html && result ? 'html' : 'plain'; - if (!result && e) { - // fix selector value if operation failed - props.mode = props.html ? 'plain' : 'html'; - $(e.target).filter('select').val(props.mode); - } + // update internal format flag + $("[name='_is_html']").val(props.mode == 'html' ? 1 : 0); - if (result) { - // update internal format flag - $("[name='_is_html']").val(props.html ? 1 : 0); - } + if (control.is('[type=checkbox]')) + control.prop('checked', props.mode == 'html'); + else + control.val(props.mode); return result; }; |