mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 21:33:41 +02:00
ProseMirror's default clipboardTextSerializer uses Slice.textBetween, which flattens every node to its inner text. Copying `## 你好` from the editor only put `你好` on the clipboard's text/plain channel, so pasting into VS Code, terminals, or messaging apps lost all Markdown markers. Add a markdown-copy extension symmetric to the existing markdown-paste: on copy/cut/drag, route the selected Slice through editor.markdown.serialize to write the Markdown source. The text/html channel is left at ProseMirror's default so pasting back into another ProseMirror editor still preserves exact node structure via data-pm-slice. Registered for both editable and readonly modes — users frequently copy from rendered comments/issue descriptions. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>