Seems if I paste content with [data-pm-slice] attribute, it will preserve whitespace. is there an other way to preserve whitespace if pasted content has no [data-pm-slice] attribute?
Where is this HTML coming from? The library collapses space in HTML input, because that’s how HTML is generally rendered. I haven’t ran into a situation where HTML from an external source treats whitespace this way before—and if you were to set the editor up like this, preserving such space, I suspect you’d get issues with unintended whitespace showing up in your document when people copy-paste from random websites.
Okay, I guess it would be reasonable to preserve white space inside an element marked white-space: pre. Doing it for clipboard content in general wouldn’t be a good idea—people pasting from websites will get all kinds of unintended white space in their documents. This patch adds logic to the parser to preserve white space in this situation.