Open sirbris opened 1 month ago
Hi @sirbris,
Sorry for the late reply.
Unfortunately the search & replace functionality is completely provided by ace. So there is no way to create a custom hook etc.
But I think it is still possible to work around this.
Some time ago the AceChangedEvent
was introduced in #21. Maybe, just maybe, you can get the value by registering the AceChangedEvent
(which will send a lot of data) as soon as someone hits ctrl + f
, wait until all the changes are done (maybe through a debounce function or something like that) and then unregister the AceChangedEvent
.
If that's not possible or doesn't work the way I thought it would, it would require a major change to the lit-ace
frontend and the @f0rce/ace-builds
repo (because the ace editor has some custom functionality like the status bar, etc).
Please let me know if this has pointed you in the right direction or solved the problem.
Take care, David
If that doesn't work you could take a look at the sync
functionality. I wouldn't know when to use it (as how would you know that a user finished replacing), but it is defined here https://github.com/F0rce/ace/blob/9e6f600573492a71ee32ea2cc1e11bbd3b41adf0/src/main/java/de/f0rce/ace/AceEditor.java#L1305-L1323
After using search & replace in your editor, the getValue() method returns the old value... would it be possible to trigger a valueChange event after user replaced text via that function or any other method to get the real client side value?