ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.53k stars 334 forks source link

Speckle Plugin from the guide is not working #1452

Closed gryzzly closed 3 months ago

gryzzly commented 3 months ago

Hey, I‘m following the guide https://prosemirror.net/docs/guide/ and trying to add the simple "specklePlugin". However, for some reason it is not working at all, no text gets yellow background.

I put the code here – https://codepen.io/gryzzly/pen/dyLZRLG?editors=1100 (the block with the red border is the ProseMirror container and can be typed into).

Am I doing something wrong?

Thanks!

marijnh commented 3 months ago

When I try to use the plugin from the guide it works for me. The code seems to try to use a CDN to load ProseMirror, which often causes issues with duplicate modules, that may be the issue.

gryzzly commented 3 months ago

Sorry, I assumed for no reason that it will dynamically add speckles to the text and initialised without any content. Once I add some content to the initial state I can see the decorations applied. It’s iterating over the initial doc, and apply method demonstrates that it will maintain the marks in the expected places.

(I updated the pen linked here so it has some initial text as well). The CDN is actually OK as with the import map you can specify the exact versions and we prevent esm.sh from rewriting paths with the "star" before the package name – "https://esm.sh/*prosemirror-model@1.19.4")