Merge pull request #1853 from ZKunZhang/fix/playground-copy-newlines

fix: 修复多行代码复制换行丢失问题 & 优化API参数处理#1828
This commit is contained in:
Seefs
2025-09-27 15:25:44 +08:00
committed by GitHub
3 changed files with 21 additions and 16 deletions

View File

@@ -181,8 +181,8 @@ export function PreCode(props) {
e.preventDefault();
e.stopPropagation();
if (ref.current) {
const code =
ref.current.querySelector('code')?.innerText ?? '';
const codeElement = ref.current.querySelector('code');
const code = codeElement?.textContent ?? '';
copy(code).then((success) => {
if (success) {
Toast.success(t('代码已复制到剪贴板'));