Closed
Description
Moving the original issue from https://github.com/dlibby-/highlight/issues/15
@Reinmar as FYI
To avoid defining a new subclass of Range, perhaps the entire API could be somehow built around the HighlightsMap.
const range = new Range();
const highlight = document.highlights.create( 'example-highlight', range, {
priority: 1
} );
highlight.style.color = 'red';
highlight.priority = 42;
document.highlights.remove( range );
HighlightsMap#create()
doing create&add at once is not the prettiest method, but maybe something along these lines could work. Having those new properties (style
, priority
, label
) in some new interface (rather than squashed together with Range
's properties) might avoid creating one giant class.
Metadata
Metadata
Assignees
Labels
No labels