Where examples can be found


Everytime I try to implement something within ProseMirror, I stuck because of lack of code examples. Just last thing I faced: trying to clean some pasted HTML before putting it into editor. So I found in several places that transformPastedHTML can be used for this, but how can I know how and where should it be used? ProseMirror is great thing in general, but honestly, it is too complicated from development side, and references of all available functions doesn’t help a lot, without examples of usage.

I built a starter kit that is available at: https://github.com/mfoitzik/prosemirror-breakout-starter-kit that MAY help you get started. It basically breaks out the basic example and brings everything you need into one project. Regarding cleaning pasted HTML, from my limited experience and use case i have found that this is what is great about Prosemirror. If things aren’t defined in the schema they are basically ignored and stripped out. This may be an over simplified statement, but has worked for me.

Thank you very much for participating. Yer starter kit is great! I believe I will figure out my current issue with pasting HTML, however, question in general is about missing examples that makes it very difficult to work with component. Every time I come to prosemirror issues or documentation I end up with the same: trying to google someone’s examples of usage functions listed in references.

I’m going to assume you did see https://prosemirror.net/examples/

This is a very general library, mostly maintained by a single person, so providing specific examples of every possible way you might want to use the library is just not realistic.

Hey Marijn I assume you’d be open to other examples if some of us wanted to take a swing at them via PR’s? (I will grant you, mine are likely to be rough, but I have a few ideas percolating back of the ol’ brain.)

In principle, absolutely, but they can’t be too rough, since they should illustrate whatever is is they are doing in a clear enough way to be more helpful than confusing.

Hi - what is a “PR”? I’m fairly new to this world.

PR = Pull Request @ GIT… or a Personal Record if your e.g. into lifting weights :stuck_out_tongue:

Ok many thanks.

Fair enough. The thing that gives me the most trouble is the positioning system. I’d love to be able to just insert a node at a given top-level index of my document, or a position inside a paragraph or other container and I find the calculations and code involved entirely befuddling. I’ve got a working example with a gallery finally and have a similar structure around related link nodes and a related links list that I think might be illuminating with some proper cleanup.

I think there the description in the guide could be helpful here.

I’ve read it many times over since it was originally published. I think I sort of get it now this week after wrestling a few of our more complex nodes as part of our latest release.

BTW I should be clear, I think this library is amazing and I appreciate the effort that went into building it and the docs which are great. Content editing is a non-trivial domain. Thank you for providing this forum to discuss the library and ask for help.