The editor freezes when inserting text with base64

Steps to reproduce:

  1. Open the editor on the website.

  2. Select some text and format it as code.

  3. Insert the provided markup between the lines. gist:760ca3c395abbbacaf98b55c750ae0d3 · GitHub

  4. Start typing text below.

Result:

The editor freezes (Performance panel shows: Warning: Long task and others on keydown).

Expected behavior:

No freezes.

I don’t see it freeze entirely when I try it, but typing does become incredibly slow (up to a second of latency). I’m pretty sure this the browser’s editing and layout code falling apart — if I paste that into a plain contenteditable element, both Chrome and Firefox become similarly slow. Do you have a specific reason to suspect the performance issue is in ProseMirror?

1 Like

Honestly, I hadn’t considered that this might be an issue with any editable element. This assumption was based on profiling my project during editing, where I observed long execution times related to diff. I’ve attached a screenshot of the profiling results below.

After your comment, I tested the behavior in a textarea here: MDN textarea example, as well as in a comment field here: Gist example.

The issue with slow typing persists in both cases, so it does seem like this isn’t a problem specific to ProseMirror. Thank you for pointing that out!

1 Like