Skip to content

Commit 7549884

Browse files
authored
add types to spelling/grammar highlights (#96)
1 parent f0ee48e commit 7549884

File tree

1 file changed

+4
-1
lines changed
  • custom-highlight-api/highlightsFromPoint

1 file changed

+4
-1
lines changed

custom-highlight-api/highlightsFromPoint/script.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ function createHighlightsForWords(textNodes, words, highlightName) {
6565

6666
// If we found any words/phrases, create and register the highlight with the respective ranges
6767
if (ranges.length > 0) {
68-
const highlight = new Highlight(...ranges);
68+
let highlight = new Highlight(...ranges);
69+
if (["spelling-error", "grammar-error"].includes(highlightName)) {
70+
highlight.type = highlightName;
71+
}
6972
CSS.highlights.set(highlightName, highlight);
7073
}
7174
}

0 commit comments

Comments
 (0)