Menu system update and a related scope reduction

Hi all. I just pushed a bunch of patches to the repository that overhaul the way you define menus and the way prompting for parameters work. The upshot is:

  • You can define much richer menu structures, by passing in actual objects that render themselves however they please.
  • The hierarchical structure of the menu (insert drop-down and such) is now defined with such structures, rather than with menu commands.
  • It should be easier to define your own command parameter prompting interfaces now.
  • The menu’s and prompt’s visual style got simpler.

I’ll release these as 0.3.0 tomorrow

Now, wasting several days struggling with the difficulties of making menus automatically adjust to their context (schema, available commands) while at the same time making them very configurable, as well as fighting CSS troubles left and right, has made me realize that I’ll never get this perfect, and most users will completely redefine the UI anyway, so I should be focusing on the core editing stuff instead.

So I simplified a bunch of things, and left some other things (such as the tooltip menu) in their existing non-optimal form. UI is hard, and for now I’m taking the scope of the core ProseMirror package to not include super-slick menus. It should produce a useable editor out of the box, without every user needing to write a ton of extra code, but that’s about it.

I’m going to be focusing on other things, and I’m inviting all of you to write your own custom menus, and if possible, to publish them so that others can learn from them. I will be responsive to issues that say ‘I need this hook or event to implement my UI’. I will not be responsive to issues that say ‘the way the tooltip menu works/looks is wrong’. I have other stuff to get to first. Ideally, we’ll see some solid implementations that the core library can later steal from.

3 Likes

Can you point me to any examples yet of customizing menus in 0.3.0 yet? The examples + code on the first page of the docs are helpful in general, but all of the menus use defaults. For example, it would be nice to simplify the menus by removing the options to add images and code and only keep a couple header levels (and change their labels). I’ve read the 0.3 docs but it’s hard to make sense of it (for me) without an example.

thanks

Sorry, didn’t see this: https://github.com/pboysen/prosemirror-widgets/blob/master/src/main.js

I’ll work with that example. It still may be nice to do a basic example on the home page alongside others. Thanks again.