Skip to content

Commit deff9ae

Browse files
committed
refactor(devtools): clear text selection on click in source inspector
1 parent 6cc63dc commit deff9ae

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/devtools/src/components/source-inspector.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ export const SourceInspector = () => {
7171
})
7272
})
7373

74-
createEventListener(document, 'click', (e: Event) => {
74+
createEventListener(document, 'click', (e) => {
7575
if (!highlightState.element) return
7676

77+
window.getSelection()?.removeAllRanges()
7778
e.preventDefault()
7879
e.stopPropagation()
80+
7981
fetch(
8082
`${location.origin}/__tsd/open-source?source=${encodeURIComponent(
8183
highlightState.dataSource,

0 commit comments

Comments
 (0)