Skip to content

Commit

Permalink
fix: Catch cursor acquisition exception
Browse files Browse the repository at this point in the history
  • Loading branch information
1943time committed Oct 11, 2024
1 parent ceb7ea0 commit f2fe4ff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/renderer/src/editor/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ export const mediaType = (name?: string) => {
}

export const getSelRect = () => {
const domSelection = window.getSelection()
const domRange = domSelection?.getRangeAt(0)
return domRange?.getBoundingClientRect() || null
try {
const domSelection = window.getSelection()
const domRange = domSelection?.getRangeAt(0)
return domRange?.getBoundingClientRect() || null
} catch(e) {
return null
}
}

0 comments on commit f2fe4ff

Please sign in to comment.