feat: 🎸 Add plugin feature to crepe#1931
feat: 🎸 Add plugin feature to crepe#1931Striar-Yunis wants to merge 1 commit intoMilkdown:mainfrom Striar-Yunis:main
Conversation
This commit adds the ability to add to the toolbar and slash menu with custom actions and rendering. BREAKING CHANGE: 🧨 None ✅ Closes: NA
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Great! These are all the features I want 👍 |
|
Is this a vibe coded pr? |
|
I just wanted something to POC the interaction to see if there was interest beyond myself, and I wasn’t too sure how nice the rendering was going to play with React. As noted above, the actual code in this PR as it stands should definitely not be merged. If there’s interest I’d take a day to implement this properly. |
|
Thanks for the pr. In fact I'm working on similar parts. It gives me some inspirations about how to make the toolbar configurable. We need to at least support the same features on Vue. |
|
If implemented properly is this something you’d be open to merging? My initial thoughts on doing this PR the right way: If there is a ‘Plugin’ system implemented should the existing toolbar and slash menu items be updated to follow the same? How much node state does it make sense to expose to the underlying plugins? Should plugins be expected to to function with imports only from @milkdown/crepe? Should dom/markdown serialization methods always be required? I would think so. As to your statement on cue, I don’t know it very well. My thought for React and Vanilla custom blocks is that they are made aware of their DOM node and mount it as root. I’d hope vue has something similar. |
|
In fact I have another package called prosemirror-adapter which implemented all the features about the node view part. It provides the feature to let users write prosemirror view in several different frameworks. So I don't plan to accept the part in the
|
|
Oh wow that package takes care of all the hard parts. I’ll reduce this PR just down to a couple functions that take the adapter output and some metadata for button styling. |
|
Closing in favour of #1950 |

This commit adds the ability to add to the toolbar and slash menu with custom actions and rendering.
BREAKING CHANGE: 🧨 None
✅ Closes: NA
Summary
Hello I needed to be able to extend the Crepe editor and couldn't find a clean way to do it. This PR adds hooks into Crepe that allows for additional toolbar and slash menu features. The actual change is quite small, most of it is the examples. If there is interest in this PR, I'd move everything in dev to the stackblitz examples and would remove the package changes.
How did you test this change?
Under ./dev in the PR (to move to stackblitz) there are a vanilla and react example which implement custom toolbar and slash menu examples. They add support for extra text features and custom elements.