Version 0.2.1 — paste works, and fields fill their row - #12
Merged
Conversation
Setting a custom application menu replaces macOS's default one wholesale, and
on macOS the clipboard shortcuts inside web content are delivered by that menu.
The Edit menu here had Undo, Redo, Select All, Deselect and Clear — and no Cut,
Copy or Paste at all. Cmd+V had nowhere to go, so no text field anywhere in the
app could be pasted into; the API-key box in the Program sheet was simply not
fillable by anyone who keeps their key in a password manager. Right-click was
dead too, because Electron ships no context menu and only the canvas had one.
Each Edit item now does both halves: it asks the web contents to do the
text-editing action, which is a no-op unless something editable has focus, then
sends the canvas command, which the renderer drops while a field has focus. One
key, whichever meaning the focus implies. Two more bugs fell out of the same
root: Cmd+Z in a field undid a brush stroke, and Clear's bare `Delete`
accelerator was swallowed application-wide, so the key stopped deleting
characters everywhere — and fired alongside the renderer's own handler, clearing
twice per press. The renderer owns Delete again; it already ignored text fields.
The prompt and key boxes were narrow for an unrelated reason. `.wide` — the
class meaning "fill the row" — was written `input[type=number].wide`, and an
attribute selector matches the attribute, so it skipped `type=password` and
skipped an <input> written with no type at all. Both fields sat at 195px in a
491px row. They missed the shared text-input rule the same way, which is why
three of them carried inline copies of it; those are gone. body{user-select:none}
was inherited into every field, so you could not select what you had typed —
form controls opt back in.
Verified by driving the real window: a key on the clipboard, focus in the field,
the actual Paste menu item fired, and the value lands. Both regressions are held
by new checks in verify-electron.py and verify-ui.py, each of which fails on the
code as it stood.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GRMJpT8yxY2Q33td1QeP7z
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.
What this changes
Two bugs reported from the Program sheet: an Anthropic API key could not be pasted into the key box, and the prompt field was too small. Neither turned out to be in that sheet.
Paste.
electron/menu.jssets a custom application menu, which replaces macOS's default one wholesale — and on macOS the clipboard shortcuts inside web content are delivered by that menu. Its Edit menu had Undo, Redo, Select All, Deselect and Clear, and no Cut, Copy or Paste at all:So Cmd+V had nowhere to go, in every text field in the app. Right-click offered nothing either, since Electron ships no context menu of its own and only the canvas had a custom one.
Each Edit item now does both halves:
webContents[action]()for the text field (a no-op unless something editable has focus), thensend(id)for the canvas, which the renderer drops while a field has focus. One key, whichever meaning the focus implies, and a menu item that still does what its accelerator does. Cut/Copy/Paste are new items; right-clicking an editable field now gets a menu built from the flags Chromium reports.Two more from the same root:
Cmd+Zin a text field undid a brush stroke instead of a typo.Clearwas bound to a bareDelete. An unmodified key in the menu is swallowed application-wide, so Delete stopped deleting characters in every field — and fired alongside the renderer's own handler, clearing twice per press. The renderer owns it again; it already ignored text fields.Field widths.
.wide— the class meaning "fill the row" — was writteninput[type=number].wide. An attribute selector matches the attribute, so it skippedtype="password"(the key field) and skipped an<input>written with no type at all (the prompt field). Measured in the running app:They missed the shared text-input rule for the same reason, which is why three fields carried duplicated inline styles — removed. And
body{user-select:none}was inherited into every form field, so you could not select what you had just typed; inputs and textareas opt back in.Verification
Drove the real window: put a key on the clipboard, focused
#aiKey, fired the actual Paste menu item — the value lands, and the canvas is untouched by Undo/Select All while a field has focus. No renderer errors.New regression checks in
tools/verify-electron.pyandtools/verify-ui.py, both of which fail on the code as it stood before this change. Full suite: 414 checks, 0 failures.Checklist
npm run verifypassesnative(); the CSS fixes apply to both builds🤖 Generated with Claude Code
https://claude.ai/code/session_01GRMJpT8yxY2Q33td1QeP7z