Skip to content

Do we need HighlightRange? #15

Description

@Reinmar

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions