I have several types of ‘paragraphs’ (one schema node type with an attribute specifying the particular paragraph type), and even though when copied the slice nodes are fine, I am running into a problem when pasting them in elsewhere.
My problem is when pasting the copied block in at a random spot in my document, the paragraph type for the insertion might not be the same as the paragraph type at the beginning of what I copied. Since I don’t want dissimilar paragraph types to get combined, I really want to be able to put that first pasted node in its own separate paragraph and not to just have it’s text pasted into the wrong paragraph type. As simple example might be that type 1 might be upper.lower and type 2 might be all uppercase. Thus pasting in a sentence from a type 1 into a type 2 paragraph would at the very least make it all uppercase, not what I want.
So, since I prefer if my paragraph types don’t mix, I am trying to sort out how to make the first and last nodes in the copied text get inseted in as new paragraphs when attempting to paste them into a different paragraph type. Does PM have any node comparison logic in the paste to check the node type and do something? And, can I make my alteration via any sort of a hook?
As a note, I was successful in intercepting the backspace and keydown events that might cause a selection across paragraphs join into dissimilar nodes (and disallowing it), but copy and paste seems a lot more complex, and I don’t really want to have to even think about tweaking the PM source code.