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
This commit is contained in:
parent
f7bdb996ca
commit
34575e4eb7
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue