我试图将CKEditor与meteor一起使用。
首先我添加了包
https://libraries.io/meteor/lsun:ckeditor
然后我添加了以下代码:
route.js
Router.route('/editor', function () {
this.render('editor');
});
editor.html
<template name="editor">
<form>
<textarea name="editor1" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
</form>
</template>
helpers.js
Template.editor.rendered = function() {
CKEDITOR.replace( 'editor1' );
};
现在,当我浏览到我的/编辑器路径时,我可以看到最初加载的ckeditor。但是,如果我在页面上按F5,那么我开始得到普通的textarea,而没有ckeditor用编辑器替换它。另外,我在javascript控制台中收到以下错误:
Exception from Tracker afterFlush function:
meteor.js:888
ReferenceError: CKEDITOR is not defined
at Template.editor.rendered (helpers.js:10)
at blaze.js:3338
at Function.Template._withTemplateInstanceFunc (blaze.js:3679)
at fireCallbacks (blaze.js:3334)
at null.<anonymous> (blaze.js:3427)
at blaze.js:1788
at Object.Blaze._withCurrentView (blaze.js:2219)
at blaze.js:1787
at Object.Tracker._runFlush (tracker.js:531)
at onGlobalMessage (meteor.js:373)