Eg: adding a menu item and custom command http://prosemirror.net/ref.html#MenuCommand . Bonus if demos could be on jsbin or somewhere to tweak the example online.
import {elt} from 'prosemirror/src/dom'
import {CommandSet} from 'prosemirror/src/edit'
class ed_upload_image {
render (pm) {
return elt('button', {}, 'Upload Image')
}
}
let commands = CommandSet.default.add({ed_upload_image})
I’m missing why the “Upload Image” button isn’t showing up in the menu. It works when I define the command as an object like this.
Edit: I see I’m not adding it to the menu group. How can I do that with the custom class?
CommandSet.add
takes a CommandSpec
, which that class most certainly isn’t.
You’ll want to add it directly to your menu, using, for example, the content
property of your menuBar
option.