When I copy and paste blank text from notepad, divided into paragraphs, blank lines are lost.
Example. The text I'm copying:
111111
222222
333333
Text after pasting:
111111
222222
333333
Perhaps there is an extension that can solve this problem?
This is a big issue for us as well, any tips on how to patch in the current version?
Currently, I don鈥檛 have an idea, not even for the new version. 馃槙
Open for suggestions!
Here's a bad solution, but it worked:
import {Slice, Fragment, Node} from 'prosemirror-model'
function clipboardTextParser(text, context, plain)
{
const blocks = text.replace().split(/(?:\r\n?|\n)/);
const nodes = [];
blocks.forEach(line => {
let nodeJson = {type: "paragraph"};
if (line.length > 0) {
nodeJson.content = [{type: "text", text: line}]
}
let node = Node.fromJSON(context.doc.type.schema, nodeJson);
nodes.push(node);
});
const fragment = Fragment.fromArray(nodes);
return Slice.maxOpen(fragment);
}
....
tipTapEditor: new Editor({
editorProps: {
clipboardTextParser: clipboardTextParser,
},
})
....
Most helpful comment
Here's a bad solution, but it worked: