Skip to content

Commit 08c008d

Browse files
authored
fix: 修复复制文档表格被保存为图片的问题 (#1191)
1 parent ec60ceb commit 08c008d

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/hooks/useClipboard.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { cloneDeep } from "es-toolkit";
12
import { isEmpty, remove } from "es-toolkit/compat";
23
import { nanoid } from "nanoid";
34
import {
@@ -32,14 +33,7 @@ export const useClipboard = (
3233
} as DatabaseSchemaHistory;
3334

3435
if (files) {
35-
Object.assign(data, files, {
36-
group: "files",
37-
search: files.value.join(" "),
38-
});
39-
} else if (image) {
40-
Object.assign(data, image, {
41-
group: "image",
42-
});
36+
Object.assign(data, files, { group: "files" });
4337
} else if (html && !copyPlain) {
4438
Object.assign(data, html);
4539
} else if (rtf && !copyPlain) {
@@ -48,9 +42,13 @@ export const useClipboard = (
4842
const subtype = await getClipboardTextSubtype(text.value);
4943

5044
Object.assign(data, text, { subtype });
45+
} else if (image) {
46+
Object.assign(data, image, {
47+
group: "image",
48+
});
5149
}
5250

53-
const sqlData = data;
51+
const sqlData = cloneDeep(data);
5452

5553
const { type, value, group, createTime } = data;
5654

0 commit comments

Comments
 (0)