When the textof an annotation is deleted, the annotation visually disappears but is still stored in the annotation map with to === from, which is an invalid annotation state.
either completely delete the annotation from storage on document remapping
orprovide a callback function like onAnnotationDelete():boolean to be called when changing the document would result in the removl of an annotation, the user could then provide a function to decide if the document change should pass or not (e.g. a modal)
Currently, annotations are rendered so that as many annotations as possbile are visible at the same time. The new feature should implement a new "rendering strategy", making it possible to specify which annotation should be rendered above others, possibly hiding other annotations completely. This can be compared to the CSS z-index attribute.
Currently the annotation changes are not tracked by the histories undo() and redo() commands. This is probably due to the fact that annotations are not stored inside the plugins storage field in the editor state but in an ordinary map.
Move the annotaitons map to the extensions storage field
When you place the cursor in the editor, onSelectionChange() only returns the fragment that is rendered at this position. Instead it should return all annotations at this position, wether they are visible or not.
When two annotations either start or end on the same index, the rendering algorithm will create an "empty" decoration, where start and end are the same index. This triggers the "corrupt decoration" warning and is unwanted behavior.
Handle the edge case where two annotations start or end index are identical and avoid creating empty decorations in OverlapHelper.ts
Currently three different contracts are used for annotations: annotation.model.ts, term.model.ts, TermItem.ts
They are mixed in describing either the real annotation object, or the tiptap decoration and should be clearly identifiable as such.
Merge annotation.model.ts and term.model.ts
Reevaluate if TermItem.ts is necessary, if it is make it clear that it describes the Decoration
Make the data attribute in annotations strongly typed