Experimental project
This is a sandbox project, which contains experimental code for developer use only.
This module allows the creation of templates for the CK Editor through the admin interface.
Background
The CK Editor is a very nice wysiwyg editor that has been integrated in Drupal with the module found at http://drupal.org/project/ckeditor. An interesting feature of the CK Editor is the use of templates. A template consists of predefined HTML that can be used as a starting point for newly created nodes.
The problem
One drawback of this system is the way these templates are created: the templates are strings in a javascript file. Two disadvantages of this are that it's a very user-unfriendly way of entering HTML, and when a template is created modified, the updated code needs to be deployed to your production environment.
The solution
This module uses Drupal's nodes to create templates. It defines its own node type that will only be used for creating templates, and that will be hidden from public view (as it is not real content). Adding a new template to the CK editor is now as simple as creating it in the Drupal interface. It will be immediately available as a template in the CK editor.
Installation
1. Install CK Editor (instructions on http://drupal.org/project/ckeditor)
2. In the CK Editor settings, make sure you select a toolbar that includes the templates button
3. Install the CK Templates module from the current page
4. Open the ckeditor.config.js configuration file in your CK Editor installation and add the following line inside the CKEDITOR.editorConfig function: config.templates_files = [ '/ck_templates.js'];
Coloured HTML syntax (optional)
In your CK Templates installation you will find an almost empty codemirror directory. Codemirror is an awesome javascript library developed by Marijn Haverbeke for adding coloured code and automatic indentation to textareas. By downloading the library and placing it in the codemirror directory inside your CK Templates directory, you will get these functionalities while creating / modifying templates for the CK Editor. NOTE: please make sure that when you download codemirror, that you don't copy the downloaded codemirror directory, but it's contents into the codemirror directory in the CK Templates directory.
Project information
- Project categories: Content editing experience, Integrations
- Created by wkjagt on , updated