Skip to content

Commit 3e931db

Browse files
committed
fix: FireFox not support Highlight API #62
1 parent 78bc900 commit 3e931db

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/pages/content/QuickCapture.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,15 @@ const clipPage = () => {
3333
};
3434

3535
const setHighlight = (range: Range) => {
36-
if(!highlights.has("copilot-highlight")) {
37-
highlights.set('copilot-highlight', new Highlight())
36+
try {
37+
if (!highlights.has("copilot-highlight")) {
38+
highlights.set('copilot-highlight', new Highlight())
39+
}
40+
const highlight = highlights.get('copilot-highlight');
41+
highlight.add(range);
42+
} catch (error) {
43+
console.debug("platform not support highlight function")
3844
}
39-
const highlight = highlights.get('copilot-highlight');
40-
highlight.add(range);
4145
}
4246

4347

0 commit comments

Comments
 (0)