[annotator-dev] changing the position of annotator viewer/editor

Benjamin Young bigbluehat at hypothes.is
Tue Mar 3 17:23:02 UTC 2015

Hey Shauna,

First, thanks for being here. :)

Remaining replies inline...

On Tue, Mar 3, 2015 at 10:31 AM, Shauna Gordon-McKeon
<shaunagm at gmail.com> wrote:
> Hello again,
> I want the annotator's editor and viewer to appear in the margin of a page,
> rather than directly over the annotator's text.  I know there is currently a
> plugin to do this
> (<https://github.com/habeanf/annotator/blob/master/src/plugin/marginviewer.coffee>)
> but it is 300+ lines of uncommented/undocumented code in a language I don't
> know, so I'm going to try to make this myself.

CoffeScript is a language solely meant for transpiling to JavaScript,
so you can use the `coffee` command line tool to turn it that .coffee
file into a .js file:

The resulting JS might not be ideal, but it would be JavaScript which
you could alter to your needs.

> Looking through the code, this seems to be the spot where the position of
> the viewer is being defined:
> <https://github.com/openannotation/annotator/blob/master/src/ui/viewer.js#L359>.

So...the master branch is not stable in this project. It's the 2.0-dev
pre-alpha code. :)

The code you want (if you're looking for a stable Annotator to use and
develop with) lives under the Releases page on GitHub:

1.2.10 just came out last week. Also, the margineviewer.coffee file
above was built for a 1.2.x annotator, so starting there is your best

Even if you write something new at this point, I'd build it for 1.2.10
as 2.0's release date is as yet unknown.

> A few questions:
> - Is this code in the latest release of annotator?  (I tried to check this
> for myself, but was stymied by unfamiliarity with coffeescript. I found a
> lot of tools for translating javascript to coffeescript, but not vice versa.
> If anyone has recommendations for such a tool, that'd be great too.)

The latest `master` branch (aka 2.0-dev) is no longer uses
CoffeeScript as the main language:

The old 1.2.x branch (and the 1.2.x releases) do use CoffeeScript:

So...sadly, you will have to mentally juggle between the two
languages--which is why 2.0 has move to "plain old JavaScript" to make
all our lives simpler. ;)

> - If this is in the latest release, is there a way to access/adapt this via
> plugin, or is it finally time to learn how your development process works?
> ;)

The 1.2.x release does have some documentation on writing plugins:

Depending on the timeframe you're hoping to ship this in you *could*
get involved with 2.0 development (see the master branch). I'm sure
the help would be welcome. :)

> Once I figure out where to make my changes, I think this should be fairly
> straightforward - I want to keep Y as it is, and X can be calculated by the
> offset of the marginal column from the document.

Hopefully something in here will help you make the changes you need. :)

Keep us posted, Shauna!

> Thanks,
> Shauna
> _______________________________________________
> 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

More information about the annotator-dev mailing list