Skip to content

Conversation

@akulistus
Copy link

Problem:
Pasting HTML-embedded code into the editor causes incorrect behavior: the HTMLPreElement is rendered as a string instead of the actual code.

Issue:
codex-team/editor.js#2923

Solution:
Replace the generic PasteEvent with the more specific HTMLPasteEvent to correctly access the innerHTML property.

@akulistus akulistus requested a review from neSpecc December 16, 2025 21:33
src/index.ts Outdated
code: content || '',
};
}
public onPaste(event: HTMLPasteEvent): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the onPaste() method called in three cases based on pasteConfig :

  1. when tool matched by tag
  2. tool matched by file
  3. tool matched by pattern

So this function should support all three cases. Right now you're supporting only tag-case.

See documentation for details:
https://editorjs.io/tools-api/#onpaste

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants