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