Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ window.Vaadin.Flow.tinymceConnector = {
setMode : function(newChangeMode) {
changeMode = newChangeMode;
},

getMode : function() {
return changeMode;
},

isInDialog: function() {
let inDialog = false;
Expand Down Expand Up @@ -128,7 +132,7 @@ window.Vaadin.Flow.tinymceConnector = {
});

ed.on('change', function(e) {
if (changeMode === 'timeout') {
if (c.$connector.getMode() === 'timeout') {
syncValue();
}
});
Expand All @@ -143,7 +147,7 @@ window.Vaadin.Flow.tinymceConnector = {
});

ed.on('input', function(e) {
if (changeMode === 'timeout') {
if (c.$connector.getMode() === 'timeout') {
syncValue();
}
});
Expand Down
29 changes: 29 additions & 0 deletions src/test/java/org/vaadin/tinymce/TimeoutModeReattachTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.vaadin.tinymce;

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.Route;

@Route
public class TimeoutModeReattachTest extends Div {

private TinyMce tinyMce;

public TimeoutModeReattachTest() {
tinyMce = new TinyMce();

tinyMce.setValue("<p>Voi <strong>jorma</strong>!<p>");
tinyMce.setHeight("700px");
tinyMce.setValueChangeMode(ValueChangeMode.TIMEOUT);
tinyMce.setDebounceTimeout(10);
tinyMce.addValueChangeListener(change -> System.out.println("value change called"));
add(tinyMce);

Button b = new Button("Remove and reattach tinymce ", e -> {
tinyMce.removeFromParent();
add(tinyMce);
});
add(b);
}

}
Loading