-
I'm trying to create a custom command that inserts an HR into the editor. I thought I'd start with this command because it's already written in milkdown, so once I get that working I can customize the command to implement my desired behavior. Here's my fiddle. When a user clicks on the "hr" text, I'd like to run Note that the command call works just fine if one uses How can I make this command succeed? Edit: I've just found the guide on this topic, but this guide only tells us how to delegate to prosemirror commands. Prosemirror, though, has a much richer syntax for commands that involve interacting with the state and dispatch, just as internal milkdown commands do. Are there any guides on how to create custom commands using that richer internal syntax? Do commands need to be presented to milkdown through the plugin interface? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
After exploring this a bit, I've learned there are at least three ways to run commands. The first set of commands are exported by
The next set of commands are exported by
The final set of commands are completely custom and let one use prosemirror's There are examples of all three commands below:
|
Beta Was this translation helpful? Give feedback.
After exploring this a bit, I've learned there are at least three ways to run commands. The first set of commands are exported by
prosemirror-commands
:The next set of commands are exported by
@milkdown/preset-commonmark
:The final set of commands are completely custom and let one use prosemirror's
state
anddispatch
interfaces to create a custom command.There are examples of all three commands below: