How to Integrate TinyMce with Redbox in 5 steps ?

TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.

Redbox is a library that pops a modal box over a web page, using CSS and javascript, so that you can ask the user a question, or show them something important. The box can be loaded from content already on the page (but hidden), or it can be loaded via AJAX. The contents of the box can be replaced using AJAX, for multi-page forms, and it can be closed easily using a javascript link.

Here is the process for integrating Redbox and TinyMCE.

Step I:
Install required plugins:

- TinyMce(http://github.com/kete/tiny_mce/tree/master)
- RedBox

Step II:
Include javascript files to layout:

Now, add this javascript method which initializes the text editor. You can specify the options you want for your text editor here.

Javascript:


Step III:

 

Add editor class "mceEditor" to the text area where you want the editor to be added.

Now, we need to create a tinymce editor control for the text area('ta_id') on loading the popup so add this "execCommand" loads the tinyMCE in the textarea.

Step IV:

 

When we submit our form and copy over the editor content to the text box it references. Tinymce provides a method 'triggerSave' that moves the contents from the editor to the form field. This method is automatically called by tinyMCE by adding a trigger on the forms submit method.

Save the content:

Step V:

 

Whenever we close our popup redbox we need to remove the tinymce editor control that we had added. Remove control on closing the redbox:

Works on: Firefox(1.5+), Safari and IE(7+)

For Internet Explorer we need to initialize the editor on loading the pop-up but for firefox we need to initalize editor on loading the main page. So we need modify our javascript

And so here we are ready to go in just five simple steps.

Refer here for more details.