Fullscreen
Loading...
 
[Show/Hide Right Column]

English

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
- <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.












Contributors to this page: robferguson11 points  .
Page last modified on Monday 23 February, 2009 17:48:52 UTC by robferguson11 points .
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.

Site Language

Reference Guide

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):



Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki