We all require a rich text editor in our applications whether it’s for composing a mail or just for writing a “about me” section of a profile. I’m going to show you how to integrate one such editor in your application. We’ll use CKeditor which is a WYSIWYG (What you see is what you get) type editor. So, let’s get started. Follow these simple steps:
Step 1) CKeditor is available as a grails plugin. So, our first step is to install the plugin. This is done by simply including the following string in your BuildConfig.
plugins { compile ":ckeditor:3.6.2.2" }
Step 2) Now, declare the following resource tag in your page’s <head> tag on which you want to put the rich text editor.
1 |
<ckeditor:resources/> |
Step 3) This is the final step. Just put the following tag in the <g:form> tag like <g:textArea> tag and you are done.
&amp;lt;g:form action="processProfileSubmission" class="form-horizontal" method="POST"&amp;gt; &amp;lt;ckeditor:editor name="aboutMe" height="400px" width="80%"&amp;gt; ${"About me..." } &amp;lt;/ckeditor:editor&amp;gt; &amp;lt;g:submitButton name="Submit" class="btn btn-inverse" title="submit" /&amp;gt; &amp;lt;/g:form&amp;gt;
I hope, this simple tutorial helps you.
Recent Comments