Skip to content

Commit

Permalink
fix: copy blank space undefined bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh990918 committed Mar 7, 2023
1 parent 2d0169d commit 76555a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/MessageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ export default ({ role, message, showRetry, onRetry }: Props) => {

if (el.matches('div > div.copy-btn')) {
code = decodeURIComponent(el.dataset.code!)
} else {
copy(code)
}
if (el.matches('div > div.copy-btn > svg')) {
code = decodeURIComponent(el.parentElement?.dataset.code!)
copy(code)
}
copy(code)
})

const htmlString = () => {
Expand Down

0 comments on commit 76555a7

Please sign in to comment.