[annotator-dev] Struggling to integrate plugin with v1.2.10
Randall Leeds
tilgovi at hypothes.is
Thu Mar 26 21:19:37 UTC 2015
The effect this change has had on your code was unintentional.
Thanks for getting onto the list to bring it up, that's the only way we can
know about needs like this.
The original motivation for the change is here:
https://github.com/openannotation/annotator/commit/f4e0b5d4
The problem at the time was that the presence or absence of a `ranges`
property was used to determine whether the annotation was new or updated.
That caused problems when ranges failed to anchor, IIRC.
If you need to upgrade you can either use onAdderClick, which should be
safe, or we can add the onEditorSubmit callback again for you.
On Wed, Mar 25, 2015 at 8:45 PM, Greg Pendlebury <greg.pendlebury at gmail.com>
wrote:
> 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
> annotator-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/annotator-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20150326/b22d71d1/attachment-0004.html>
More information about the annotator-dev
mailing list