Skip to content

Open a .proto from disk, on both schema boxes - #10

Merged
mgravell merged 1 commit into
mainfrom
proto-file-pickers
Aug 25, 2026
Merged

mgravell merged 1 commit into
mainfrom
proto-file-pickers

Conversation

@mgravell

Copy link
Copy Markdown
Member

Both .proto boxes now accept a file from disk, so arriving with a real schema no longer means a detour through an editor and the clipboard.

  • Schema → code: a picker next to Load a sample….
  • Decode: a picker inside the optional schema panel, alongside the payload-file picker that was already there.

The file is read in the browser with File.text(), exactly as the decoder already reads a raw payload file. Opening one sends nothing anywhere, and what happens on Generate is unchanged — the privacy badge still tells the whole story.

The button it replaces

Copy from Schema → code is gone. It copied the text of one on-screen editable box into another on-screen editable box, which anyone can already do, and the label read like a copy-to-clipboard action rather than a transfer. Its slot is better spent on something you cannot do by hand. schemaViewText() existed only to serve it and goes with it.

Notes

  • Picking the same file twice reloads it — the input is cleared on change, so a repeat pick still fires.
  • The schema is still parsed under the fixed internal name (my.proto / payload.proto); the opened file's own name is not adopted. Worth considering separately, since it would change generated output names.
  • Single file only. A .proto with local imports still will not resolve — that needs multi-file input, which is its own piece of work.

Typecheck clean, 27 tests pass, production build fine. Not verified visually in a browser.

Pasting a schema is fine for a snippet, but anyone arriving with a real .proto
on disk had to go via an editor and the clipboard first. Both boxes now take a
file directly: next to the sample picker on schema-to-code, and inside the
optional schema panel on the decoder.

The file is read in the browser, the same way the decoder already reads a raw
payload file, so opening one sends nothing anywhere; what happens on generate
is unchanged, and the privacy badge still says so.

This takes the decoder's "Copy from Schema -> code" button for the slot. It
moved text between two boxes that are both editable and both on screen, which
is a thing anyone can already do, and it read as a copy-to-clipboard action
besides.
@mgravell
mgravell merged commit 85d14a5 into main Aug 25, 2026
2 checks passed
@mgravell
mgravell deleted the proto-file-pickers branch August 25, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant