You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2006/02/17 23:28:57 UTC
[Myfaces Wiki] Update of "WYSIWYG Editor" by MikeKienenberger
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.
The following page has been changed by MikeKienenberger:
http://wiki.apache.org/myfaces/WYSIWYG_Editor
The comment on the change is:
Added a DOJO example with customized items.
------------------------------------------------------------------------------
}}}
The dojo initializer adds the needed imports to the code and also adds via the require
- the Editor subcontrol.
+ the Editor subcontrol. Within the form, the styleClass attribute of "dojo-Editor" causes the textArea to become an html editor.
- within the form the textArea is altered to a html editor via the styleClass.
+ If you want to customize the attributes of the dojo editor, here is another way to set up the editor. The following example removes the unused save/cancel buttons but adds font controls. This example was tested in facelets. You probably need to add <f:verbatim> around the script tags following the input area under JSP. All user-configurable names are indicated by the "my" prefix.
+ {{{
+ <s:dojoInitializer require="dojo.widget.Editor"/>
+
+ <h:form id="myFormId">
+ <h:inputTextarea id="myId"
+ value="#{myBackingBean.myProperty}"/>
+
+ <script type="text/javascript">
+ // <![CDATA[
+ var editorArgs = {
+ items: ["textGroup", "blockGroup", "justifyGroup", "colorGroup", "listGroup", "indentGroup", "linkGroup"]
+ };
+ var editor = dojo.widget.fromScript("Editor", editorArgs,
+ dojo.byId("myFormId:myId"));
+ // ]]>
+ </script>
+ </h:form>
+ }}}
+
+ Also note that the examples requires a fully-qualified path to the id of the input component (the JSF client-id). You could alternatively use t:inputTextArea forceId="true" and use dojo.byId("myId").
+