javascript - how to integrate TinyMCE and CKEditor in Meteor JS? -
i trying use ckeditor or tinymce editor in project. put tinymce folder in meteor public folder, 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. receiving following error. resource interpreted script transferred 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 not defined
how fix problem? same ckeditor. there other rich editor ,which can use in meteor js?
first, need put ckeditor build download in public folder. ckeditor comes sorts of stuff , references based on relative directories.
your public folder should have directory named ckeditor should contain contain following files , folders:
adapters lang plugins skins ckeditor.js config.js contents.css styles.js
in primary layout file reference ckeditor so:
<head> <script type="text/javascript" src="/ckeditor/ckeditor.js"></script> <script type="text/javascript" src="/ckeditor/adapters/jquery.js"></script> </head>
in template:
<template name="yourtemplate"> <textarea id="content" name="content"></textarea> </template>
finally, in rendered function of template:
template.yourtemplate.rendered = function() { $('#content').ckeditor(); };
normally, this.$('#content').ckeditor()
doesn't work because ckeditor in public folder. result, need global reference #content
element.
Comments
Post a Comment