How to add or remove plugins without changing web assist generated code


Hi All,

I use come different plugins with CKEditor from time to time, and I thought I might share this information in case it is useful to someone.

Adding or removing plugins before the editor loads is a piece of cake. This can be useful if you want to include plugins which are not part of the WebAssist HTMLEditor extension. To use plugins that are not part of the WebAssist HTMLEditor extension, you either need to hard code the plugin into the configuration file for CKEditor, or add a line to the generated code. In either case, when you edit the editor instance, you have to reapply your changes.

NOTE: You can make changes to the CKEditor config.js file in the DreamWeaver configuration directory. Then you changes would appear EVERY time you use the editor.

This is also useful if you have hard coded an additional plugin because you use it most of the time, but don't want it on a particular page. In that case, you can't use the WebAssist GUI to control the plugin.

With this method, you won't have to do anything to the WebAssist code when you edit the HTMLEditor instance.

To include or remove an additional plugin to the editor per page, do the following:

The extension includes the CKEditor JavaScript file when the PHP code for the editor instance is created. That isn't soon enough to do this, so in the head of the document, include the file yourself.

<script type="text/javascript" src="/webassist/ckeditor/ckeditor.js"></script>

Now the object CKEDITOR has been instantiated. Just below this inclusion, add the following code:

<script type="text/javascript" src="/webassist/ckeditor/ckeditor.js"></script>
<script type="application/javascript" language="javascript">CKEDITOR.config.extraPlugins = 'bbcode';CKEDITOR.config.removePlugins = 'smiley';

This code would include the bbcode plugin and remove the smiley plugin from all subsequent CKEditor instances on the page.

I have not looked into adding or removing a plugin after the CKEditor instance has been created, so I do not know if that is feasible. That would be helpful for adding or removing plugins to a specific instance of the editor. Right now, the best way to do that is to add a line to the WA code like this:

$CKEditor_config["extraPlugins "] = "bbcode, adobeair";
$CKEditor_config["removePlugins "] = "smiley";

The above code will have to be redone if you use the WebAssist GUI to edit the instance of the HTMLEditor.