Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue on long text #603

Open
BenchBadr opened this issue Dec 8, 2023 · 6 comments
Open

Issue on long text #603

BenchBadr opened this issue Dec 8, 2023 · 6 comments

Comments

@BenchBadr
Copy link

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.

@jaywcjlove
Copy link
Member

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

@BenchBadr
Copy link
Author

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

@jaywcjlove
Copy link
Member

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

components?: {
/** Use div to replace TextArea or re-render TextArea */
textarea?: ITextAreaProps['renderTextarea'];
/**
* Override the default command element
* _`toolbar`_ < _`command[].render`_
*/
toolbar?: ICommand['render'];
/** Custom markdown preview */
preview?: (source: string, state: ContextStore, dispath: React.Dispatch<ContextStore>) => JSX.Element;

@BenchBadr
Copy link
Author

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!

@ilkkakuivanen
Copy link

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

@BenchBadr
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants