Here at Atlassian we’ve been using ProseMirror quite heavily for about two years now. It’s an awesome library and it satisfies most of our requirements.
While working on complex features we’ve found that it takes quite a bit of time and effort to get document and selection manipulation right. We’ve found certain patterns that we follow from plugin to plugin, and a copy-pasted pieces of code around the codebase. We wanted an abstraction layer that’d incapsulate that complexity into a set of utility functions that we’d reuse.
We created a small library: prosemirror-utils with the idea in mind that we’d become more efficient and focus on developing features.
I thought the community might be interested in that as well. Feel free to give feedback and contribute!
Interesting project. I also ended up writing a good amount of helpers myself too. It’s interesting to see how others are using PM.
I did notice a text editor in one of your apps looked new and was really pleasant to use, so I had to check what you were using. I saw PM and was so happy!! Personally a huge fan of the list input rules
Hoping for the day when all of your apps’ text editors are updated with PM
Thanks for this! It looks very helpful. One question I have about the license: I see it is apache licensed, whereas the rest of ProseMirror is MIT-licensed. The license itself is fine. We use other licenses (AGPL, LGPL) ourselves. But AFAIK Apache and MIT are fairly similar in terms of what you can use the code for, so I’m wondering a bit what the implications here are.
@johanneswilm Apache 2.0 and MIT are compatible, the only reason we decided to go with the former is to use the same license as our main repo.
@beckiechoi If you have any useful helpers, feel free to open a PR it would be interesting to see what utils did you end up writing. We’re planning to continue adding more to the library, as we actively building new features.
One of the things that I’ve been wanting to do is decomposing prosemirror-commands into a reusable set of functions that would operate on transactions. We found that sometimes we need a slightly different behaviour from what the standard commands offer, or we need to alter the behaviour because our UX requirements change (e.g. based on user feedback). In my mind a command could accept a transaction object as an argument, call a few of those transform utils and the dispatch. That way it would make commands more flexible.
Another thing that we’re planning to do is extracting lists commands from prosemirror-schema-lists for the same reason - we often copy the internals of a command and modify it to meet our requirements.
I agree in principle—it’s just that most of these commands do such convoluted things that I haven’t really found the nice single-purpose primitives that they should decompose into. I’m interested in what you’ll come up with.