From 8b4cc82e5ad5bdb7670b9699cde0b72c249044cc Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sat, 28 Mar 2026 23:59:46 +0000 Subject: [PATCH] fix clipboardTextSerializer for single lines --- .../editor/extensions/markdown-clipboard.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/client/src/features/editor/extensions/markdown-clipboard.ts b/apps/client/src/features/editor/extensions/markdown-clipboard.ts index 8e55f3a8..1810dd96 100644 --- a/apps/client/src/features/editor/extensions/markdown-clipboard.ts +++ b/apps/client/src/features/editor/extensions/markdown-clipboard.ts @@ -20,6 +20,20 @@ export const MarkdownClipboard = Extension.create({ key: new PluginKey("markdownClipboard"), props: { clipboardTextSerializer: (slice) => { + const listTypes = ["bulletList", "orderedList", "taskList"]; + let topLevelCount = 0; + let hasList = false; + slice.content.forEach((node) => { + if (listTypes.includes(node.type.name)) { + hasList = true; + topLevelCount += node.childCount; + } else { + topLevelCount++; + } + }); + + if (!hasList || topLevelCount < 2) return null; + const div = document.createElement("div"); const serializer = DOMSerializer.fromSchema(this.editor.schema); const fragment = serializer.serializeFragment(slice.content);