Detecting GWT RichTextArea 'dirty' state
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()
精彩评论