fix: remove trailing newline when copy from code blocks (#12624)

remove trailing newline when copy from codeblocks

Signed-off-by: Fy <haibarafy@163.com>
This commit is contained in:
FyLost 2026-01-29 00:12:26 +08:00 committed by GitHub
parent 742fbc555e
commit ec5bac9d43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -128,7 +128,7 @@ export const CodeBlockView: React.FC<Props> = memo(({ children, language, onSave
}, [])
const handleCopySource = useCallback(() => {
navigator.clipboard.writeText(children)
navigator.clipboard.writeText(children.trimEnd())
window.toast.success(t('code_block.copy.success'))
}, [children, t])