Loading...
 

Using FCKEDITORS templates button for wiki plugins


By utilizing the existing template button within the fckeditor, we can convert its functionality for using wiki plugins. This is good if you want a "one-click" work flow for wiki plugins. Sometimes you have less tech-savvie users who want to be able to click and have wiki syntax automatically inserted, rather than looking it up and copying the plugin from the table below the editor.

Here are some steps I've taken to setup/configure the existing button to operate as a wiki plugin inserter.

1. Get the tikitemplates.xml file from lib/fckeditor_tiki

2. Open it and you will find the 3 existing template files that come with fckeditor. These are contained in <Template> tags which have also a description and title attributes to describe what your syntax does. Within these tags there is CDATA tags. This is what gets inserted into the wiki so here is where you put your wiki plugin syntax.

Here is an example of 2 options I made to go with my footnotes plugin.

Image
Copy to clipboard
- <Templates imagesBasePath="fck_template/images/"> - <Template title="Insert Footnote"> <Description>A footnote inserter.</Description> - <Html> - <![CDATA[ {FOOTNOTE()}insert footnote here{FOOTNOTE} ]]> </Html> </Template> - <Template title="Insert Footnote Area"> <Description>Collects and displays footnotes created by the Insert Footnote syntax.</Description> - <Html> - <![CDATA[ {FOOTNOTEAREA()/} ]]> </Html> </Template> </Templates>


3. Once that's saved, you want to go into the lib/fckeditor/fckconfig.js file. This is where you will need to get rid of the checkbox in the template dialog that replaces the content by default. Essentially since this is designed to take over the doc with a template, it will erase everything you already have in there, we don't want this. So go to line 93-94 and set FCKConfig.TemplateReplaceAll = false ; and FCKConfig.TemplateReplaceCheckbox = false ;

This will remove the button so whenever you add your wiki plugin syntax, it will be inserted wherever your cursor was.










List Slides