Commit 8790e80 1 parent 44c8a8c commit 8790e80 Copy full SHA for 8790e80
File tree 2 files changed +14
-7
lines changed
main/java/org/vaadin/tinymce
test/java/org/vaadin/tinymce
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 26
26
import com .vaadin .flow .component .dependency .JavaScript ;
27
27
import com .vaadin .flow .component .dependency .StyleSheet ;
28
28
import com .vaadin .flow .component .html .Div ;
29
+ import com .vaadin .flow .dom .DebouncePhase ;
29
30
import com .vaadin .flow .dom .DomEventListener ;
30
31
import com .vaadin .flow .dom .DomListenerRegistration ;
31
32
import com .vaadin .flow .dom .Element ;
@@ -87,6 +88,7 @@ public TinyMce(boolean shadowRoot) {
87
88
} else {
88
89
getElement ().appendChild (ta );
89
90
}
91
+
90
92
domListenerRegistration = getElement ().addEventListener ("tchange" ,
91
93
(DomEventListener ) event -> {
92
94
boolean value = event .getEventData ()
@@ -135,6 +137,11 @@ protected void onAttach(AttachEvent attachEvent) {
135
137
id = UUID .randomUUID ().toString ();
136
138
ta .setAttribute ("id" , id );
137
139
}
140
+ if (!getEventBus ().hasListener (BlurEvent .class )) {
141
+ // adding fake blur listener so throttled value
142
+ // change events happen by latest at blur
143
+ addBlurListener (e -> {});
144
+ }
138
145
if (!attachEvent .isInitialAttach ()) {
139
146
// Value after initial attach should be set via TinyMCE JavaScript
140
147
// API, otherwise value is not updated upon reattach
Original file line number Diff line number Diff line change @@ -57,18 +57,18 @@ public DemoView() {
57
57
Notification .show ("Blur event!" );
58
58
});
59
59
60
- Button blur = new Button ("blur (NOT SUPPORTED)" , e -> {
61
- tinyMce .blur ();
62
- });
63
- blur .addClickShortcut (Key .KEY_B , KeyModifier .CONTROL );
64
- add (blur );
65
-
66
60
Button disable = new Button ("Disabble" , e -> {
67
61
tinyMce .setEnabled (!tinyMce .isEnabled ());
68
62
e .getSource ().setText (tinyMce .isEnabled () ? "Disable" : "Enable" );
69
63
});
70
64
add (disable );
71
-
65
+
66
+ Button blur = new Button ("blur (NOT SUPPORTED really, but of course works from button)" , e -> {
67
+ tinyMce .blur ();
68
+ });
69
+ blur .addClickShortcut (Key .KEY_B , KeyModifier .CONTROL );
70
+ add (blur );
71
+
72
72
tinyMce .addValueChangeListener (e -> {
73
73
Notification .show ("ValueChange event!" );
74
74
System .out .println (e .getValue ());
You can’t perform that action at this time.
0 commit comments