有没有人成功使用过Menote的Summernote编辑器?
请参阅http://hackerwins.github.io/summernote/
我在模板中包含了以下div:
<div id="summernote">Hello Summernote</div>
我像这样实例化:
Template.sometemplate.rendered = function(){
$('#summernote').summernote({
height: 200, //set editable area's height
focus: true //set focus editable area after Initialize summernote
});
}
控制台中的错误消息:
Resource interpreted as Script but transferred with MIME type text/html:
"http://localhost:3000/summernote.min.js". newcontentlayout:138
Uncaught SyntaxError: Unexpected token < summernote.min.js:1
Exception from Deps afterFlush function function: TypeError: undefined is not a function
at Object.Template.contentLayoutNew.rendered (http://localhost:3000/client/views/contentlayouts/contentlayout_new.js?cb9b5cd577322a6aec6c2ac6819121e7f43b8dc2:6:22)
at http://localhost:3000/packages/ui.js?f0696b7e9407b8f11e5838e7e7820e9b6d7fc92f:426:23
at _assign.flush (http://localhost:3000/packages/deps.js?91f1235baecd83915f7d3a7328526dbba41482be:345:13) debug.js:41
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
任何想法都赞赏?
答案 0 :(得分:6)
我证明了编辑并且完美地运作。我将代码编辑器放在文件夹Client中,因为它适用于对象窗口。之后,您的代码可以采用以下方式。
.html
<template name="editor">
<div id="summernote">Hello Summernote</div>
</template>
客户端文件夹中的 .js
Template.editor.rendered = function() {
$('#summernote').summernote({
height: 200, // set editable area's height
focus: true // set focus editable area after Initialize summernote
});
}
编辑器的文件
summernote.min.js
summernote.css
summernote-bs2.css
summernote-bs3.css