hi,
i thought i'd like to share a simple behaviour for NicEdit
(http://nicedit.com/).
to use it, just download nicedit and modify NICEDIT_JAVASCRIPT and
NICEDIT_ICONS accordingly. (i chose to put them together in the same
package).
if you download the basic version (without xhtml/ code view), when
adding the behaviour pass 'false' into the constructor, in order not
to use the full panel.
of course, you can use it with multiple textareas in the same page.
let me know if you run into some problem using it. should this belong
to the wiki as well?
francisco
public class NicEditTextAreaBehavior extends AbstractBehavior {
private Component<TextArea<String>> textArea;
private Boolean fullPanel = Boolean.TRUE;
private static final ResourceReference NICEDIT_JAVASCRIPT =
new JavascriptResourceReference(NicEditTextAreaBehavior.class,
"nicEdit.js");
private static final ResourceReference NICEDIT_ICONS = new
ResourceReference(NicEditTextAreaBehavior.class,
"nicEditorIcons.gif");
public NicEditTextAreaBehavior() {
}
public NicEditTextAreaBehavior(Boolean fullPanel) {
this.fullPanel = fullPanel;
}
@Override @SuppressWarnings("unchecked")
public void bind(Component component) {
this.textArea = component;
component.setOutputMarkupId(true);
}
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.renderJavascriptReference(NICEDIT_JAVASCRIPT);
response.renderOnDomReadyJavascript("new nicEditor({iconsPath :
'"+
RequestCycle.get().urlFor(
NICEDIT_ICONS) +"', fullPanel : "+ fullPanel
+"}).panelInstance('"
+ textArea.getMarkupId() + "');");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]