【发布时间】:2018-07-26 22:48:08
【问题描述】:
我有这个旧代码
// myenter.js, enter key is binded to insertParagraph command.
$.summernote.addPlugin({
name : 'myenter',
events : {
// redefine insertParagraph
'insertParagraph' : function(event, editor, layoutInfo) {
//you can use summernote enter
//layoutInfo.holder().summernote('insertParagraph');
// also you can use your enter key
layoutInfo.holder().summernote('insertNode', document.createTextNode("\r\n"));
// to stop enter key
//e.preventDefault();
}
}
});
$('.summernote').summernote({ height : 300 });
但现在添加插件的方法已经改变,我希望通过此代码使用新版本的此功能
$.extend($.summernote.plugins, {
'myenter': function (context) {
console.log('myenter');
}
});
但它根本没有被调用
我曾尝试通过以下方式获得相同的功能
summernote.onEnter
和
summernote.keyPress
但它给出了错误..
【问题讨论】:
-
您能否详细说明您的代码“不起作用”的原因?你期待什么,实际发生了什么?如果您遇到异常/错误,请发布它发生的行和异常/错误详细信息。请edit这些详细信息,否则我们可能无法提供帮助。
标签: summernote