mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix copy button to preserve XML
This commit is contained in:
parent
6e958df09e
commit
5403db241f
1 changed files with 11 additions and 10 deletions
|
|
@ -13,16 +13,17 @@ export const CopyButton = ({ itemTask }: CopyButtonProps) => {
|
|||
const { isCopied, copy } = useClipboard()
|
||||
const { t } = useAppTranslation()
|
||||
|
||||
const onCopy = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
const tempDiv = document.createElement("div")
|
||||
tempDiv.innerHTML = itemTask
|
||||
const text = tempDiv.textContent || tempDiv.innerText || ""
|
||||
!isCopied && copy(text)
|
||||
},
|
||||
[isCopied, copy, itemTask],
|
||||
)
|
||||
const onCopy = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
const withoutHighlights = itemTask.replace(
|
||||
/<span class="history-item-highlight">(.*?)<\/span>/g,
|
||||
"$1",
|
||||
)
|
||||
!isCopied && copy(withoutHighlights)
|
||||
},
|
||||
[isCopied, copy, itemTask],
|
||||
)
|
||||
|
||||
return (
|
||||
<Button
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue