开发者

Detecting GWT RichTextArea 'dirty' state

开发者 https://www.devze.com 2022-12-30 18:07 出处:网络
I want to detect when the contents of my GWT RichTextArea become \'dirty\' (have been changed by the user) i开发者_如何学Pythonn order to enable a \'save\' button accordingly.

I want to detect when the contents of my GWT RichTextArea become 'dirty' (have been changed by the user) i开发者_如何学Pythonn order to enable a 'save' button accordingly.

I suppose I could listen for key presses that are likely to have changed the contents; but browser support for key presses is notoriously quirky.

I suppose I could, before editing begins, save the original contents in a variable, and upon key press, compare the current contents against that variable, but doing that on each key press is going to be really slow.

Is there some neat way to achieve RichTextArea dirty-detection?


You could always compare the original text to the current text on a timer (every second or two). Start the timer in onFocus(), and stop it onBlur()

0

精彩评论

暂无评论...
验证码 换一张
取 消