prosemirror-math icon indicating copy to clipboard operation
prosemirror-math copied to clipboard

Preview panel support

Open Saul-Mirone opened this issue 4 years ago • 4 comments

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 avatar Aug 18 '21 01:08 Saul-Mirone

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

Saul-Mirone avatar Aug 18 '21 01:08 Saul-Mirone

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 avatar Aug 18 '21 15:08 benrbray

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.

benrbray avatar Aug 23 '21 15:08 benrbray

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

Saul-Mirone avatar Aug 23 '21 16:08 Saul-Mirone