Removing menu items from default schema

I want to keep most of the defaults from (for example) new MenuCommandGroup('block') … On setup this works to remove one item… is there a more canonical way?

export function trimDefaultMenus (pm) {

I don’t know if this is best, but the following code helps remove and move commands:

const updateCmd = Object.create(null)
updateCmd["horizontal_rule:insert"] = {menu: {group: "content", rank: 71, display: {type: "label", label: "Horizontal Rule"}}}
updateCmd["selectParentNode"] = null
updateCmd["code:toggle"] = {menu: {group: "textblock", rank: 99, display: {type: "label", label: "Code"}}}

let pm = = new ProseMirror({
  place: document.querySelector("#editor"),
  menuBar: {
    float: true,
    content: [inlineGroup, [blockGroup,textblockMenu],widgetInsertMenu,historyGroup]     
  schema: widgetSchema,
  commands: CommandSet.default.update(updateCmd),
  autoInput: true,
  doc: document.querySelector("#content"),
  docFormat: "dom"

The canonical way is to use the commands option, something like this:

  commands: CommandSet.default.update({
    selectParentNode: {menu: null}
1 Like