benrbray / prosemirror-math

Schema and plugins for "first-class" math support in ProseMirror!
https://benrbray.com/prosemirror-math/
MIT License
245 stars 35 forks source link

Preview panel support #28

Open Saul-Mirone opened 2 years ago

Saul-Mirone commented 2 years ago

Hi Benrbary:

Milkdown uses this awesome project and we have some feed back from users. It would be great if this library can support the preview panel feature like in typora:

image

I tried to just display the render block when math node is selected, but it seems that it won't update when user editing. So I think maybe it should be supported in this library.

original issue: https://github.com/Saul-Mirone/milkdown/issues/91

Saul-Mirone commented 2 years ago

I think the key is to provide a option to make this check pass even when is editing nodes. https://github.com/benrbray/prosemirror-math/blob/master/src/math-nodeview.ts#L162

benrbray commented 2 years ago

Thanks for the suggestion! This feature has been in the back of my mind for a while. I'll see if I can put something together soon!

benrbray commented 2 years ago

I started a PR that adds preview support for block math! Inline math might be trickier. The preview pane I implemented appears above the editor pane, rather than below like Typora. Can you think of any reason to prefer one choice over the other? Showing it above is nice because the rendered math stays in the same place, rather than jumping downwards.

Saul-Mirone commented 2 years ago

@benrbray Wow, that looks awesome. In fact I also prefer the preview pane above the editor, I think it's more convenient to use.