Commit Graph

2149 Commits (main)

Author SHA1 Message Date
Isaiah Odhner 7e4ebb7143 Focus first radio option by default in Flip/Rotate dialog 2023-02-14 09:31:56 -05:00
Isaiah Odhner 7db534a49b Make $Button safely treat text as plain again (not HTML)
I'm not terribly worried about XSS here, but it is a good practice to
avoid implicit HTML parsing. Mainly, though, I really don't want to
go through every button in my app to make sure the formatting is okay,
so I'm changing this back to treating text as text, and handling the one
place where I need HTML specially, by passing an Element instead.
2023-02-14 09:31:56 -05:00
Isaiah Odhner 2bd020711c Allow modifier-less shortcuts in Attributes dialog 2023-02-14 09:31:56 -05:00
Isaiah Odhner 5ad32de21f Add keyboard shortcuts to image attributes dialog
- DANGER: I made $Button treat the label parameter as HTML.
  This is terrible! What am I doing?
- Note: MS Paint actually supports modifier-less shortcuts when no
  textual input is focused. I should do what I did for the Custom Zoom
  window here too, but I haven't yet.
2023-02-14 09:31:56 -05:00
Isaiah Odhner 434e975ef4 Allow modifier-less digit shortcuts while custom zoom input not focused
MS Paint supports pressing 1, 2, 4, 6, or 8 with or without a modifier,
to select the corresponding zoom levels, but it doesn't have a textual
numeric input field to contend with.

I'm handling this by conditionally enabling the digit shortcuts without
a modifier, and always enabling the digit shortcuts with Alt.
2023-02-14 09:01:20 -05:00
Isaiah Odhner e274a1ddfb Add keyboard shortcuts for zoom levels in Custom Zoom dialog
This matches the original MS Paint dialog. Thankfully both Chrome and
Firefox allow overriding the shortcut to switch tabs with Alt+1-9.
2023-02-14 09:01:20 -05:00
Isaiah Odhner a8bd0499fa Update "Current zoom" if magnification changes while dialog is open
This can't happen in the original MS Paint, but it's fine, I can just
handle it. I didn't even have to type half of this code.
I love AI autocomplete. I especially love turning TODO comments into
comments that guide the AI with natural language.
2023-02-14 09:01:20 -05:00
Isaiah Odhner a3a1d83252 Fix selecting custom zoom field when clicking label 2023-02-14 09:01:20 -05:00
Isaiah Odhner 861ae2a7e8 Prevent strange behavior when clicking on custom zoom field
The field itself should be focused when clicking on the field directly,
and the caret should be placed where you click.

You know, I thought of this solution quickly, and GitHub Copilot
autocompleted it, but I'm having trouble pinning down what the problem
actually was.

Why does focusing this input programmatically lead to the input not
being focused ultimately after the click? At any rate, letting it focus
naturally works, and is clearly superior.

Note: This buggy behavior was showing up in Firefox.
2023-02-14 09:01:20 -05:00
Isaiah Odhner 60c8a0f7a4 Select custom zoom radio when typing in custom zoom field
This prevents a confusing scenario where you tab to the field rather
than clicking on it, type a custom zoom value, and hit Enter/OK, and
it's not used because the radio for a standard zoom value is still
selected.
2023-02-14 03:06:00 -05:00
Isaiah Odhner 26524b188a Prevent form submit event instead of button click event
Neither are generally effective since the submit event doesn't fire
due to the form being removed from the DOM when the window closes.
But this is cleaner/safer, more general, as a safety measure.
2023-02-14 02:38:15 -05:00
Isaiah Odhner 5bf1b59e94 Start typing into custom zoom level field even with a decimal point 2023-02-13 23:11:20 -05:00
Isaiah Odhner 1aa91aadad Start typing into custom zoom level text field if its radio is focused 2023-02-13 23:07:35 -05:00
Isaiah Odhner 06a5fe2c87 Handle initial focus for default button highlighting 2023-02-13 20:29:18 -05:00
Isaiah Odhner fb7f31064d Focus current zoom level's associated control in Custom Zoom 2023-02-13 20:29:18 -05:00
Isaiah Odhner 500d9eb052 Focus first color cell, not OK button, as fallback in Edit Colors 2023-02-13 20:29:08 -05:00
Isaiah Odhner 0e0062577d Tweak submit button determination
- Merge the two cases of [type="submit"] and plain buttons,
  matching the HTML semantics that plain buttons are literally submit
  buttons (at least if they're in a form), and not lower priority
  than buttons explicitly marked with type="submit".
- Never consider button[type="button"] a submit button.
  A button with type="button" should only be highlighted if focused.
2023-02-13 20:27:03 -05:00
Isaiah Odhner d4018c112a Handle pressing Enter in Edit Colors dialog 2023-02-13 20:27:03 -05:00
Isaiah Odhner 6276bd588c Highlight focused button or submit button in dialog windows
- Show the button that will be activated if you hit Enter with a special
  style. This is the focused button, if there is one, or else the submit
  button (usually the "OK" button.)
- Mark buttons with type="submit" or type="button". This may or may not
  prevent bad implicit Enter handling in some dialog(s).
- TODO: handle Enter in Edit Colors dialog; test everything
2023-02-13 20:27:03 -05:00
Isaiah Odhner e0ae75bd80 Focus width field by default in image attributes dialog
Fixes https://github.com/1j01/jspaint/issues/313
2023-02-13 03:31:23 -05:00
Isaiah Odhner 8e37f20514 Fix dissociated comment (and move another defensively)
I think VS Code's formatter has gotten smarter, but I'll stick to
line-before comments for now, instead of end-of-line comments.
2023-01-13 21:09:29 -05:00
Isaiah Odhner 2a3ae1c0eb Patch UPNG.js to fix bad global check
Fixes #272
2023-01-13 21:00:35 -05:00
Isaiah Odhner c05cfde5c6 Fix minor formatting issues 2022-08-02 11:16:43 -04:00
Isaiah Odhner 55e9592726 Fully document set_theme and set_language
I guess I'm including these in the API...
2022-08-02 11:16:34 -04:00
Isaiah Odhner 4f857e5a31 Link other sections 2022-08-02 11:16:34 -04:00
Isaiah Odhner 1913a56cb1 Link to individual system hook documentation 2022-08-02 10:30:49 -04:00
Isaiah Odhner 2dd66c36d3 Document individual system hooks and functions 2022-08-02 09:53:10 -04:00
Isaiah Odhner 76031360ea Fix variable reference in new docs 2022-08-02 08:28:13 -04:00
Isaiah Odhner 9b3310d26f Add more information about hooks used by commands 2022-08-02 07:57:58 -04:00
Isaiah Odhner b66c5f630c Flesh out deployment notes 2022-08-02 07:57:58 -04:00
Isaiah Odhner 435414d2b2 WIP changelog 2022-08-02 07:57:58 -04:00
Isaiah Odhner 65266a18ce Note inclusion in the API 2022-08-02 07:57:58 -04:00
Isaiah Odhner 548fb6197a WIP deployment notes 2022-08-02 07:53:08 -04:00
Isaiah Odhner 84aa547b8f WIP docs 2022-08-02 07:53:08 -04:00
Isaiah Odhner dd25a99bea Clarify pointing iframe to local copy of jspaint 2022-08-02 02:58:43 -04:00
Isaiah Odhner 831662cf48 Add to docs about file loading/saving 2022-08-02 02:58:43 -04:00
Isaiah Odhner 602ad53e06 Reality check 2022-08-02 00:09:31 -04:00
Isaiah Odhner aac1b972f6 Start writing real documentation for embedding jspaint 2022-08-01 23:38:43 -04:00
Isaiah Odhner 0d7d3aee36 Add deployment and embedding sections
I should just go ahead and document the API at this point...
2022-08-01 21:57:13 -04:00
Isaiah Odhner ccafef3445 Check for and fix problems in news articles
- Add missing target="_blank" attributes so links open externally
- Fix date format consistency
- Automate checking for issues
2022-08-01 17:52:29 -04:00
Isaiah Odhner ecc19554c9 Update ESLint 2022-08-01 15:18:17 -04:00
Isaiah Odhner ea5430fe78 Update Electron 2022-08-01 15:05:00 -04:00
Isaiah Odhner f12eba89d4 Update Electron Forge 2022-08-01 14:58:10 -04:00
Isaiah Odhner dfa12af118
Create FUNDING.yml 2022-07-31 17:09:18 -04:00
Isaiah Odhner 7a2bf5f4f4 Add news update: JS Paint is now Open Source! 2022-07-28 15:48:17 -04:00
Isaiah Odhner 82a6cb22b9 Add MIT License 2022-07-28 15:11:17 -04:00
Isaiah Odhner 07b84b6a31 Rephrase template links feature description 2022-06-08 10:39:55 -04:00
Isaiah Odhner ab9e5e26f7 Rewrite blurb 2022-04-11 20:44:19 -04:00
Isaiah Odhner 85cffff321 Handle "exit menu" / "get outta here" 2022-02-25 11:26:26 -05:00
Isaiah Odhner 88ce57dff5 Fix activating menus with speech 2022-02-25 11:06:30 -05:00