You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

QuickSubmit.js 665B

12345678910111213141516171819
  1. export function handleGlobalEnterQuickSubmit(target) {
  2. let form = target.closest('form');
  3. if (form) {
  4. if (!form.checkValidity()) {
  5. form.reportValidity();
  6. } else {
  7. // here use the event to trigger the submit event (instead of calling `submit()` method directly)
  8. // otherwise the `areYouSure` handler won't be executed, then there will be an annoying "confirm to leave" dialog
  9. form.dispatchEvent(new SubmitEvent('submit', {bubbles: true, cancelable: true}));
  10. }
  11. return true;
  12. }
  13. form = target.closest('.ui.form');
  14. if (form) {
  15. form.querySelector('.ui.primary.button')?.click();
  16. return true;
  17. }
  18. return false;
  19. }