Search code examples
node.jsckeditorhandlebars.js

How to use ckeditor in nodejs application?


I am developing a crud application in nodejs using handlebars templating engine. Now I want to add editor like ckeditor or any similar kind of editor in my application.


Solution

  • CKEditior is a front-end plug-in that runs directly in the browser you use it like any other front-end js plugin here is an example

      <div class="entry">
       <script src="https://cdn.ckeditor.com/4.9.1/standard/ckeditor.js"></script>
     <h1>{{title}}</h1>
     <div class="body">
      <textarea name="editor1"></textarea>
        <script>
            CKEDITOR.replace( 'editor1' );
        </script>
       {{body}}
     </div>
    </div>
    

    in the json:

    {
     title: "My New Post",
     body: "This is my first post!"
    }
    

    you can try it here: tryhandlebar