Skip to content

Commit

Permalink
chore: update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet committed Feb 27, 2024
1 parent 5ad6c7e commit a81ccb9
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions entrypoints/injected/components/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,10 @@ export const CodeArea = memo((props: { minimized?: boolean }) => {
}, [handleSelectionChange])

useEffect(() => {
const layersClickHandle = (e: Event) => {
// hard code specially class prefix
if (/dev_handoff_layers.*/.test((e.target as HTMLElement).className)) {
handleSelectionChange()
}
}

document?.addEventListener('click', layersClickHandle)
const leftPanel = document.querySelector('#left-panel-container')
leftPanel?.addEventListener('click', handleSelectionChange)
return () => {
document?.removeEventListener('click', layersClickHandle)
leftPanel?.removeEventListener('click', handleSelectionChange)
}
}, [handleSelectionChange])

Expand Down

0 comments on commit a81ccb9

Please sign in to comment.