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);