From 53e9aea82f969b21b1c00f37bd8e1354969c5ee4 Mon Sep 17 00:00:00 2001 From: codytseng Date: Wed, 16 Jul 2025 09:24:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PostEditor/PostTextarea/ClipboardAndDropHandler.ts | 10 +++++++--- src/pages/secondary/NotePage/index.tsx | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/PostEditor/PostTextarea/ClipboardAndDropHandler.ts b/src/components/PostEditor/PostTextarea/ClipboardAndDropHandler.ts index 4164dec9..5fc4a4fb 100644 --- a/src/components/PostEditor/PostTextarea/ClipboardAndDropHandler.ts +++ b/src/components/PostEditor/PostTextarea/ClipboardAndDropHandler.ts @@ -82,9 +82,13 @@ export const ClipboardAndDropHandler = Extension.create 0) nodes.push(schema.nodes.hardBreak.create()) if (parts[i]) nodes.push(schema.text(parts[i])) } - const fragment = schema.nodes.paragraph.create(null, nodes) - const tr = view.state.tr.replaceSelectionWith(fragment) - view.dispatch(tr) + if (nodes.length > 0) { + const tr = view.state.tr.replaceSelectionWith(nodes[0]) + for (let i = 1; i < nodes.length; i++) { + tr.insert(tr.selection.from, nodes[i]) + } + view.dispatch(tr) + } }) handled = true } diff --git a/src/pages/secondary/NotePage/index.tsx b/src/pages/secondary/NotePage/index.tsx index 5ac901f6..de620288 100644 --- a/src/pages/secondary/NotePage/index.tsx +++ b/src/pages/secondary/NotePage/index.tsx @@ -112,7 +112,7 @@ function ExternalRoot({ value }: { value: string }) { return (
push(toNoteList({ externalContentId: value }))} >
{value}
@@ -136,7 +136,7 @@ function ParentNote({ if (isFetching) { return (
- +