So basically for my TinyMCe editor I want to add a shortcut like ctrl+Enter which I can then trigger some behaviour.
I found the custom shortcut docs: https://www.tiny.cloud/docs/api/tinymce/tinymce.shortcuts/ https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#addshortcut
But couldn't find any reference of how I can check for an "Enter" key with a "ctrl" key. All the examples are for combinations like "ctrl+a", "meta+a" etc.
Anyone know how to do a "ctrl+Enter" combo?
I'm currently using v5
You just need to use the numeric key code ( 13
) combined with the meta key name ( ctrl
) like this:
editor.shortcuts.add('ctrl+13', 'Test CTRL ENTER', function() {
alert('CTRL ENTER!');
// do whatever you need to do here!
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.