Skip to content

Commit d564474

Browse files
committed
fix copy button to include xml
1 parent 6e958df commit d564474

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

webview-ui/src/components/history/CopyButton.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ export const CopyButton = ({ itemTask }: CopyButtonProps) => {
1313
const { isCopied, copy } = useClipboard()
1414
const { t } = useAppTranslation()
1515

16-
const onCopy = useCallback(
17-
(e: React.MouseEvent) => {
18-
e.stopPropagation()
19-
const tempDiv = document.createElement("div")
20-
tempDiv.innerHTML = itemTask
21-
const text = tempDiv.textContent || tempDiv.innerText || ""
22-
!isCopied && copy(text)
23-
},
24-
[isCopied, copy, itemTask],
25-
)
16+
const onCopy = useCallback(
17+
(e: React.MouseEvent) => {
18+
e.stopPropagation()
19+
!isCopied && copy(itemTask)
20+
},
21+
[isCopied, copy, itemTask],
22+
)
2623

2724
return (
2825
<Button

0 commit comments

Comments
 (0)