Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 1d0c484

Browse files
committed
fix: should not fire icon within app
1 parent 09abfd0 commit 1d0c484

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/pages/Content/components/App/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ const App: React.FC = () => {
5858

5959
const onDragStart: DraggableEventHandler = (e) => {
6060
if (
61+
e.target instanceof Element &&
6162
document
6263
.querySelector<HTMLButtonElement>('.ate_App__close-button')
63-
?.contains(e.target as Node)
64+
?.contains(e.target)
6465
) {
6566
return false
6667
}

src/pages/Content/index.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ const onMouseUp = (e: MouseEvent) => {
7575
const iconElement = document.querySelector<HTMLSpanElement>('#ate-icon')
7676

7777
if (selection.toString().trim() && iconElement) {
78+
const appElement = document.querySelector<HTMLDivElement>('.ate_App')
79+
80+
if (
81+
appElement &&
82+
e.target instanceof Element &&
83+
appElement.contains(e.target)
84+
) {
85+
return
86+
}
87+
7888
lastSelection = getTextSelection(selection)
7989
iconElement.style.top = e.pageY + 20 + 'px'
8090
iconElement.style.left = e.pageX + 'px'

0 commit comments

Comments
 (0)