Heyo, I'm struggling to upgrade our plugins to work against v1.2.10 and I think that I've tracked the problem back to the changes made to how 'annotationCreated' events are generated.
Using v1.2.6 we called showEditor() to give users a form to provide us content. All of the downstream events just worked, including integration with the 'Store' plugin. The 'annotationCreated' event, which the 'Store' plugin is waiting to hear, is thrown by the core library from within the onEditorSubmit() handler... fairly simple and straight forward. Under v1.2.10 the user clicks 'Save' and the form just hides with no action taken at all. I can see that the 'annotationEditorSubmit' event does indeed fire, but the core annotator code doesn't seem to action anything in that case. It looks like the changes center on the functionality of onAdderClick() which is now expected to be the only way to throw an 'annotationCreated' event from he core (it has been removed from onEditorSubmit()). onAdderClick() is throwing the the event from inside a closed over 'save' function (ie. I can't 'reach' it as an API) that that is not even bound unless the stock adder is clicked. We don't even use the stock adder so it seems like a strange way to plumb things up. showEditor() allows us to inject our base annotation (with extra metadata fields) but onAdderClick() does not, so this seems like a backwards step and a fairly non-intuitive way of expecting plugins to integrate. My workaround for now seems to be capturing the 'annotationEditorSubmit' event and then immediately firing off my own 'annotationCreated' event to tell the 'Store' plugin what has happened, but I feel like that is a fairly fragile way to integrate if later versions of the core are going to go back to firing their own 'annotationCreated' event. Any thoughts on whether this was an intentional change? Or just and oversight? I don't follow the core development very much so I apologise if I missed some discussion on this change. Ta, Greg
_______________________________________________ annotator-dev mailing list [email protected] https://lists.okfn.org/mailman/listinfo/annotator-dev Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
