dankito / RichTextEditor

Rich text WYSIWYG editor for Android and JavaFX
Apache License 2.0
92 stars 36 forks source link

addDidHtmlChangeListener only trigger once #38

Closed woozI43 closed 4 years ago

woozI43 commented 4 years ago

I add a simple save button on the text editor. I have a method inside the callback didHtmlChange that enables the save button when the user makes changes on the text and another method that disables the save button when the user saves the text. My problem is the callback only called once. How can I catch the event whenever the user constantly changes something on the text?

dankito commented 4 years ago

This is actually what DidHtmlChangeListener is intended for: It tells you if html did change since last call to setHtml() or compared to an empty text if setHtml() hasn't been called.

So that you can set a save button's enabled state depending on the parameter of the callback.

(To verify this simply enter some text and then delete it again.)

If you want to track changes when the user is typing, use addHtmlChangedListener().

But be aware that the performance may be quite bad as the method's comment tells you.

woozI43 commented 4 years ago

thanks that works fine.