5

有人成功用过 Meteor 的 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. 

任何想法赞赏?

4

1 回答 1

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
于 2014-09-07T23:49:59.897 回答