My company needs one too. We wrapped the dojo Editor2 component.
I helped someone get a quick demo of this working a few weeks ago,
but I don't know if it's 100%. If you're using version 4.1.1,
you're welcome to use this.
-Steve
DojoEditor.java:
import java.util.HashMap;
import java.util.Map;
import org.apache.tapestry.form.AbstractFormComponent;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IScript;
import org.apache.tapestry.PageRenderSupport;
import org.apache.tapestry.TapestryUtils;
import org.apache.tapestry.annotations.ComponentClass;
import org.apache.tapestry.annotations.InjectScript;
import org.apache.tapestry.annotations.Parameter;
@ComponentClass(allowBody=true)
public abstract class DojoEditor extends AbstractFormComponent {
@Parameter(required=true)
public abstract String getValue();
public abstract void setValue(String value) ;
@InjectScript("DojoEditor.script")
public abstract IScript getScript();
/**
* @see
org.apache.tapestry.form.AbstractFormComponent#renderFormComponent
(org.apache.tapestry.IMarkupWriter,
* org.apache.tapestry.IRequestCycle)
*/
protected void renderFormComponent(IMarkupWriter writer,
IRequestCycle cycle) {
PageRenderSupport pageRenderSupport =
TapestryUtils.getPageRenderSupport(cycle, this);
Map<String,Object> symbols = new HashMap<String,Object>();
symbols.put("id", getClientId());
symbols.put("formId", getForm().getClientId());
getScript().execute(this, cycle, pageRenderSupport, symbols);
renderDelegatePrefix(writer, cycle);
writer.begin("textArea");
writer.attribute("style","width:700px; height:200px");
renderIdAttribute(writer, cycle);
writer.attribute("name", getName());
renderInformalParameters(writer, cycle);
renderBody(writer, cycle);
writer.printRaw(getValue());
writer.end();
renderDelegateSuffix(writer, cycle);
}
/**
* @see
org.apache.tapestry.form.AbstractFormComponent#rewindFormComponent
(org.apache.tapestry.IMarkupWriter,
* org.apache.tapestry.IRequestCycle)
*/
protected void rewindFormComponent(IMarkupWriter writer,
IRequestCycle cycle) {
setValue(cycle.getParameter(getName()));
}
}
DojoEditor.script:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script PUBLIC
"-//Apache Software Foundation//Tapestry Script Specification
3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
<script>
<input-symbol key="id" class="java.lang.String" required="yes"/>
<input-symbol key="formId" class="java.lang.String"
required="yes"/>
<body>
<unique>
dojo.require("dojo.widget.Editor2");
dojo.require("dojo.widget.Editor2Plugin.DialogCommands");
dojo.require("dojo.widget.Editor2Plugin.ColorPicker");
</unique>
</body>
<initialization>
dojo.widget.createWidget("Editor2", {id: "${id}_widget"},
dojo.byId('${id}'));
dojo.event.connect(dojo.byId('${formId}'), "onsubmit",
function () {
dojo.byId('${id}').value = dojo.widget.getWidgetById("$
{id}_widget").getEditorContent()
})
</initialization>
</script>
Nick Westgate wrote:
Hi James.
I haven't used it, but perhaps:
http://www.tapestrycomponents.org/Tassel/app?service=external/
ViewComponent&sp=SHtmlArea
There are also several for T4 on Tassel.
Cheers,
Nick.
James Sherwood wrote:
Hello,
I am looking for a Rich Text Editor component for tapestry that
is compatable with (or maybe i could modify) Tapestry 3 and all
large browsers.
If someone could point me in the right direction that would be
great.
I have tried creating my own and have been successfull in
everything except getting the information from the RTE to come
out in the form submit, it is always null.
Any help would be greatly appreciated.
--James
-------------------------------------------------------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
__________ NOD32 2202 (20070418) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com