My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CKEditorFormControl  
Describes the features the CKEditor form control
Addon-Forms, AlfrescoVersion-3.x
Updated May 19, 2012 by loftux.p...@gmail.com

Introduction

This is an addon to Share forms that lets you use the CKEditor as a wysiwyg editor for online edits. CKEditor, http://ckeditor.com/, is a separately developed tool, this addon provides the integration to Alfresco forms. CKEditor is GPL, LGPL MPL Triple copy left licensed.

Features

  • Standard CKEditor features
  • Load custom configuration files for customized toolbar and looks
  • Browse Share site images, thumbnails and large previews, and insert into page
  • Browser addon available in Swedish and English, the core CKEditor in 50+ languages.

Usage

The control should appear when you create a new html file, or edit an existing html file online. To insert images from a Share site, select the images button, and then Browse Server. To get a larger preview, click the thumbnail image. To select an image, click the name.

Installation

The CKEditor form control is packaged as a single JAR file for easy installation into Alfresco Share.

To install the control

  • Drop the ckeditor-form-control.jar file into the tomcat/shared/lib folder within your Alfresco installation
  • Update your form configuration files. You can use the ckeditor-config-custom.xml (download) file by removing sample extension and place it in tomcat/shared/classes/alfresco/web-extension. This may override other changes you have made for forms. so use with caution.
  • Restart the application server.

Forms configuration

In you forms configuration file, under apperance, add

<appearance>
   <field id="cm:content">
      <control template="/org/alfresco/components/form/controls/ckeditor.ftl">
         <control-param name="forceEditor">true</control-param>
      </control>
   </field>
</appearance>

To load a custom javascript based file use

<appearance>
   <field id="cm:content">
      <control template="/org/alfresco/components/form/controls/ckeditor.ftl">
         <control-param name="forceEditor">true</control-param>
         <control-param name="settingsfile">components/editors/ckeditor/my-config.js</control-param>
      </control>
   </field>
</appearance>

Path to custom settings file should not have a starting /. More information on how to create custom configuration files can be found in http://docs.cksource.com/CKEditor_3.x/Developers_Guide. Use the http://share-extras.googlecode.com/svn/trunk/CKEditor%20Form%20Control/source/web/components/editors/ckeditor/config.js as a template.

Loading forms dependencies

The ckeditor-form-control.jar includes configuration to load javascript dependencies. However if you have other configuration in a custom config file this may overwrite this configuration. Only do this step if CKEditor fails to load.

   	<config>
		<forms>
	        <dependencies>
	         <!-- Include some extra assets --> 
				<js src="/modules/editors/ckeditor/ckeditor.js" />
				<js src="/components/editors/ckeditor/ckeditorloader.js" />
	        </dependencies>
 		</forms>
	</config>

If you notice that the above javascript files do not load when creating or editing an html file, merge this configuration to your share-config-custom.xml file. Indication that this is happening is that the textarea is blank and the editor has failed to load.

Building from source

Check out the project if you have not already done so

svn checkout http://share-extras.googlecode.com/svn/trunk/CKEditor%20Form%20Control

Change into the new directory

cd "CKEditor form control"

An Ant build script is provided to build a JAR file containing the custom files, which can then be installed into the tomcat/shared/lib folder of your Alfresco installation.

To build the JAR file, run the following command from the base project directory.

ant clean dist-jar

The command should build a JAR file named ckeditor-form-control.jar in the dist directory within your project, which you can then copy into the tomcat/shared/lib folder of your Alfresco installation.

Alternatively, you can use the build script to hot deploy the JAR file directly into a local Tomcat instance for testing. You will need to use the hotcopy-tomcat-jar task and set the tomcat.home property in Ant.

ant -Dtomcat.home=C:/Alfresco/tomcat clean dist-jar hotcopy-tomcat-jar

After you have deployed the JAR file you will need to restart Tomcat to ensure it picks up the changes.

Known Issues

None at this time.

Future Enhancements

Possible to add more out of the box configuration settings. Filters in image browser.

External Components

Contribution

This form control was contributed by Peter Löfgren, http://loftux.se (Swedish) http://loftux.com (English)

Comment by SJGreenbaum@gmail.com, Jun 6, 2011

Peter -- I installed this component and I was wondering if CKEditor is supposed to automatically replace TinyMCE when I Create Content (HTML) in the document library or is the scope only as a Share Forms component? The following line above led me to think think this might be possible OOTB: "The control should appear when you create a new html file, or edit an existing html file online." I tried it, but I get the TinyMCE editor when I create content in the document library. Thanks.

Comment by project member loftux.p...@gmail.com, Jun 8, 2011

The CKEditorFormControl is only available to Alfresco Share, not Alfresco Explorer. For Alfresco Share, for the control to appear when creating new files, find the <config evaluator="model-type" condition="cm:content"> section and the generic <form> and change the appearance for cm:content field as per the instructions. For editing, the section is <config evaluator="node-type" condition="cm:content"> and form id <form id="doclib-inline-edit">. This should make the CKEditor appear for both Share Repository and Share Collaboration Document Library. If not, please file an issue.

Comment by mathieuh...@gmail.com, Feb 23, 2012

Hi,

Really nice add on ! We're trying to set it up, however, I can't get where that 'site=demo' in the upload URL is coming from..

I have a space in alfresco that I want to browse, what am I supposed to put in the config file of ckeditor for the following parameter :

config.filebrowserImageBrowseUrl = Alfresco.constants.URL_CONTEXT + 'page/ckeditor-listimages?site=' + ???????

I'm really stucked deep in this, any help appreciated

thanks

Mat

Comment by project member loftux.p...@gmail.com, Feb 23, 2012

In the default config.js the client side constant: Alfresco.constants.SITE is used, that is populated with the current site id. I suggest you used that. Also check out and build the project yourself if you haven't done so, the compiled jar is unfortunately a bit outdated, I'll try to update this as soon as I have time.


Sign in to add a comment
Powered by Google Project Hosting