Skip to content

Commit a56adb9

Browse files
committed
Allow overlapping highlight selection
1 parent a6d9713 commit a56adb9

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Highlighter.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,13 @@ export default class Highlighter {
261261
const highlights: Highlight[] = Object.values(this.highlights)
262262
.filter((other: Highlight) => other.intersects(range));
263263

264-
if (highlights.length === 0) {
265-
const highlight: Highlight = new Highlight(
266-
range,
267-
{ content: rangeContentsString(range) },
268-
this.getHighlightOptions()
269-
);
270-
onSelect(highlights, highlight);
271-
} else {
272-
onSelect(highlights);
273-
}
264+
// This now allows overlapping highlights
265+
const highlight: Highlight = new Highlight(
266+
range,
267+
{ content: rangeContentsString(range) },
268+
this.getHighlightOptions()
269+
);
270+
onSelect(highlights, highlight);
274271
}
275272
}
276273

0 commit comments

Comments
 (0)