diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-05-05 21:09:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-05 13:09:41 +0000 |
commit | 5c236bd4c024dbe4a71516b10aa812893651983a (patch) | |
tree | 336439073217dd199433f0ef366ebaf114c608c8 /web_src/js/features/comp | |
parent | ecd1d96f494d2400f7659165ff9376354edda395 (diff) | |
download | gitea-5c236bd4c024dbe4a71516b10aa812893651983a.tar.gz gitea-5c236bd4c024dbe4a71516b10aa812893651983a.zip |
Fix issue/PR title edit (#30858)
1. "enter" doesn't work (I think it is the last enter support for #14843)
2. if a branch name contains something like `&`, then the branch selector doesn't update
Diffstat (limited to 'web_src/js/features/comp')
-rw-r--r-- | web_src/js/features/comp/QuickSubmit.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/web_src/js/features/comp/QuickSubmit.js b/web_src/js/features/comp/QuickSubmit.js index 6bd5f6644d..3ff29f4fac 100644 --- a/web_src/js/features/comp/QuickSubmit.js +++ b/web_src/js/features/comp/QuickSubmit.js @@ -3,16 +3,17 @@ export function handleGlobalEnterQuickSubmit(target) { if (form) { if (!form.checkValidity()) { form.reportValidity(); - return; + } else { + // here use the event to trigger the submit event (instead of calling `submit()` method directly) + // otherwise the `areYouSure` handler won't be executed, then there will be an annoying "confirm to leave" dialog + form.dispatchEvent(new SubmitEvent('submit', {bubbles: true, cancelable: true})); } - - // here use the event to trigger the submit event (instead of calling `submit()` method directly) - // otherwise the `areYouSure` handler won't be executed, then there will be an annoying "confirm to leave" dialog - form.dispatchEvent(new SubmitEvent('submit', {bubbles: true, cancelable: true})); - return; + return true; } form = target.closest('.ui.form'); if (form) { form.querySelector('.ui.primary.button')?.click(); + return true; } + return false; } |