diff options
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/program/js/app.js b/program/js/app.js index 2018cfbc4..9dca320dd 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3617,11 +3617,15 @@ 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); + var result = this.editor.toggle(props.html, props.noconvert || false); + + // satisfy the expectations of aftertoggle-editor event subscribers + props.mode = props.html ? 'html' : 'plain'; if (!result && e) { // fix selector value if operation failed - $(e.target).filter('select').val(props.html ? 'plain' : 'html'); + props.mode = props.html ? 'plain' : 'html'; + $(e.target).filter('select').val(props.mode); } if (result) { @@ -3924,7 +3928,7 @@ function rcube_webmail() // initialize HTML editor if ((formdata._is_html == '1' && !html_mode) || (formdata._is_html != '1' && html_mode)) { - this.command('toggle-editor', {id: this.env.composebody, html: !html_mode}); + this.command('toggle-editor', {id: this.env.composebody, html: !html_mode, noconvert: true}); } } }; @@ -3961,6 +3965,19 @@ function rcube_webmail() if (!show_sig) show_sig = this.env.show_sig; + var id = obj.options[obj.selectedIndex].value, + sig = this.env.identity, + delim = this.env.recipients_separator, + rx_delim = RegExp.escape(delim); + + // enable manual signature insert + if (this.env.signatures && this.env.signatures[id]) { + this.enable_command('insert-sig', true); + this.env.compose_commands.push('insert-sig'); + } + else + this.enable_command('insert-sig', false); + // first function execution if (!this.env.identities_initialized) { this.env.identities_initialized = true; @@ -3970,11 +3987,6 @@ function rcube_webmail() return; } - var id = obj.options[obj.selectedIndex].value, - sig = this.env.identity, - delim = this.env.recipients_separator, - rx_delim = RegExp.escape(delim); - // update reply-to/bcc fields with addresses defined in identities $.each(['replyto', 'bcc'], function() { var rx, key = this, @@ -4008,14 +4020,6 @@ function rcube_webmail() input.val(input_val).change(); }); - // enable manual signature insert - if (this.env.signatures && this.env.signatures[id]) { - this.enable_command('insert-sig', true); - this.env.compose_commands.push('insert-sig'); - } - else - this.enable_command('insert-sig', false); - this.editor.change_signature(id, show_sig); this.env.identity = id; this.triggerEvent('change_identity'); |