i dont know about the integration in wicket-stuff project, but i wrote my
own very simple one. the idea is to use a behavior to enable tinymce for a
textfield. see attached behavior, might help you get a head start.

the usage is pretty basic

TextArea textarea=new TextArea(...);
textarea.add(new TinyMceEnable());

-igor


On 2/4/07, Francisco Treacy <[EMAIL PROTECTED]> wrote:

Hi wicketers,

I'm having a problem/ doubt with a particular TinyMCE setting and its
implementation in the wicket-contrib-tinymce project.

How can I change

tinyMCE.init({
 mode : "textareas",
 ...
});


for

tinyMCE.init({
 ...
 mode : "exact",
 elements : "elm1,elm2"
});

or mode : specific_textareas ?

Cause I don't want *all* of the textareas in my page to be tinymce'd. I
can't find this setting anywhere, particularly in the TinyMCESettings class
where it should be settable.

Thanks in advance for your help!

Regards,
Francisco

------------------------------
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions
! Profitez des connaissances, des opinions et des expériences des
internautes sur Yahoo! 
Questions/Réponses<http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com>.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



/*
 * Copyright Teachscape
 */
package ts4.web.wicket.behavior.tinymce;

import wicket.behavior.AbstractAjaxBehavior;
import wicket.markup.ComponentTag;
import wicket.markup.html.IHeaderResponse;

public class TinyMceEnabler extends AbstractAjaxBehavior {

	private boolean allowLinking = true;

	private boolean allowFormatting = true;

	/**
	 * Checks if this editor allows html formatting
	 * 
	 * @return allowFormatting
	 */
	public boolean isAllowFormatting() {
		return allowFormatting;
	}

	/**
	 * Sets if this editor allows html formatting
	 * 
	 * @param allowFormatting
	 *            allowFormatting
	 */
	public TinyMceEnabler setAllowFormatting(boolean allowFormatting) {
		this.allowFormatting = allowFormatting;
		return this;
	}

	/**
	 * Checks if this editor is allowed to create html anchors.
	 * 
	 * @return allowLinking
	 */
	public boolean isAllowLinking() {
		return allowLinking;
	}

	/**
	 * Sets if this editor is allowed to create html anchors.
	 * 
	 * @param allowLinking
	 *            allowLinking
	 */
	public TinyMceEnabler setAllowLinking(boolean allowLinking) {
		this.allowLinking = allowLinking;
		return this;
	}

	public void onRequest() {
		throw new UnsupportedOperationException();
	}

	/**
	 * @see wicket.behavior.AbstractAjaxBehavior#renderHead(wicket.markup.html.IHeaderResponse)
	 */
	@Override
	public void renderHead(IHeaderResponse response) {
		super.renderHead(response);

		StringBuilder layout = new StringBuilder("theme_advanced_buttons1: \"");
		if (isAllowFormatting()) {
			layout
					.append("bold,italic,underline,strikethrough,separator,undo,redo,separator,bullist,numlist,separator,");
		}
		if (isAllowLinking()) {
			layout.append("link,unlink,separator,");
		}
		layout
				.append("spellchecker\",theme_advanced_buttons2:\"\",theme_advanced_buttons3:\"\",theme_advanced_buttons4:\"\"");

		response
				.renderString("<script language=\"javascript\" type=\"text/javascript\" src=\"/html/static/js/tiny_mce/tiny_mce.js\"></script>\n");

		response
				.renderJavascript(
						"tinyMCE.init({mode:\"specific_textareas\",textarea_trigger:\"rte\",plugins:\"spellchecker\",spellchecker_languages:\"+English=en\",theme:\"advanced\","
								+ layout.toString() + ",content_css : \"/html/static/css/tsTinyMceContent.css\"});",
						"TinyMceEnabler");
	}

	protected boolean isEnabled() {
		return true;
	}

	@Override
	protected void onBind() {
		getComponent().setOutputMarkupId(true);
	}

	@Override
	protected void onComponentTag(ComponentTag tag) {
		if (isEnabled()) {
			tag.put("rte", "true");
		}
	}

}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to