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

renderFromHTML is not awaiting clear() method #2575

Open
mrigne opened this issue Dec 27, 2023 · 1 comment
Open

renderFromHTML is not awaiting clear() method #2575

mrigne opened this issue Dec 27, 2023 · 1 comment
Labels

Comments

@mrigne
Copy link

mrigne commented Dec 27, 2023

renderFromHTML is not awaiting clear() method.
So rendering is started during async clear execution that can cause incorrect results.

Steps to reproduce:
await this.api.renderFromHTML(<some_big_html>);

Expected behavior:
Internal logic should await clear() method before star rendering blocks

Device, Browser, OS: any

Editor.js version: 2.28.2

@1sd15
Copy link

1sd15 commented Feb 1, 2024

Hey @mrigne,

Does this fix the issue for you in the following situation ->

const editor = new EditorJS( . . . )
await editor.isReady
await editor.blocks.renderFromHTML( . . . )
const saved = await editor.save()
console.log(saved)

I've been testing this one locally and I believe the issue stems further than this function.
The above renderFromHTML goes via the processText method to BlockManager's paste.
Inside the BlockManager the window.requestIdleCallback method is ran which I found executes after my save is called

image

Thanks!

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

No branches or pull requests

2 participants