Prosemirror: Deregister items from the menubar

Created on 14 Oct 2015  路  6Comments  路  Source: ProseMirror/prosemirror

I haven't found a way to remove buttons or functionality from the toolbar. I think menu/items.js should export deregisterItem():

export function deregisterItem(tag, item) {
  (tags[tag] || (tags[tag] = []));
  let index = tags[tag].indexOf(item);
  if (index > -1) {
    tags[tag].splice(index, 1);
  }
}

Most helpful comment

@marijnh have you an example how to do that? I can't find it in the documentation ...

All 6 comments

Functionality (blockquotes, images, ...) should also be disableable completely (no image dragging / pasting / ...). Not sure if that is supported yet.

This isn't supported yet. I'm going to somehow tie the way the system finds available menu items to the schema system (since most menu items only make sense if your schema supports certain kinds of nodes/features), so this is about to change anyway. I'll probably make it easier to specify your own explicit list of items as well -- having a sensible default is good, but people will want to customize this.

:100:

You can now

  • Specify specific items to use in your menu

or

  • Adjust the menu properties of specific command specs to change the way they appear in the menu

@marijnh have you an example how to do that? I can't find it in the documentation ...

Something like (in your options)

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

... would remove the selectParentNode command from the menu.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mhuebert picture mhuebert  路  3Comments

kepta picture kepta  路  4Comments

SamyPesse picture SamyPesse  路  3Comments

stevemao picture stevemao  路  5Comments

marijnh picture marijnh  路  6Comments