From 34575e4eb7d93a02e6500f5af592cb6448483c56 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 26 Nov 2025 23:27:33 +0100 Subject: [PATCH] fix(editor): don't convert text that's pasted into a code block to markdown Resolves https://community.vikunja.io/t/pasting-into-code-block-renders-markdown/4181 --- frontend/src/components/input/editor/TipTap.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/input/editor/TipTap.vue b/frontend/src/components/input/editor/TipTap.vue index 0c1e40e9d..1c9a5f06c 100644 --- a/frontend/src/components/input/editor/TipTap.vue +++ b/frontend/src/components/input/editor/TipTap.vue @@ -373,12 +373,18 @@ const PasteHandler = Extension.create({ } } } - + const text = event.clipboardData?.getData('text/plain') || '' if (!text) { return false } + // Don't convert markdown when pasting inside a code block + const $from = view.state.selection.$from + if ($from.parent.type.name === 'codeBlock') { + return false + } + const hasMarkdownSyntax = new RegExp('[*`_\\[\\]#-]').test(text) if (!hasMarkdownSyntax) { return false