Skip to content

Pasting from Google Docs nests images inside heading/paragraph blocks. #79541

Open

Description

@mecskyverse

Description

When copy/pasting content from Google Docs into the editor, images are sometimes placed inside a heading or paragraph block instead of becoming their own Image block.

The image is stored as raw <img> markup with a temporary blob: URL inside the text block, for example:

<!-- wp:paragraph -->
<p><img src="blob:http://localhost:8888/371c53b0-f8ab-4fe0-b838-248ddd01de9a" width="624" height="240">asdf</p>
<!-- /wp:paragraph -->

The image looks correct in the editor, and it even displays correctly on the published post in the same browser window — so the editor never signals that anything is wrong.

The problem: blob: URLs are temporary references that only exist in the memory of the browser that created them. Because the image lands inside a text block (heading/paragraph) rather than an Image block, it is never uploaded to the media library — only Image blocks run the blob-to-upload flow. The temporary blob: URL is therefore serialized verbatim into the saved post.

Result: the author sees the image fine, but when the post is opened in an incognito window or any other browser, the image is broken/invisible (the blob: URL resolves to nothing).

Technical detail

This looks like the same underlying issue as #21516.

The "Paragraph with image → Transform to Image" work in PR #68796 can help — but only when the editor/author is aware the image is misplaced and manually transforms it. In this case the author has no signal: the image renders correctly in the editor and on the published post (in their own browser), so they might never know to transform it.

Step-by-step reproduction instructions

This happens in two Google Docs scenarios:

  1. When text (normal paragraph text or a heading) immediately follows an image with no blank line/space between them.

  2. When using a heading or normal text, then pressing Shift+Enter, and then adding an image.
    In both cases the image gets merged into the heading/paragraph during copy/paste.

To reproduce:

  1. Open the Sample Google Doc. It contains sample text with images arranged in the two scenarios above; you can copy/paste its content to replicate the bug.

  2. Select all the content in the Google Doc and copy it.

  3. In a new post in the editor, paste the content.

  4. Notice the images are nested inside heading/paragraph blocks (switch to the Code editor view to confirm the <img> is inside <h2>/<p> with a blob: src).

  5. Publish the post.

  6. View the published post in the same browser → the image displays.

  7. Open the same published post in an incognito window or a different browser → the image is broken/missing.

Screenshots, screen recording, code snippet

Demo.Image.Copy.Paste.mov

Environment info

WordPress version: 7.0
Gutenberg version: 23.4.0
Browser(s): Brave
OS: macOS
Source of pasted content: Google Docs

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. Mustafabharmal commented on Jul 5, 2026

    @Mustafabharmal
    Contributor

    After investigating, it looks like images pasted from Google Docs can remain inside paragraphs or headings instead of being extracted into standalone Image blocks. Because of that, images using temporary blob: or data: URLs don't enter the normal upload flow.

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions