[英]disableing enter/return key from within Tiny MCE
Hi I've tried a numerous amounts of "googled" snippets for disabling enter / return key but nothing is working. 嗨,我已经尝试过使用大量“ googled”片段来禁用输入/返回键,但是没有任何效果。 Any ideas on how to disable the enter / return key whilst in tinyMCE textarea? 关于在tinyMCE textarea中如何禁用回车键的想法?
Here is the code I used to disable the enter key on certain inline elements. 这是我用来禁用某些内联元素上的Enter键的代码。 It works with TinyMCE 4: 它适用于TinyMCE 4:
tinymce.init({
tinymce_jquery: true,
selector: ".className",
inline: true,
toolbar: "undo redo",
menubar: false,
setup : function(ed) {
ed.on('keydown', function(e) {
if (e.keyCode == 13) {
e.preventDefault();
}
});
}
});
Hai Phil, 海·菲尔
ed.onKeyPress.addToTop(function(ed, e) {
if ((e.charCode == 13 || e.keyCode == 13)) {
ed.setContent("");
return tinymce.dom.Event.cancel(e);
}});
Or refer this Disable enter key on tiny mce editor 或在tiny mce编辑器上参考此禁用Enter键
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.