react-md-editor icon indicating copy to clipboard operation
react-md-editor copied to clipboard

Issue on long text

Open BenchBadr opened this issue 2 years ago • 6 comments

Hello, firstly I want to thank all the contributors of this project because of it's high quality. I would like to draw your attention about an issue :

https://arltools.xyz/create

When the content is too long, (empirical) mostly when it exceeds 30,000 chars, it gets really slower to type, each character take 0.5 to 1 sec to be added which can be really disturbing.

I thought of making the useState text value update being done separately from the typing action but this is simply impossible using react-md-editor. The whole variable is rewritten for each added character, therefore, how can we make this work separately ? Like, chars would be added instantly when typed but may be slower to be displayed on preview.

Thank you for your answers.

BenchBadr avatar Dec 08 '23 04:12 BenchBadr

@BenchBadr This is caused by code highlighting, which is re-rendered every time without lazy loading.

jaywcjlove avatar Dec 08 '23 06:12 jaywcjlove

I'm sorry, I can't find it by myself, how can I enable the lazy loading ? (And tysm for the info)

BenchBadr avatar Dec 08 '23 08:12 BenchBadr

@BenchBadr Oh, there is currently no support, you need to implement it yourself

https://github.com/uiwjs/react-md-editor/blob/dabf155b82253488573843e6963337e65fa0a1e5/core/src/Types.ts#L97-L106

jaywcjlove avatar Dec 08 '23 08:12 jaywcjlove

I see, I'll need to have my own copy of everything. Not that bad actually because I'll be able to do more stuff. Thank you!

BenchBadr avatar Dec 08 '23 12:12 BenchBadr

@BenchBadr did that help in your case? I have a similar problem and custom preview does not help in my case.

ilkkakuivanen avatar Jan 14 '24 10:01 ilkkakuivanen

Honestly I didn't dig this that much since then. I never edited a npm package before, if someone has a tutorial or something please send it to me. I will be happy to inform you here once this will be done.

BenchBadr avatar Jan 15 '24 17:01 BenchBadr