Skip to content

fix: added transmitter for ctrl + s#26

Merged
scolastico merged 3 commits intomainfrom
fix/ctrl-s-command
Feb 1, 2026
Merged

fix: added transmitter for ctrl + s#26
scolastico merged 3 commits intomainfrom
fix/ctrl-s-command

Conversation

@scolastico
Copy link
Member

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

  • I have tested my changes locally
  • I have updated the documentation if needed
  • This PR follows the project's coding style

Additional Notes

n/a

@github-actions github-actions bot added the src label Feb 1, 2026
@github-actions
Copy link

github-actions bot commented Feb 1, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://beta-draw.not-th.re/pr-preview/pr-26/

Built to branch html-previews at 2026-02-01 10:54 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/save message 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 restrict targetOrigin to 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.

scolastico and others added 2 commits February 1, 2026 11:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@scolastico scolastico merged commit 1cdd7ae into main Feb 1, 2026
2 checks passed
@scolastico scolastico deleted the fix/ctrl-s-command branch February 1, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ctrl + s does not work if excalidraw is open

2 participants