Closed waschmittel closed 1 month ago
Hey @waschmittel, glad you're liking flatnotes. The PR looks good, but I don't have access to a Mac to test. If you can confirm you've built and tested it, then I'm happy to merge.
Side note: Out of interest, I had a look at how Mousetrap achieves mod+enter
and it looks like this: /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
. As you say though, your approach will likely suffice.
I've verified that if ((event.ctrlKey || event.metaKey) && event.key == "Enter") {
is the right condition in my browser.
Unfortunately I didn't manage to build it because I couldn't find out how.
I got the dev-container running, but I didn't find out which command to actually run in there because there are no github actions and I also found no other documentation and I'm also not familiar with the python ecosystem.
On Windows, it should save with Win+Enter now, which corresponds to Cmd+Enter on Mac.
Ok, no worries. I've merged the change and deployed a build of develop. If you run using the tag dullage/flatnotes:develop
you should see the change. It'd be good if you could confirm it works.
Thanks, it works :-)
Good to hear. It will be in the next release.
Thanks a lot!
Hi, I just discovered flatnotes and love the idea and execution so far.
Here's a small nitpick: Editing shortcuts work as expected on Mac (cmd+b for bold for example instead of ctrl+b), but cmd+Enter does not.
Using ctrl+Enter on Mac is ugly because it opens the browser's context menu, so I'd prefer if I could save with cmd+Enter.
So here's a little PR
The Editor component seems to detect the OS to bind the correct keys, but I guess just always binding meta as well as ctrl should not be a real problem, because that would only cause an unintended save when someone uses the "Open the Windows Ink Workspace" shortcut, which is win+Enter. That's probably a rather unlikely scenario.
Possible alternative: Mousetrap apparently includes OS detection according to https://craig.is/killing/mice#api.bind.combo so
Mousetrap.bind("mod+enter", ...
should work perfectly. But I'm not sure how to use it because I assume there's a good reason why you use keydownHandler for the save shortcut instead of Mousetrap.Also, https://github.com/dullage/flatnotes/wiki/Keyboard-Shortcuts should be updated for the Mac shortcuts.