@antv/x6
Version:
JavaScript diagramming library that uses SVG and HTML for rendering.
24 lines (21 loc) • 488 B
text/typescript
export const clearSelection = (function () {
const doc = document as any
if (doc.selection) {
return function () {
doc.selection.empty()
}
}
if (window.getSelection) {
return function () {
const selection = window.getSelection()
if (selection) {
if (selection.empty) {
selection.empty()
} else if (selection.removeAllRanges) {
selection.removeAllRanges()
}
}
}
}
return function () {}
})()