diff --git a/src/main/java/org/vaadin/tinymce/TinyMce.java b/src/main/java/org/vaadin/tinymce/TinyMce.java index 1a40578..faf0d8c 100644 --- a/src/main/java/org/vaadin/tinymce/TinyMce.java +++ b/src/main/java/org/vaadin/tinymce/TinyMce.java @@ -117,14 +117,17 @@ public TinyMce() { this(false); } + /** + * Old public method from era when this component didn't + * properly implement the HasValue interfaces. + * Don't use this but the standard setValue method instead. + * + * @param html + * @deprecated use {@link #setValue(Object)} instead + */ + @Deprecated(forRemoval = true) public void setEditorContent(String html) { - this.currentValue = html; - if (initialContentSent) { - runBeforeClientResponse(ui -> getElement() - .callJsFunction("$connector.setEditorContent", html)); - } else { - ta.setProperty("innerHTML", html); - } + setPresentationValue(html); } @Override @@ -260,12 +263,18 @@ public void setReadOnly(boolean readOnly) { } @Override - protected void setPresentationValue(String t) { - setEditorContent(t); + protected void setPresentationValue(String html) { + this.currentValue = html; + if (initialContentSent) { + runBeforeClientResponse(ui -> getElement() + .callJsFunction("$connector.setEditorContent", html)); + } else { + ta.setProperty("innerHTML", html); + } } private TinyMce createBasicTinyMce() { - this.setEditorContent(""); + setValue(""); this.configure("branding", false); this.basicTinyMCECreated = true; this.configurePlugin(false, Plugin.ADVLIST, Plugin.AUTOLINK, diff --git a/src/test/java/org/vaadin/tinymce/DeepLinkingView.java b/src/test/java/org/vaadin/tinymce/DeepLinkingView.java index 59f4e23..721bc1d 100755 --- a/src/test/java/org/vaadin/tinymce/DeepLinkingView.java +++ b/src/test/java/org/vaadin/tinymce/DeepLinkingView.java @@ -19,13 +19,13 @@ public class DeepLinkingView extends Div { public DeepLinkingView() { tinyMce = new TinyMce(); - tinyMce.setEditorContent("
Voi jorma!
"); + tinyMce.setValue("
Voi jorma!
"); tinyMce.setHeight("700px"); add(tinyMce); Button b = new Button("Set content dynamically", e -> { - tinyMce.setEditorContent("New value"); + tinyMce.setValue("New value"); }); add(b); diff --git a/src/test/java/org/vaadin/tinymce/DemoView.java b/src/test/java/org/vaadin/tinymce/DemoView.java index f47bc62..6f53828 100755 --- a/src/test/java/org/vaadin/tinymce/DemoView.java +++ b/src/test/java/org/vaadin/tinymce/DemoView.java @@ -24,13 +24,13 @@ public class DemoView extends Div { public DemoView() { tinyMce = new TinyMce(); - tinyMce.setEditorContent("
Voi jorma!
"); + tinyMce.setValue("
Voi jorma!
");
tinyMce.setHeight("700px");
add(tinyMce);
Button b = new Button("Set content dynamically", e -> {
- tinyMce.setEditorContent("New value");
+ tinyMce.setValue("New value");
});
add(b);
diff --git a/src/test/java/org/vaadin/tinymce/GitHubIssue2.java b/src/test/java/org/vaadin/tinymce/GitHubIssue2.java
index eae5cd0..f0f6761 100644
--- a/src/test/java/org/vaadin/tinymce/GitHubIssue2.java
+++ b/src/test/java/org/vaadin/tinymce/GitHubIssue2.java
@@ -28,7 +28,7 @@ public class GitHubIssue2 extends Composite Voi jorma! ");
+ tinyMce.setValue(" Voi jorma! ");
tinyMce.setHeight("700px");
add(tinyMce);
}
diff --git a/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java b/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java
index 758807b..a2ddf20 100644
--- a/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java
+++ b/src/test/java/org/vaadin/tinymce/UpdateValueOnDetachedEditor.java
@@ -11,6 +11,7 @@ public class UpdateValueOnDetachedEditor extends VerticalLayout {
public UpdateValueOnDetachedEditor() {
TinyMce tinyMce = new TinyMce();
+ tinyMce.setValue("Jorma");
Button b = new Button("Replace value while detached");
b.addClickListener(e -> {