fix(super-editor): handle SuperDoc context-menu paste (SD-2934)#3131
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e68021d97
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
0e68021 to
d083235
Compare
d083235 to
a916039
Compare
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.43 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0-next.87 |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.85 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.30.0-next.44 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.8.0-next.61 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.46 |
Summary
Fixes SD-2934. Related intake: IT-1003.
Context-menu paste now mirrors native paste for SuperDoc-origin clipboard HTML. It extracts embedded slice, media, and body-section data from the original HTML, imports/remaps referenced image media, strips hidden SuperDoc metadata before HTML fallback, and keeps SuperDoc-origin HTML out of the DOCX converter path.
Root cause
SuperDoc copy embeds hidden slice data in
text/htmlso structured content can round-trip. Native paste consumes or strips that hidden data, but context-menu Paste reads clipboard HTML through the async clipboard API and previously treated the full HTML as generic browser HTML. That allowed the hidden base64 slice payload to be parsed as document text. The async clipboard path also cannot read SuperDoc's custom media MIME, so image media must ride along in the HTML payload too.Validation
pnpm exec vitest run --root ./packages/super-editor src/editors/v1/core/helpers/superdocClipboardSlice.test.jspnpm exec vitest run --root ./packages/super-editor src/editors/v1/core/InputRule.test.jspnpm exec vitest run --root ./packages/super-editor src/editors/v1/components/context-menu/tests/menuItems.test.js src/editors/v1/components/context-menu/menuItems.test.jspnpm --filter superdoc build:devpnpm --dir tests/behavior exec playwright test tests/slash-menu/paste.spec.ts --project=chromiumgit diff --check