Is there any way to pass context (i.e. a value/object) from the beforeChange
event handler to the change
event handler?
There is processing I must do at the beforeChange
stage, in case the change needs to be cancelled, and processing I must do at the change
stage, because I need the edit to actually be done first, even if it’s not rendered yet. Some cases are very difficult to do well without being able to pass data from the beforeChange
event handler to the change
event handler though.
The only definite way I can think of solving some cases, which doesn’t make assumptions I can’t know might not be true sometimes, is for the change
event handler to reconstruct the original content from the current content and the change data, repeat processing that the beforeChange
handler did, in order to effectively reconstruct the context that I would like to have just passed on… before now doing whatever needs to be done. It’s a bit inefficient though.