Event for selection
gabrielbuzziv opened this issue · comments
There is an event when the text is selected (selectAnnotation
) but it's not possible to stop the editor from appearing.
May become possible in a future version (which introduces more decoupling between the annotation layer and the editor). But that's more work than I can currently handle on the side.
As an alternative: rather than introduce a two-step process, perhaps you could build your own editor extension for the functionality you want?
P.S.: in RecogitoJS's image annotation sister project Annotorious, there's something called headless mode which allows you to switch the editor on and off dynamically. I could see a possible workaround being built with that. Alas, headless mode isn't yet available in RecogitoJS I'm afraid.
Anyways, if you want to hack inside RecogitoJS, most of the lifecycle state logic for the editor is here:
https://github.com/recogito/recogito-js/blob/main/src/TextAnnotator.jsx
Thanks!!
I code a workaround for now, cause what i want is the possibility of use the recogito to highlight the text and to add annotation.
FYI, the use of case, is that i have an app that have questionaries for advance studies and the students ask for a highlight and annotation on texts to help the resolution.
Excellent! That sounds great. I'm interested: can you explain about how your workaround works? (Maybe there's something I can learn concerning the future architecture of RecogitoJS...)
@rsimon it's possible to get the event for dom elements selection too?
I would like to get the event of selection and do something.
A first version of headless mode is now available. (Currently in the main branch only, but will come with the next release, v1.4.4.)
Also, the selectAnnotation
event now returns the clicked SPAN element as second argument:
r.on('selectAnnotation', function(annotation, element) {
// ...
});