Use unsanitized HTML in demo clipboard read#3355
Merged
Merged
Conversation
Pass `unsanitized: ['text/html']` to `navigator.clipboard.read()` in the demo Paste button and PastePane so the read HTML is not sanitized by the browser. A local `ClipboardWithUnsanitized` interface is added since the option is not yet in the standard TypeScript Clipboard typings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the demo clipboard-reading flows to request unsanitized text/html from navigator.clipboard.read() so the demo receives the original HTML payload (instead of browser-sanitized HTML), adding a local typing shim to satisfy current TypeScript DOM typings.
Changes:
- Pass
{ unsanitized: ['text/html'] }tonavigator.clipboard.read()in the demo Paste button and API Playground Paste pane. - Add a local
ClipboardWithUnsanitizedinterface to type the experimentalunsanitizedoption.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| demo/scripts/controlsV2/sidePane/apiPlayground/paste/PastePane.tsx | Adds a local clipboard typing shim and requests unsanitized HTML when extracting clipboard data in the Paste pane. |
| demo/scripts/controlsV2/demoButtons/pasteButton.ts | Adds the same typing shim and requests unsanitized HTML for the ribbon Paste button’s programmatic clipboard read. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+18
to
+20
| interface ClipboardWithUnsanitized { | ||
| read(options?: { unsanitized?: string[] }): Promise<ClipboardItems>; | ||
| } |
Comment on lines
+5
to
+7
| interface ClipboardWithUnsanitized { | ||
| read(options?: { unsanitized?: string[] }): Promise<ClipboardItems>; | ||
| } |
| if (clipboard && clipboard.read) { | ||
| try { | ||
| const clipboardItems = await clipboard.read(); | ||
| const clipboardItems = await clipboard.read({ unsanitized: ['text/html'] }); |
| if (clipboard && clipboard.read) { | ||
| try { | ||
| const clipboardItems = await clipboard.read(); | ||
| const clipboardItems = await clipboard.read({ unsanitized: ['text/html'] }); |
BryanValverdeU
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{ unsanitized: ['text/html'] }tonavigator.clipboard.read()in the demo Paste button and the PastePane API playground so the browser does not sanitize the HTML before we receive it.ClipboardWithUnsanitizedinterface as a typing shim, since theunsanitizedoption is not yet present in the standard TypeScript Clipboard typings.Test plan
yarn eslint,yarn test:fast,yarn bpass.🤖 Generated with Claude Code