This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
Andrei Prigorshnev cf1e8b2764
FEATURE: Accept the flag modal on CTRL + ENTER and CMD + ENTER (#13497)
We want to submit the flag modal on pressing CTRL + ENTER and CMD + ENTER.

Here's how our modals work:

Every modal can be dismissed by pressing ESC. This behaviour can be disabled for a specific modal if we need to.
Every modal can be submitted by pressing ENTER if the cursor wasn't on a text area or a form at the moment of pressing.
Now, the flag modal is actually a one big form and pressing ENTER doesn't submit it. I've added submitting by CTRL+ENTER but at first it was interfering with the basic modal submitting by ENTER. It's a pretty tricky thing to fix because we use the keyup event for submitting by ENTER and we need to use the keydown event for submitting with modifiers (because submitting by CMD+ENTER on Macs doesn't work with keyup).

Eventually, I fixed the problem just by adding a possibility to disable default submitting on ENTER (in the same way as we already have the possibility of disabling dismissing on ESC). Then I disabled default submitting for the flag form and implemented submitting by CTRL+ENTER and CMD+ENTER. This way everything is simple and robust. I did it only for the flag modal but it'll be easy and safe to add the same behaviour to another modal.
2021-06-24 14:13:38 +04:00
..
app FEATURE: Accept the flag modal on CTRL + ENTER and CMD + ENTER (#13497) 2021-06-24 14:13:38 +04:00
config FIX: ember-cli proxy subfolder fix (#12996) 2021-05-10 10:02:33 -07:00
lib Code review comments. 2021-06-21 11:06:58 +08:00
public/assets/scripts REFACTOR: Use a <script src> tag to start the app (#12401) 2021-03-16 09:36:11 -04:00
tests FEATURE: Accept the flag modal on CTRL + ENTER and CMD + ENTER (#13497) 2021-06-24 14:13:38 +04:00
.ember-cli REFACTOR: Sync up master with changes for Ember-CLI (#11671) 2021-01-12 10:13:21 -05:00
ember-cli-build.js FEATURE: Optimize images before upload (#13432) 2021-06-23 12:31:12 -03:00
package.json DEV: Add peer dependencies (#13132) 2021-05-25 18:39:40 +02:00
testem.js FIX: Use the no-sandbox flag when running Ember CLI tests. (#12951) 2021-05-05 14:02:26 -03:00