Skip to content

[stable35] fix(image): keep data: URI images on markdown round-trip - #9290

Merged
mejo- merged 2 commits into
stable35from
backport/9159/stable35
Sep 28, 2026
Merged

mejo- merged 2 commits into
stable35from
backport/9159/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Sep 28, 2026

Copy link
Copy Markdown

Backport of PR #9159

Markdown files can legitimately contain base64 images. Both image parse
rules excluded img[src^=data:] because the TipTap allowBase64 option
defaults to false, so those images never made it into the document and
were silently dropped from the file on the next save (#9108).

Enable allowBase64 on the Image and ImageInline extensions: the file
content is the user's own, and the editor is expected to preserve it,
not to filter it. Regression test covers both the block (figure) and
the inline image path.

Signed-off-by: Guillaume Flambard <g.flambard@gmail.com>
allowBase64 flips the parse selector to accept any data: URI, with no mime
filtering. The CSP already refuses to load a data: script, object or frame, and
the src only ever reaches an <img>, so a non image payload cannot execute. This
narrows the parse rules anyway, so a malformed mime type never becomes a node in
the first place rather than relying on those two properties.

The syntax then stays literal text, which keeps the user's characters intact and
preserves the intent of #9108: nothing is dropped on save, it is simply not
promoted to an image whose src could never render.

Assisted-by: claude-code:claude-opus-5
Signed-off-by: Guillaume Flambard <g.flambard@gmail.com>
@mejo-
mejo- merged commit ff8ceea into stable35 Sep 28, 2026
75 of 77 checks passed
@mejo-
mejo- deleted the backport/9159/stable35 branch September 28, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants