summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-02-19 08:27:35 (GMT)
committerAleksander Machniak <alec@alec.pl>2015-02-19 08:27:35 (GMT)
commit317bd4da63bd4d7c9c14d41aca373fc095efc3a3 (patch)
treed17a9b6ef4fa59a0d49f1ce97a19d5caa591d278 /plugins
parent1b9bc154ec3005de298db258e71e73b6ae7736c2 (diff)
downloadroundcubemail-plugins-kolab-317bd4da63bd4d7c9c14d41aca373fc095efc3a3.tar.gz
Fix Shift+H shortcut so it does what it should and make it really working
Diffstat (limited to 'plugins')
-rw-r--r--plugins/kolab_shortcuts/kolab_shortcuts.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/kolab_shortcuts/kolab_shortcuts.js b/plugins/kolab_shortcuts/kolab_shortcuts.js
index 123494b..f09d82a 100644
--- a/plugins/kolab_shortcuts/kolab_shortcuts.js
+++ b/plugins/kolab_shortcuts/kolab_shortcuts.js
@@ -129,12 +129,22 @@ var kolab_shortcuts = {
},
'mail.html2text': {
key: 72, // H
- active: function(e) { return rcmail.task == 'mail' && rcmail.env.action == 'compose'; },
+ active: function(e) { return rcmail.task == 'mail'; },
action: function(e) {
- var selector = $('[name="editorSelector"]'),
- data = {id: 'composebody', html: selector.val() != 'html'};
+ var rc = rcmail;
+
+ // we're in list mode, get reference to preview window
+ if (rc.env.contentframe) {
+ var win = rc.get_frame_window(rc.env.contentframe);
+ if (!win || !win.rcmail)
+ return false;
+ rc = win.rcmail;
+ }
- return rcmail.command('toggle-editor', data, selector, e);
+ if (rc.env.optional_format) {
+ var format = rc.env.optional_format == 'html' ? 'html' : 'text';
+ return rc.command('change-format', format, e.target, e);
+ }
}
}
};
@@ -190,6 +200,7 @@ var kolab_shortcuts_keypress = function(e)
// execute action, the real check if action is active
// will be done in .action() or in rcmail.command()
handler.action(e);
+ e.preventDefault();
return false;
}