-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to listen for changes #134
Comments
I am not familiar with the editing details, but there must be a model somewhere that always is in sync with the latest edits, right? Otherwise, how could you build the list cells and text flows? |
I also noticed that saving the document is executed inside a Platform.runLater() which makes my life also hard because I can't retrieve the updated document right after the call to save() and in the meantime the ListView has a new selected element. This new element selection triggered a call to setDocument(). Hard to get this all under control. |
As mentioned, the control uses a "save" is an action that iterates through all the pieces with their big or little text fragments and gets the final text and decorations. This can be done at anytime, so you can always get the model of what is being rendered at that moment. But we do it only "on demand" for now, when requested by the save action. As discussed before, we could implement several options like background thread to get a As for the Platform.runLater, I'll see if that can be removed, or we could use another locking mechanism. |
For the time being I am listening to the modified property and execute the save action whenever it becomes TRUE. This updates the document property and I can then retrieve the updated document from there. This usually works so fast that I hardly see any delay (if at all). So maybe we could have an option where we tell the rich text area to always update the document property after every change. This should work well for small documents, which is the case for my use case where the user will edit several small notes. If somebody wants to use the text area for big documents then they can disable the feature and they would know that the document property will be updated asynchronously. |
Makes sense, we can simply add for now an |
#140 should fix this |
How can an application listen for changes to the text? I am writing the application showing in this screenshot and each item in the list view on the left-hand side represents one document that can be edited inside the rich text editor. Obviously I need to update the document in the list view items whenever the user changed the document. How can I synchronize these two views, what is the recommended way? Currently I have the impression that I have to perform a "save" ... but that can't be right, can it?
The text was updated successfully, but these errors were encountered: