I do have a pm instance on ‘p’ element. Schema defines marks for ‘em’ ‘strong’ and ‘br’. Pasting multiline text from browser or an editor pastes only first line. All other lines get lost.
With transformPastedHTML I successfully replaced block elements with ‘br’, this works for text copied from browser.
Text copied from an editor (notepad) is handled through transformPastedText. A simple regex \n -> ‘br’ doesn’t work as html tags will be shown as text.
Maybe transformPasted(slice) is the way to go? Or some tweaking on schema might solve the multiline problem?
Thanks for any help
If your schema doesn’t have block elements, the content in further blocks will be lost after pasting, so probably not.
For HTML parsing, you could add parse rules, either in your schema or in a custom
clipboardParser prop. For text, you probably want the [
clipboardTextParser](http://prosemirror.net/docs/ref/#view.EditorProps.clipboardTextParser] prop, which allows you to give a function from the pasted string to a document slice.
Brilliant, thank you marijn!
clipboardTextParser did the trick. This code example shows how to use clipboardTextParser: