Skip to content

Pasting code block renders [object HTMLPreElement] instead of code content #3010

Description

@prathmeshyelne

When pasting a code block into the editor, the content is inserted but rendered incorrectly as:

[object HTMLPreElement]

instead of displaying the actual code.

Steps to Reproduce

  1. Open the editor.
  2. Copy the following code:
import EditorJS from '@editorjs/editorjs'

const editor = new EditorJS({
  tools: {
    // ... your tools
  }
})
  1. Paste the code into the editor.
  2. Observe the rendered result.

Actual Result

The editor displays:

[object HTMLPreElement]

instead of the pasted code.

Expected Result

The editor should preserve and display the pasted code content:

import EditorJS from '@editorjs/editorjs'

const editor = new EditorJS({
  tools: {
    // ... your tools
  }
})

or create a proper Code block containing the pasted content.

Environment

  • Editor.js Version: v2.31.6
  • Browser: Chrome
  • OS: macOS

Screenshot :

Image

Issue Video :

Screen.Recording.2026-06-13.at.8.35.44.PM.mov

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

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions