gzuidhof / starboard-notebook

In-browser literate notebooks
Mozilla Public License 2.0
1.24k stars 99 forks source link

Markdown editor not working - possible package version mismatches #133

Open BartlomiejLewandowski opened 1 year ago

BartlomiejLewandowski commented 1 year ago

Hi,

I've been trying to integrate and extend starboard notebook to have a side panel, and a few other improvements. It's was going along nicely, until I noticed that the markdown editor has an issue - typing anything resets the cursor and an error message is shown - that "prosemirror-model" has been loaded twice.

I've been scratching my head for a few days now, trying to get to the bottom and slowly loosing my sanity ;) These are the things that I've tried / found out in the debugging sessions:

I'm using yarn, and just building the packages/starboard-notebook part. I've read a bit about prosemirror-model errors, and it would seem like something that should be resolved by resolutions field in yarn. I've pinned the following versions


 "resolutions": {
    "prosemirror-commands": "1.5.0",
    "prosemirror-dropcursor": "1.6.1",
    "prosemirror-gapcursor": "1.3.1",
    "prosemirror-history":"1.3.0",
    "prosemirror-inputrules":"1.2.0",
    "prosemirror-keymap": "1.2.0",
    "prosemirror-markdown":"1.10.1",
    "prosemirror-model": "1.13.3",
    "prosemirror-schema-list":"1.2.2",
    "prosemirror-state": "1.4.2",
    "prosemirror-tables": "1.3.2",
    "prosemirror-utils":"0.9.6"
  },```

The error still persists.

So I went to check if starboard-rich-editor and it's dependency is to blame.
Interestingly markdown-editor has a similar issue - prosemirror-model also logs the same error when trying to import and use Editor from that package.
It was resolved by specifying  "prosemirror-model": "1.13.3".

I'm really curious how the dist package was built that is being hosted on unkpg, since that script doesn't suffer from this error.
I'm sure it boils down to yarn package resolution + webpack somehow including an odd version of a package?

Would appreciate any guidance here, I think this repo is a gem with the pyodide integration