Hi I've tried a numerous amounts of "googled" snippets for disabling enter / return key but nothing is working. Any ideas on how to disable the enter / return key whilst in tinyMCE textarea?
Here is the code I used to disable the enter key on certain inline elements. It works with 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
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.