【问题标题】:Meteor: Has anyone used Summernote editor successfully?Meteor:有没有人成功使用过 Summernote 编辑器?
【发布时间】:2014-07-08 06:19:07
【问题描述】:

有没有人成功使用过 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. 

有什么想法值得赞赏吗?

【问题讨论】:

标签: meteor summernote


【解决方案1】:

我证明了编辑器并完美地工作。我将代码编辑器放在文件夹 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

【讨论】:

  • 非常感谢......在使用 Meteor 0.9.2 rc 进行移动/潜在重写的过程中,所以暂时不会讨论这个问题。再次感谢
猜你喜欢
  • 2016-02-10
  • 1970-01-01
  • 2013-04-21
  • 1970-01-01
  • 2017-01-10
  • 2014-04-15
  • 2010-11-30
  • 1970-01-01
  • 2013-05-14
相关资源
最近更新 更多