Skip to content

Slow rendering of editor blocks due to offsetWidth #3022

Description

@johanwestling

I'm working on a project with EditorJS that renders various lengths of legal documents. In the most massive documents (they are long and a metric ton of DOM-nodes) I've noticed that rendering of the page becomes very slow. Running a Devtools performance recording points towards a EditorJS internal make-method that does the following:

this.nodes.holder.offsetWidth < this.contentRect.width && this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow)

Basically it seems to checks if the holder elements width is smaller than the block width and applies the codex-editor--narrow CSS if it is?

Here is a screenshot from the Devtools performance recording:
Image

And with a local override in Devtools without the this.nodes.holder.offsetWidth < this.contentRect.width && part:
Image

Goes from +60 second load time to less than 20 seconds.

Any ideas how to solve this? To me this check would be better to conduct only when all the initial editor blocks has rendered?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions