org.chenillekit.tapestry.core.components
Class Editor
java.lang.Object
org.apache.tapestry5.corelib.base.AbstractField
org.apache.tapestry5.corelib.base.AbstractTextField
org.chenillekit.tapestry.core.components.Editor
- All Implemented Interfaces:
- ClientElement, Field
@Import(library="fckeditor/fckeditor.js")
public class Editor
- extends AbstractTextField
The editor component provides a rich text editor as a form control.
Based on the FCKeditor, the editor
is highly configurable (and can therefore be complicated). This component
aims to keep usage simple, outsourcing most of the configuration to an
optional external javascript file.
The most important configurations are that of an external configuration
file and the toolbars present in the editor. To support this, the editor component
exposes the customConfiguration and toolbarSet
parameters.
In the interest of usability, the editor component will function as
classic textarea element.
NOTE: This component is built on the 2.x version of FCKeditor.
- Version:
- $Id: Editor.java 674 2010-07-29 12:47:25Z homburgs $
- See Also:
- FCKeditor developer's guide,
FCKeditor user's guide
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Editor
public Editor()
writeFieldTag
protected final void writeFieldTag(MarkupWriter writer,
String value)
- Specified by:
writeFieldTag in class AbstractTextField
getCustomizedConfigurationURL
protected String getCustomizedConfigurationURL(Asset configurationAsset)
- FCK loads itself via an iframe, in which its own html file is loaded that
takes care of bootstrapping the editor (which includes loading any custom
config files). This html file is stored on the classpath and when it loads
custom config files, it receives a relative name. The path of the html
file is:
org/chenillekit/tapestry/core/components/fckeditor/editor/fckeditor.html
Now when that page is loaded in the iframe, it will load the configuration
file by writing out a new script tag using the path it receives, which is
relative. Because the path is relative tapestry interprets the config file
to be a relative asset on the classpath (relative to the html file). So
it looks for this on the classpath:
org/chenillekit/tapestry/core/components/fckeditor/editor/myeditor.js
Instead of something like:
/MyApp/myeditor.js
The following hack mangles the URL by appending the interpreted asset
path to the (absolute) context path. This solves the problem for context
and classpath assets.
Copyright © 2008-2011 ChenilleKit. All Rights Reserved.