Is there a way to check if user is editing text?

I have code running on the update call. I noticed that if I’m editing text I get updates as the user is typing.

Is there a way to tell if the user is editing typing in text to pause updating?

Hi @Velara! If you wouldn’t mind, could you expand a bit more on the scenario here?

For instance, is this occurring because the plugin is taking some time to execute, and so the user continues with another task in the meantime (i.e. editing text)? I assume this is only an issue for you when the user is editing text related to the node(s) the plugin is actively working on, as opposed to editing text in an unrelated part of the scenegraph?

Thanks for any additional info - I’m fairly new on the XD team and still learning more about how these limitations affect our devs.

Yes. That’s correct. My plugin has a feature to automatically run code when an UXP update() method is called. Sometimes this code takes a few seconds to run. So if a user moves a rectangle it is called after that action.

If the user is editing text that code is being run in the middle of their editing process as they type. Since it can take a few seconds to process it gets bogged down and starts to error out (rendition errors). I have a similar feature request to be able to check if renditions are processing or not.

If there was a way to prevent update() from being called until after the user exits out of text editing mode so my plugin isn’t getting so many updates. OR maybe pass in a value that includes details of the current edit?

This is sort of what I need:

// UXP update method in my plugin
function update(type) {
   log(type); // add, move, delete, start text edit, update text edit, end text edit
   if (type=="updatingText") return; // ignore until user is done editing text
}