Comments (2)
There are not, but it should be fairly easy to implement yourself.
The annotator.ui.main
function returns a block of hooks:
{
// ... left out for brevity ...
beforeAnnotationCreated: function (annotation) {
// Editor#load returns a promise that is resolved if editing
// completes, and rejected if editing is cancelled. We return it
// here to "stall" the annotation process until the editing is
// done.
return s.editor.load(annotation, s.interactionPoint);
},
beforeAnnotationUpdated: function (annotation) {
return s.editor.load(annotation, s.interactionPoint);
}
}
Instead, you can use something like this:
function myAppExtension(options) {
var hooks = annotator.ui.main(options);
// We'll have to capture the default hooks. They have the reference
// to the editor object and we do not, so we'll invoke them to show the
// editor.
var beforeAnnotationCreated = hooks.beforeAnnotationCreated;
var beforeAnnotationUpdated = hooks.beforeAnnotationUpdated;
hooks.beforeAnnotationCreated = function (annotation) {
// Custom logic here, then either invoke or skip the base hook
// Either invoke this, or not, as you wish, but if you do make sure to return the promise
var promise = beforeAnnotationCreated(annotation);
// Custom logic here, at which point the editor should be shown
// You can attach more then clauses to the promise before you return it
// if you want to take action after the editor is closed.
return promise;
}
// Same thing for beforeAnnotationUpdated (left out for brevity)
}
from annotatorjs.org.
In general, v2 is decomposed more into into components and you should feel free to use them as is, extend their hooks, or build a whole new application by copying the annotator.ui.main
function and building your own.
I found that with the Annotator v1.2.x event model it was very difficult to change the way annotator behaved. It was possible to react to Annotator's events, but little else. With the promise-based hooks you can resolve asynchronous hooks to result values, defer resolution, or reject them. You have much more control, but fewer quick conveniences.
from annotatorjs.org.
Related Issues (9)
- Update Link to Mailing List HOT 9
- Consolidate to Jekyll site? HOT 4
- docs.annotatorjs.org should default to 2.x
- Demo page doesn't use the new responsive template HOT 9
- Demonstration on Annotator home page not working HOT 1
- Demo page annotator can't search the data store HOT 6
- Update content HOT 3
- Menu Nav different for index, showcase, plugins HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from annotatorjs.org.