[annotator-dev] Module Upgrade Qs

steph steph at endpoint.com
Mon May 18 14:16:25 UTC 2015


After reviewing the docs and working on upgrading an extension a bit, I 
have a few questions.

Here are some notes:
* I have a module called categories, which allows users to categorize 
annotations. I initiate the module with the new syntax:
app.include(categories, { categories: /* SOME HASH */ });
This works fine, and I can verify the categories options values are fine.

* I also need to modify the editor based on the values in /* SOME HASH 
*/. I'm trying to connect the gap between 
https://annotator.readthedocs.org/en/latest/module-development.html to 
so I gather the call to the UI should look something like this:
app.include(annotator.ui.main, {
     editorExtensions: [categories().editorExtension()]

* My editorExtension method starts like this:
function categories(options) {
   return {
     editorExtension: function(e) {

There are a few problems with this:
a) While I can verify editorExtension is called, "e" is not defined in 
it, so the editor methods (e.g. addField are not accessible). Am I 
calling the editorExtension incorrectly?

b) The options hash is not accessible from the editorExtension method, 
as far as I can tell. It's unclear to me if I am supposed to initiate 
the categories module before I call the ui.main module, or if that 
doesn't matter. I'd prefer to have one canonical reference to the 
categories that I'm working with, that is contained within my module.

c) How does one use multiple editor extensions? For example, my app will 
at the very least an editorExtension for both the tag and categories 
module. Is this possible? If not, is it going to be possible?

It would be great to see the tags module updated included in the 
release, as that's a good model for making editor and viewer changes. 
While I'm trying to reference this, the module development documentation 
isn't fleshed out enough to cover interaction with the UI. I know it's 
an alpha release and I'm the one dealing with growing pains here, but 
hopefully what I'm learning here can help others.

Thanks in advance,


More information about the annotator-dev mailing list