[英]tinyMCE: how to add shortcut Ctrl+Enter
How can I add shortcut Ctrl + Enter to tinyMCE (v4) to make it post the form the editor is used with? 如何在tinyMCE (v4)中添加快捷键Ctrl + Enter ,以使其发布与编辑器一起使用的表单? 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>
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 必须阅读代码以找出答案https://github.com/tinymce/tinymce/blob/ccff8e084b389fca45399b916261a12cd4418f79/src/core/src/main/js/Shortcuts.js#L50
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.