recogito / recogito-js

A JavaScript library for text annotation
BSD 3-Clause "New" or "Revised" License
349 stars 38 forks source link

Choose annotatable items, not all wrapped items #71

Closed vorpal56 closed 2 years ago

vorpal56 commented 2 years ago

I have a container of elements, and I only want to be able to annotate only some of those elements in the container:

<div id="annotatable-container">
    <div id="content-0">
        <h5>don't want to annotate</h5>
        <span class="annotatable">want to annotate</span>
    </div>
    <div id="content-1">
        <h5>don't want to annotate</h5>
        <span class="annotatable">want to annotate</span>
    </div>
    ...
</div>

Initialization:

const el = document.getElementById('annotatable-container')
const r = new Recogito({content: el})

How would I go about only enabling annotation of elements with annotatable class?