Skip to content

Commit f0d6d67

Browse files
committed
remove markdown
1 parent 32ed6da commit f0d6d67

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

package-lock.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"i18next": "^23.0.0",
112112
"ioredis": "^5.3.2",
113113
"lodash": "^4.17.21",
114+
"markdown-to-txt": "^2.0.1",
114115
"morgan": "^1.10.0",
115116
"multer": "^1.4.5-lts.1",
116117
"node-cron": "^3.0.3",

src/client/components/Chat/CopyToClipboardButton.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react'
22
import { Box, IconButton, Snackbar } from '@mui/material'
33
import ContentCopy from '@mui/icons-material/ContentCopy'
4+
import markdownToTxt from 'markdown-to-txt'
45

56
interface CopyToClipboardButtonProps {
67
copied: string
@@ -15,10 +16,10 @@ const CopyToClipboardButton: React.FC<CopyToClipboardButtonProps> = ({
1516

1617
const handleClick = () => {
1718
setOpen(true)
18-
19-
const innerHtml = document.getElementById(id).innerHTML
20-
const blobHtml = new Blob([innerHtml], { type: 'text/html' })
21-
const blobText = new Blob([copied], { type: 'text/plain' })
19+
const blobHtml = new Blob([document.getElementById(id).innerHTML], {
20+
type: 'text/html',
21+
})
22+
const blobText = new Blob([markdownToTxt(copied)], { type: 'text/plain' })
2223
const data = [
2324
new ClipboardItem({
2425
'text/plain': blobText,

0 commit comments

Comments
 (0)