tiptap-markdown icon indicating copy to clipboard operation
tiptap-markdown copied to clipboard

Long texts making `getMarkdown` to freeze the app

Open rajatkulkarni95 opened this issue 2 years ago • 5 comments

Describe the bug When using tiptap-markdown and a long text (example: https://tiptap.dev/examples/book) the 200k word text here, it freezes the editor, and any update made is also extremely slow.

To Reproduce Steps to reproduce the behavior:

  1. Tiptap Editor with StarterKit and tiptap-markdown extension
  2. Paste the above book text
  3. Takes around 3-4 seconds to render
  4. Scrolling and typing is too slow

Expected behavior However when you use editor.getText() its almost instantaneous.

Screenshots See Video

https://github.com/aguingand/tiptap-markdown/assets/57321156/83ac1695-8ace-4e76-a22b-9af447888a87

rajatkulkarni95 avatar Jul 21 '23 14:07 rajatkulkarni95

Prosemirror markdown seems to cause this. You can try to insert the large content in the example page.

For your information I've fixed parse perfomance in the latest release (v0.8.2), so it should be significantly faster at first load.

aguingand avatar Jul 22 '23 10:07 aguingand

Thanks! I'll give it a try. I feel the issue with slowness is it tries to reserialise the entire 200k word for every onUpdate that causes it.

Tried debouncing it to every 10 secs, but then the sudden lag would come post 10 secs, and would carry on since the next debounces would stagger.

Will check v0.8.2

rajatkulkarni95 avatar Jul 22 '23 10:07 rajatkulkarni95

I think performances improvements can be done to prosemirror-markdown. I'll keep this open for now but it's not in the scope of this package.

aguingand avatar Jul 22 '23 11:07 aguingand

@aguingand Any suggestions on how best to improve conversion to markdown for long texts?

rajatkulkarni95 avatar Sep 11 '23 16:09 rajatkulkarni95

Currently no. You could try to use another HTML to markdown serializer if you don't use complex extensions.

I have no bandwidth to contribute to prosemirror-markdown. I was thinking to switch to another parsing / serializing lib like remark for v1 but there is no ETA.

aguingand avatar Sep 11 '23 16:09 aguingand