Skip to content

Commit

Permalink
Don't trim pasted text
Browse files Browse the repository at this point in the history
FIX: Stop removing leading/trailing whitespace from pasted plain text.

See https://discuss.prosemirror.net/t/pasting-white-space-sometimes-lead-to-exceptions/4094/
  • Loading branch information
marijnh committed Oct 7, 2021
1 parent 431d8ef commit 5d0e91a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function parseFromClipboard(view, text, html, plainText, $context) {
let marks = $context.marks()
let {schema} = view.state, serializer = DOMSerializer.fromSchema(schema)
dom = document.createElement("div")
text.trim().split(/(?:\r\n?|\n)+/).forEach(block => {
text.split(/(?:\r\n?|\n)+/).forEach(block => {
let p = dom.appendChild(document.createElement("p"))
if (block) p.appendChild(serializer.serializeNode(schema.text(block, marks)))
})
Expand Down

0 comments on commit 5d0e91a

Please sign in to comment.