Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CKEditor / TinyMCE with Meteor

What's the best approach to use complex JS packages like CKEditor or TinyMCE with Meteor? They both rely on a specific directory tree to dynamically load JS files or CSS at run-time, which makes it complex to create a Meteor package from them.

It also sounds overkill to try to get Meteor to load & integrate CKEditor along with the rest of Meteor & app code. I tried simply putting it in the public directory (to load it by adding a <script> tag in the header), but Meteor tried to load the files anyway, and crashed:

node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: watch EMFILE
   at errnoException (fs.js:636:11)
    at FSWatcher.start (fs.js:663:11)
    at Object.watch (fs.js:691:11)
    at [object Object]._scan (/var/www/meteor/app/meteor/run.js:322:12)
    at Array.forEach (native)
    at Function.<anonymous> (/var/www/meteor/app/lib/third/underscore.js:76:11)
    at new <anonymous> (/var/www/meteor/app/meteor/run.js:264:5)
    at /var/www/meteor/app/meteor/run.js:455:17
    at /var/www/meteor/app/meteor/run.js:512:5
    at /var/www/meteor/app/meteor/run.js:570:9
like image 252
Xavier Antoviaque Avatar asked Oct 07 '22 23:10

Xavier Antoviaque


1 Answers

Without testing if this works, I would suggest putting it in the public folder where Meteor won't try to compile the files. Then in your template, in the head section place code like:

<script type="text/javascript" src="/public/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
    tinyMCE.init({
        mode : "textareas",
        theme : "simple"
    });
</script>

I believe this is what you need to do

like image 190
jonathanKingston Avatar answered Oct 13 '22 12:10

jonathanKingston