If my plugin is fired on an “editor-paste” event, how can I handle the event such that the outcome depends on the response I receive from a modal? My modal options are as follows:
- Custom option
- Default option
At present, when the event fires, the modal opens, but the paste handler doesn’t wait for the outcome of the modal before proceeding. In the instance I choose my custom option from the modal, my custom behaviour + the default paste behaviour occurs.
If I instead use
preventDefault(), then the default behaviour is indeed stopped, however, at that point, the “Default” option in the modal has no effect because preventDefault() was invoked while the modal is still visible (prior to the user making a choice).
Is there some other option to have the event handler wait for a modal choice before taking action (default behaviour or otherwise)? What options do I have?