Prosemirror-markdown with custom schema

Hello,

I am new to prosemirror and came up with an error which I cannot figure out. I am using a custom schema and prosemirror-markdown as I have custom markup as well. When I am typing I see the error below looks like multiple versions of prosemirror-model were loaded. However, if I use defaultMarkdownParser everything is ok, my custom schema is not to blame, can look exactly the same as the one in prosemirror-markdown and I still receive an error. The check nodes instanceof Fragment fails although it should not.

let schema = new Schema(…); new EditorView(container, { state : EditorState.create({ doc: (new MarkdownParser(schema, …)).parse(markup) }) })

index.es.js?a958:322 Uncaught RangeError: Can not convert <β€œTesting a boldd”> to a Fragment (looks like multiple versions of prosemirror-model were loaded) at Function.from (index.es.js?a958:322) at NodeType.create (index.es.js?a958:1950) at NodeContext.finish (index.es.js?304a:2731) at ParseContext.finish (index.es.js?304a:2997) at DOMParser.parse (index.es.js?304a:2566) at parseBetween (index.es.js?576a:2387) at readDOMChange (index.es.js?576a:2446) at DOMObserver.eval (index.es.js?576a:3121) at DOMObserver.flush (index.es.js?576a:3039) at MutationObserver.DOMObserver.observer (index.es.js?576a:2912)

Can you please help me with this one?

Fragment.from is receiving an object that looks like a Fragment but isn’t instanceof Fragment, so it’s raising that error, since bundlers loading multiple versions of the library has come up before. As such, the first thing you should do is ensure that this isn’t the case.

Apparently there is only one version, I will check it out again to see if I can figure out.

β”œβ”€β”¬ prosemirror-markdown@1.4.4 β”‚ └── prosemirror-model@1.9.1 deduped β”œβ”€β”€ prosemirror-model@1.9.1 β”œβ”€β”¬ prosemirror-schema-basic@1.1.2 β”‚ └── prosemirror-model@1.9.1 deduped β”œβ”€β”¬ prosemirror-state@1.3.2 β”‚ └── prosemirror-model@1.9.1 deduped β”œβ”€β”¬ prosemirror-transform@1.2.3 β”‚ └── prosemirror-model@1.9.1 deduped └─┬ prosemirror-view@1.14.2 └── prosemirror-model@1.9.1 deduped

Providing the EditorView with domParser: DOMParser(schema) temporarily fixed the problem 2d ago, in the meantime I discovered the real cause and made sure I have only one prosemirror-*. Thank you.

1 Like