diff --git a/src/hooks/usePasteTextClipboardData.ts b/src/hooks/usePasteTextClipboardData.ts
index 8d7100a4..d382067e 100644
--- a/src/hooks/usePasteTextClipboardData.ts
+++ b/src/hooks/usePasteTextClipboardData.ts
@@ -3,6 +3,7 @@ import { MutationTypes, useStore } from '@/store'
import { decrypt } from '@/utils/crypto'
import { PPTElement, Slide } from '@/types/slides'
import { createRandomCode } from '@/utils/common'
+import { parseText2Paragraphs } from '@/utils/textParser'
import useHistorySnapshot from '@/hooks/useHistorySnapshot'
import useCreateElement from '@/hooks/useCreateElement'
@@ -103,7 +104,10 @@ export default () => {
}
// 普通文本
- else if (!onlyElements && !onlySlide) pasteText(clipboardData)
+ else if (!onlyElements && !onlySlide) {
+ const string = parseText2Paragraphs(clipboardData)
+ pasteText(string)
+ }
}
return {
diff --git a/src/utils/textParser.ts b/src/utils/textParser.ts
new file mode 100644
index 00000000..00578043
--- /dev/null
+++ b/src/utils/textParser.ts
@@ -0,0 +1,9 @@
+export const parseText2Paragraphs = (text: string) => {
+ const htmlText = text.replace(/[\n\r]+/g, '
')
+ const paragraphs = htmlText.split('
')
+ let string = ''
+ for (const paragraph of paragraphs) {
+ if (paragraph) string += `