Reputation: 36840
How can I add shortcut Ctrl+Enter to tinyMCE (v4) to make it post the form the editor is used with? I've tried this but doesn't appear to work:
<script><!--
$('#txtField1').tinymce({
script_url:"js/tinymce/tinymce.min.js",
content_css:"css/editor.xxm",
//etc. all of my other config goes here
setup: function(e){
e.shortcuts.add("ctrl+enter","submit",function(){document.form[0].submit();});}
});
//--></script>
Upvotes: 2
Views: 763
Reputation: 1190
For some reason "enter" isn't one of the "modifier names" that they define. However, you can use key codes. So this works:
e.shortcuts.add("ctrl+13"...
Had to read the code to figure it out https://github.com/tinymce/tinymce/blob/ccff8e084b389fca45399b916261a12cd4418f79/src/core/src/main/js/Shortcuts.js#L50
Upvotes: 6