Has anyone had any success/is it possible to call editDocument()
in a debounced “context”, i.e., use something like the UnderscoreJS _.debounce
function with, say, an onchange
in an <input>
and then call editDocument
in there? The problem I’m facing is that, of course, doing so won’t call editDocument
in the same tick as the UI interaction anymore, meaning it gets impossible:
If it isn’t possible, I’ll convert this to a feature request, which is why I’ll already put a use-case here .
Use case
I’m currently writing a Markdown plugin (i.e., am extremely close to releasing it, but am now developing a panel for the first update of the plugin). In this panel, there is a textarea with which the Markdown contents of the selected text node can get edited. To avoid the problems described by @Velara in Add modal like support for panels preventing new selections, the text gets updated on user input, meaning Markdown has to get reparsed everytime. While I have a very performant Markdown parser, it still isn’t optimal that this happens every time a user enters a new character. I would therefore like to debounce the input, as demonstrated in this example of the VueJS docs: https://vuejs.org/v2/examples/ to avoid such problems.