Merged
Conversation
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Ctrl/Cmd+S keyboard shortcut to transmit a not3/draw/save message to the embedding parent page so it can persist the current Excalidraw scene.
Changes:
- Add global keydown listener to intercept Ctrl/Cmd+S and post a
not3/draw/savemessage containing the latest elements. - Track latest Excalidraw elements via a ref updated from
onChange. - Adjust Vite dev server host allowance via
server.allowedHosts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| vite.config.ts | Updates dev server host configuration (allowedHosts). |
| src/App.tsx | Adds Ctrl/Cmd+S save transmitter and keeps latest elements in a ref for posting to the parent page. |
Comments suppressed due to low confidence (1)
src/App.tsx:58
- This
postMessage(..., "*")sends the live scene contents to any parent origin. Please restricttargetOriginto the expected parent origin (same fix as for the save message) to avoid data exposure when embedded by an untrusted site.
window.parent.postMessage({
type: "not3/draw/change",
payload: excalidrawElements,
}, "*");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Description
Provides a not3/draw/save event to tell the parent page to save the file.
Related Issue
Closes not-three/main#19
Screenshots (if applicable)
n/a
Checklist
Additional Notes
n/a