admin管理员组

文章数量:1323330

I am trying to use CKEditor or TinyMCE editor in my project. So I put TinyMCE folder in meteor public folder, also put

<head>
<script type="text/javascript" src="<your installation path>/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
    tinymce.init({
        selector: "textarea"
    });
</script>

in template head tag. However receiving following error. Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/%3Cyour%20installation%20path%3E/tinymce/tinymce.min.js". (index):97 Uncaught SyntaxError: Unexpected token < tinymce.min.js:1 Uncaught ReferenceError: tinymce is not defined

How do I fix this problem? It is same to CKEditor. Is there any other rich editor ,which I can use in Meteor JS?

I am trying to use CKEditor or TinyMCE editor in my project. So I put TinyMCE folder in meteor public folder, also put

<head>
<script type="text/javascript" src="<your installation path>/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
    tinymce.init({
        selector: "textarea"
    });
</script>

in template head tag. However receiving following error. Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/%3Cyour%20installation%20path%3E/tinymce/tinymce.min.js". (index):97 Uncaught SyntaxError: Unexpected token < tinymce.min.js:1 Uncaught ReferenceError: tinymce is not defined

How do I fix this problem? It is same to CKEditor. Is there any other rich editor ,which I can use in Meteor JS?

Share Improve this question asked Sep 24, 2014 at 7:13 zevsuldzevsuld 2764 silver badges15 bronze badges 1
  • Here is how to integrate Aloha Editor in Meteor, maybe it can help: stackoverflow./questions/13961737/… – steph643 Commented Oct 11, 2014 at 14:10
Add a ment  | 

3 Answers 3

Reset to default 7

First, you need to put everything from the CKEDITOR build download in the public folder. CKEDITOR es with all sorts of stuff and references everything based on relative directories.

Your public folder should have a directory named ckeditor it should contain contain the following files and folders:

 adapters
 lang
 plugins
 skins
 ckeditor.js
 config.js
 contents.css
 styles.js

In your primary layout file reference CKEDITOR like so:

 <head>
   <script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
   <script type="text/javascript" src="/ckeditor/adapters/jquery.js"></script>
 </head>

In your template:

 <template name="yourTemplate">
   <textarea id="content" name="content"></textarea>
 </template>

Finally, in the rendered function of your template:

 Template.yourTemplate.rendered = function() {
   $('#content').ckeditor();
 };

Normally, you would say this.$('#content').ckeditor() but that doesn't work because CKEDITOR is in your public folder. As a result, you need to the global reference to the #content element.

Instead of /public folder, put your files in /client/patibility. Then initialize it in the template you want to use it.

Template.editor.rendered = function() {
  tinymce.init({
    selector: 'textarea'
  });
};

This was the only result searching for wysiwyg:

https://github./mcrider/meteor-bootstrap-wysiwyg

meteor add mcrider:bootstrap-wysiwyg

Looks a bit simpler than CKEditor or TinyMCE but maybe that's ok for your project.

本文标签: javascripthow to integrate TinyMCE and CKEditor in Meteor JSStack Overflow