ANSWER (ON EDIT):. For real work, try right-clicking on your document and clicking "Paste Easy." This precedes the formatting of the text pasted onto the clipboard. In fact, this is not a solution, but an appropriate solution.
ORIGINAL:
Did you get the answer to this question?
I have the same problem, and for me life cannot fix it. This is really annoying, especially considering that the preview pane of how code formatting should look is not accurate - it shows:
<div> <div> <p> Some comment from JetBrains. </p> </div> </div>
... but when you paste text from the editor, it is reformatted to:
<div> <div> <p> Some comment from JetBrains. </p> </div> </div>
Sorry to post a comment in the answer section, but I don't have 15 reputation.
Magnus
source share