Skip to content

Commit

Permalink
Merge pull request #1 from zouhangwithsweet/feat/support-select-layers
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet authored Feb 27, 2024
2 parents c7becfc + 2312455 commit 5ad6c7e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions entrypoints/injected/components/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ 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)
return () => {
document?.removeEventListener('click', layersClickHandle)
}
}, [handleSelectionChange])

const [_, copy] = useCopyToClipboard()

const handleCopy = (text: string) => () => {
Expand Down

0 comments on commit 5ad6c7e

Please sign in to comment.