Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/extensions/Markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,13 @@ const Markdown = Extension.create({
const doc = document.cloneNode(false)
const dom = doc.createElement('div')
if (shiftKey) {
// Treat single newlines as linebreaks and double newlines as paragraph breaks when pasting as plaintext
dom.innerHTML = '<p>' + str.replaceAll('\n', '<br />').replaceAll('<br /><br />', '</p><p>') + '</p>'
// Treat double newlines as paragraph breaks when pasting as plaintext
for (const part of str.split('\n\n')) {
const para = doc.createElement('p')
// Treat single newlines as linebreaks
para.innerText = part
dom.append(para)
}
} else {
dom.innerHTML = markdownit.render(str)
}
Expand Down