Add "Paste from clipboard" button to page and markup sandboxes#1465
Draft
Add "Paste from clipboard" button to page and markup sandboxes#1465
Conversation
Agent-Logs-Url: https://github.com/inducer/relate/sessions/9d96bef9-b5ed-4128-ae41-dad69ddec2a0 Co-authored-by: inducer <352067+inducer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add paste button to page and markup sandboxes
Add "Paste from clipboard" button to page and markup sandboxes
Apr 2, 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.
Both sandbox editors lacked a way to bulk-replace the editor content from the clipboard and immediately preview the result.
Changes
sandbox-markup.html,sandbox-page.html): Inject a "Paste from clipboard" button next to the Preview button. On click, reads the clipboard vianavigator.clipboard.readText(), replaces the full CodeMirror 6 editor content, then triggers Preview. Button is only added to the DOM when the Clipboard API is available (secure context / HTTPS).sandbox-page.html(bugfix): The existing force-focus script was using the dead CodeMirror 5 API (div.CodeMirror/this.CodeMirror.focus()). Updated to use the CM6 API (EditorView.findFromDOM) consistent with the rest of the codebase.