Skip to content

feat(paste): return a Promise from onPaste - #98

Merged
neSpecc merged 1 commit into
editor-js:masterfrom
anshurajbisoyi98-ctrl:fix-onpaste-promise
Nov 27, 2026
Merged

neSpecc merged 1 commit into
editor-js:masterfrom
anshurajbisoyi98-ctrl:fix-onpaste-promise

Conversation

@anshurajbisoyi98-ctrl

@anshurajbisoyi98-ctrl anshurajbisoyi98-ctrl commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Companion to codex-team/editor.js#3035.

Editor.js will wait for a Promise returned from onPaste before placing the caret after paste. Paragraph sets the pasted HTML in a requestAnimationFrame, so onPaste now returns a Promise that resolves right after innerHTML is set. Older Editor.js versions ignore the return value, so nothing changes for them.

I checked it by linking this build into editor.js on the branch of that PR: pasting First block\n\nSecond block and typing now gives Second blockX instead of XSecond block.

I left dist alone, assuming it gets rebuilt on release.

@neSpecc neSpecc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! The change looks good. This repo has no automatic version bump. Please bump it to 2.11.8 in this PR.

Then, update @editor.js/paragraph version in Editor Core package.json to 2.11.8 in codex-team/editor.js#3035

Resolve it after the pasted content is set in the animation frame, so
Editor.js can place the caret once the text is in the block.

Signed-off-by: anshurajbisoyi98-ctrl <anshurajbisoyi98@gmail.com>
@anshurajbisoyi98-ctrl

Copy link
Copy Markdown
Contributor Author

Bumped to 2.11.8 here and updated @editorjs/paragraph to ^2.11.8 in codex-team/editor.js#3035. I left yarn.lock there as is until 2.11.8 is published.

@neSpecc
neSpecc merged commit 9b3fe19 into editor-js:master Nov 27, 2026
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