diff --git a/ckez/src/archive/web/js/ckez/CKeditor.js b/ckez/src/archive/web/js/ckez/CKeditor.js
index 8e562ed6..5f2c866d 100644
--- a/ckez/src/archive/web/js/ckez/CKeditor.js
+++ b/ckez/src/archive/web/js/ckez/CKeditor.js
@@ -26,14 +26,14 @@ ckez.CKeditor = zk.$extends(zul.Widget, {
if (editor) {
if (fromServer) {
// ZKCK-12: need to format the value from server first before set to ckeditor
- editor.setData(jq(this.$n('cnt')).html(v).text());
+ v = jq(this.$n('cnt')).html(v).text();
+ editor.setData(v);
// Issue #9: update editor's previousValue if set value from server
// to prevent unexpect onChange event
editor._.previousValue = editor.dataProcessor.toHtml(v);
} else {
editor.setData(v);
}
-
}
}],
autoHeight: null,
diff --git a/test/addon/ckeztest/src/archive/test2/B-ZKCK-12.zul b/test/addon/ckeztest/src/archive/test2/B-ZKCK-12.zul
index c3fd5e84..1098ce5d 100644
--- a/test/addon/ckeztest/src/archive/test2/B-ZKCK-12.zul
+++ b/test/addon/ckeztest/src/archive/test2/B-ZKCK-12.zul
@@ -13,15 +13,32 @@ B-ZKCK-12.zul
Copyright (C) Potix Corporation. All Rights Reserved.
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/addon/ckeztest/src/org/zkoss/zktest/test2/B_ZKCK_12_Composer.java b/test/addon/ckeztest/src/org/zkoss/zktest/test2/B_ZKCK_12_Composer.java
index fea5b8a9..7b3ecdd5 100644
--- a/test/addon/ckeztest/src/org/zkoss/zktest/test2/B_ZKCK_12_Composer.java
+++ b/test/addon/ckeztest/src/org/zkoss/zktest/test2/B_ZKCK_12_Composer.java
@@ -1,27 +1,101 @@
package org.zkoss.zktest.test2;
import org.zkforge.ckez.CKeditor;
-import org.zkoss.zk.ui.event.Event;
+import org.zkoss.xml.XMLs;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zul.Window;
public class B_ZKCK_12_Composer extends SelectorComposer {
+// @Wire
+// private CKeditor editor;
+// public void doAfterCompose(Window comp) throws Exception {
+// super.doAfterCompose(comp);
+// editor.setValue("<AmpTag>Amp tag content</AmpTag> <br/> <escapetag>escapetag content</escapetag> <br/> < space-tag > space tag content < /space-tag >");
+// }
+//
+// @Listen("onClick=#btn1")
+// public void onClick$btn1(Event e) {
+// editor.setValue("");
+// }
+//
+// @Listen("onClick=#btn2")
+// public void onClick$btn2(Event e) {
+// editor.setValue("<AmpTag>Amp tag content</AmpTag> <br/> <escapetag>escapetag content</escapetag> <br/> < space-tag > space tag content < /space-tag >");
+// }
+//
+// @Listen("onClick=#btn3")
+// public void onClick$btn3(Event e) {
+// System.out.println(editor.getValue());
+// }
+
@Wire
- private CKeditor editor;
- public void doAfterCompose(Window comp) throws Exception {
- super.doAfterCompose(comp);
- editor.setValue("<AmpTag>Amp tag content</AmpTag> <br/> <escapetag>escapetag content</escapetag> <br/> < space-tag > space tag content < /space-tag >");
- }
-
- @Listen("onClick=#btn1")
- public void onClick$btn1(Event e) {
- editor.setValue("");
- }
-
- @Listen("onClick=#btn2")
- public void onClick$btn2(Event e) {
- editor.setValue("<AmpTag>Amp tag content</AmpTag> <br/> <escapetag>escapetag content</escapetag> <br/> < space-tag > space tag content < /space-tag >");
- }
+ private CKeditor editor;
+ private CKeditor cKeditor3;
+
+ public void doAfterCompose(Window comp) throws Exception {
+ super.doAfterCompose(comp);
+ editor.setValue(doubleEscape("value") + "
" + doubleEscape("value tag2"));
+ }
+
+ private String doubleEscape(String text) {
+ return XMLs.escapeXML(XMLs.escapeXML(text));
+ }
+
+ @Listen("onClick=#btn1")
+ public void click1() {
+ Window window2 = (Window) editor.getParent().getFellow("window2");
+ window2.setVisible(true);
+ window2.doOverlapped();
+
+ cKeditor3 = new CKeditor();
+ Window window3 = new Window();
+ window3.setParent(window2.getParent());
+ window3.appendChild(cKeditor3);
+
+ window3.setClosable(true);
+
+ window3.setPosition("center");
+ window3.setTitle("Message!!!");
+ window3.doOverlapped();
+ }
+
+ @Listen("onClick=#btn2")
+ public void click2() {
+ Window window2 = (Window) editor.getParent().getFellow("window2");
+ CKeditor cKeditor2 = (CKeditor) window2.getFellow("editor2");
+
+ String s1 = "";
+ String s2 = XMLs.escapeXML(s1);
+ String s3 = XMLs.escapeXML(s2);
+ editor.setValue(s3);
+ cKeditor2.setValue(s3);
+ cKeditor3.setValue(s3);
+ }
+
+ @Listen("onClick=#btn3")
+ public void click3() {
+ Window window2 = (Window) editor.getParent().getFellow("window2");
+ CKeditor cKeditor2 = (CKeditor) window2.getFellow("editor2");
+
+// System.out.println("Before Invalidate");
+ System.out.println("editor1: " + editor.getValue());
+ System.out.println("editor2: " + cKeditor2.getValue());
+ System.out.println("editor3: " + cKeditor3.getValue());
+ editor.invalidate();
+// cKeditor3.invalidate();
+// cKeditor2.invalidate();
+ }
+
+ @Listen("onClick=#btn4")
+ public void click4() {
+ Window window2 = (Window) editor.getParent().getFellow("window2");
+ CKeditor cKeditor2 = (CKeditor) window2.getFellow("editor2");
+
+// System.out.println("After Invalidate");
+ System.out.println("editor1: " + editor.getValue());
+ System.out.println("editor2: " + cKeditor2.getValue());
+ System.out.println("editor3: " + cKeditor3.getValue());
+ }
}