package to.etc.domui.component.fasthtml;

import to.etc.domui.dom.html.*;
import to.etc.domui.state.*;
import to.etc.domui.util.*;
import to.etc.util.*;

public class HtmlMiniEditor extends TextArea {
	private String m_styleSheet;


	@Override
	public void createContent() throws Exception {
		StringBuilder sb = new StringBuilder();
		sb.append("$(\"#").append(getActualID()).append("\").wysiwyg({css:");
		String css = getStyleSheet();
		if(css == null)
			css = PageContext.getRequestContext().getRelativeThemePath("minieditor.css");
		StringTool.strToJavascriptString(sb, css, false);
		sb.append("});");
		appendCreateJS(sb);
		//		appendCreateJS("$(\"#" + getActualID() + "\").wysiwyg({css:'/ui/$themes/blue/style.theme.css'});");
	}

	public String getStyleSheet() {
		return PageContext.getRequestContext().translateResourceName(m_styleSheet);
	}

	public void setStyleSheet(String styleSheet) {
		if(DomUtil.isEqual(styleSheet, m_styleSheet))
			return;
		m_styleSheet = styleSheet;
		changed();
	}
}

@@ -35,16 +35,47 @@
 thtml;%0A%0A
+import to.etc.domui.dom.css.*;%0A
 import t
@@ -94,24 +94,24 @@
 dom.html.*;%0A
-
 import to.et
@@ -178,16 +178,975 @@
 til.*;%0A%0A
+/**%0A * This is a small but very fast html editor. It shows way faster than%0A * the full Html editor but has a little less options. This uses a slightly%0A * adapter version of the %3Ca href=%22http://code.google.com/p/jwysiwyg/%22%3Ewysigyg%3C/a%3E%0A * plugin.%0A *%0A * %3Cp%3EOne oddity in the code here is the handling of the %22display%22 css property. The%0A * plugin adds a div just before the original textarea, then it makes the textarea%0A * display: none. The textarea is retained so the plugin can put it's content in there%0A * still. DomUI however will reset the display:none value after a value is entered%0A * because the changeAttribute call sent will clear it (the attribute is BLOCK in%0A * the DomUI DOM). To prevent this we set the attribute to BLOCK on a full render and%0A * reset it back no none as soon as a partial delta is to be rendered by listening%0A * for input on this control.%0A *%0A * @author %3Ca href=%22mailto:jal@etc.to%22%3EFrits Jalvingh%3C/a%3E%0A * Created on Feb 19, 2010%0A */%0A
 public c
@@ -1215,17 +1215,16 @@
 Sheet;%0A%0A
-%0A
 %09@Overri
@@ -1719,24 +1719,218 @@
 '%7D);%22);%0A%09%7D%0A%0A
+%09/**%0A%09 * Contains the in-editor stylesheet to use, which determines the presentation%5C%0A%09 * of the document inside the editor. If not set it defaults to%0A%09 * THEME/minieditor.css.%0A%09 * @return%0A%09 */%0A
 %09public Stri
@@ -2168,16 +2168,16 @@
 eSheet;%0A
-
 %09%09change
@@ -2183,11 +2183,281 @@
 ed();%0A%09%7D
+%0A%0A%09@Override%0A%09public void onBeforeFullRender() throws Exception %7B%0A%09%09setDisplay(DisplayType.BLOCK);%0A%09%7D%0A%0A%09@Override%0A%09public boolean acceptRequestParameter(String%5B%5D values) throws Exception %7B%0A%09%09setDisplay(DisplayType.NONE);%0A%09%09return super.acceptRequestParameter(values);%0A%09%7D
 %0A%7D%0A

Complete mini-editor.