Depending on your image schema definition (whether its inline or not), wouldnt the paragraph be created automatically (if inline), in order to preserve the schema? @marijn
The default schema has inline: true (also read the spec on groups as you’ll likely need to override that attribute list as well.
If you only go with that, I don’t think you’ll be able to insert images next to text. Curious how it goes though. (If you decide to keep the inline image type in parallel, you’ll have to worry about converting back and forth.)
Friendly suggestion to think more about what you really what the user to be able to do before overriding the attribute. It’s quite likely you should just work on implementing the programmatic insertion / wrapped with paragraph (if required, desired by user)
I meet this problem too when I would like to insert a block with paragraph inside.
Instead of using some given functions , for example “wrap”, I create a node Json to describe the node to insert.
It may be a little difficult to create a complicated node in ProseMirror by given APIs, while we are not familiar with them. But we can do this easily with json object, which can be changed to whatever we want.
For this question, A easy way to do this is as follow.