dotCMS - Open Source Content Management System, Ondemand CMS, and Professional Support

Document Search

Article Information

Since Version: 1.7
Tags: plugins
Updated: 4/23/2009 4:55:10 PM
By: Jason Tesser
Doc id: 170502
Print Page: Export to PDF

Controlling TinyMCE

If you need to control the WYSIWYG editor in dotCMS you can. TinyMCE config is done via Javascript. dotCMS provides you a JSP with the Javascript variable. The reason it is done in a JSP is that you can break into Java and configure your WSYIWYG based on custom rules like permissions for example. You can also add custom TinyMCE plugin here.

The plugins must be placed in the tinymce directory on your plugin.

Please be aware that only one dotCMS plugin can provide the TinyMCE plugins config file (this file). The first plugin according to the normal plugin loading order rules will be the one whose config file is used.

Place a section like this on your web-ext.xml to have dotCMS use your config (remove hello.world with your plugin name):

<servlet>
	<servlet-name>hello.world.tiny_mce_config</servlet-name>
	<servlet-class>org.apache.jsp.plugins.hello.world.tiny_005fmce_005fconfig_jsp</servlet-class>
</servlet>
<servlet-mapping>
	<servlet-name>hello.world.tiny_mce_config</servlet-name>
	<url-pattern>/html/portlet/ext/contentlet/field/tiny_mce_config.jsp</url-pattern>
</servlet-mapping>

Once plugins are deployed to the server, they will will be prefixed with plugin_XXXX_ (where XXXX is your plugin name). Therefore your config must use this name. Also, you need to make sure the TinyMCE plugin is registering itself with the correct name. This normally happens in editor_plugin.js in this line:

tinymce.PluginManager.add('myplugin', tinymce.plugins.TinyMCECssExtras);

Which should be changed to read:

tinymce.PluginManager.add('plugin_hello.world_myplugin', tinymce.plugins.TinyMCECssExtras);

Make sure your plugin has no - character in its name. Use _ instead.



Post a Comment


Add Comments

   

 
Post