Adding YUI RTE in MovableType Community Solution

Richard Benson13 May 2010MovableType, MT Tipscomments

On certain sites, you may want to allow your users a little more freedom with their comments, or if you're using the community templates in MovableType, then you may want to improve the "Create Entry" screens to allow rich text.

 
I managed to squeeze the YUI RTE into a stock forum template set, then just haven't got round to writing it up yet. ?You can see it in action here, and below the jump is the write-up, it's surprisingly easy!
 
I've also put it on here, for registered commenters, something else that needs a write-up really!

Create Entry

 

First up, we need to edit the "Create Entry" template, look for this line:

 
 
And immediately after it, paste the following code:
 
 
This loads the relevant YUI modules onto the page for later use. ?You will also need to add the "yui-skin-sam" class to your body tag. ?Luckily this template set allows you to easily edit the body class, look at the first line of this template and change it to the following:
 
 
The last stage in this template is to add the code that will actually generate the editor on the page. ?Paste the following after the "Entry Form" include and before the "Footer":
 


You're done with the Create Entry template for now, but don't bother publishing, just save, as we need to change the JS files before it will post properly.
 
Now, the next stage requires editing the "GlobalJavaScript" template, which will affect all your blogs/sites that use it on this MT installation, so if you only want to apply this change to one
blog/site/forum then you will need to copy the template into the site's templates and edit there.
 
In "GlobalJavaScript" look for the "mtCommentOnSubmit" function and add the line:
 
myEditor.saveHTML();
 
On line 3 of that function (after the first "mtRequestSubmitted = true;").

Re-publish and you're done.

Coming up soon, adding YUI RTE to replies and to a normal blog install.
comments powered by Disqus
Support Ticket
Remote Support
Support
clever girl