How to transform all older inline nodes to block nodes?

Context: So, I’ve got this editor made using TipTap (Prosemirror) + YJS.

Originally, the editor used an inline Image Node extension. Many of our documents have images added inline. However, we ran into some issues with inline images and we switched the image node type to block

Now, the hiccup is that any document with the old images doesn’t render at all as prosemirror doesn’t know how to parse it.

I’m trying to figure out if there’s a way to still have image as block while still supporting the older inline images.

A solution where I have to convert all inline image nodes to block node is acceptable but I can’t find any straightforward way to do this.

All suggestions appreciated.

There are many ways to tackle this situation but if you want straightforward…

Consider creating a new image plugin by extending the Image extension and giving it a new name like imageBlock. Add both extensions and just never create inline images going forward.

Otherwise, you will need to transform the doc so it matches the Schema without the inline image. And old versions will fail to render with the new Schema.

IMHO the starter schemas are too lax. Its better to start very restrictive and relax over time which is backwards/forwards compatible.