Problems capturing the text on a RichTextArea

Hi experts,

I have created a simple CustomComponent that consist of two labels within a layout (a box with two labels). I made this “box” draggable so I could drag it and drop it on another components. In the other hand I’ve got a RichTextArea that admits drop events. The area must be RichTextArea so it admits tags and i need the text to be html formated.

What I want is to drag the component, and drop it on the rich text area, and in that event insert a text in the text area. Concatenate it in case there is already any text in the richtextarea. For reading the RichTextArea I am using the method getValue().

I have tried this with the IE8 and works OK but with the newer browser it doesnt work. I’ve read that the value of the richtextarea isn’t updated until you tab out or you change the focus to another component and indeed doing that it works, but i need to get the value right in the moment the drop event is thrown.

I also have seen that there is no TextChangeEvent related to richtextarea and i really dont know what to do. I thought I could extend the RichTextArea and give this behaviour but I dont know whether there is another way for doing this possible or not.

I’m a begginer with vaadin and thank you very much.

I thought of writing some javascript so I could insert a new attribute “onmousedown” on the custom component i made. When mouse down i can set the focus in another component and therefore update the value of the richtextarea but I dont know how to make a component have a new attribute like <div class=“v-customcomponent”
onmousedown=“myfunction()” …

Another way could be to attach a TextChangeListener to a RichTextArea and see how it performs, but when i try to extend the component and implement the TextChangeListener I instantiate my custom Richtextarea but i cant add the listener.
Is there any simple way to achieve this?

Thank you very much.