Skip to content

Commit d8d4b33

Browse files
authored
Remove jQuery from the "quick submit" handler (#29200)
- Switched to plain JavaScript - Tested the quick submit functionality and it works as before # Demo using JavaScript without jQuery ![action](https://github.com/go-gitea/gitea/assets/20454870/abbd6c49-ad0f-4f95-b4ba-e969b85a46e8) --------- Signed-off-by: Yarden Shoham <[email protected]>
1 parent 2d8756a commit d8d4b33

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

web_src/js/features/comp/QuickSubmit.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import $ from 'jquery';
2-
31
export function handleGlobalEnterQuickSubmit(target) {
42
const form = target.closest('form');
53
if (form) {
@@ -8,14 +6,9 @@ export function handleGlobalEnterQuickSubmit(target) {
86
return;
97
}
108

11-
if (form.classList.contains('form-fetch-action')) {
12-
form.dispatchEvent(new SubmitEvent('submit', {bubbles: true, cancelable: true}));
13-
return;
14-
}
15-
169
// here use the event to trigger the submit event (instead of calling `submit()` method directly)
1710
// otherwise the `areYouSure` handler won't be executed, then there will be an annoying "confirm to leave" dialog
18-
$(form).trigger('submit');
11+
form.dispatchEvent(new SubmitEvent('submit', {bubbles: true, cancelable: true}));
1912
} else {
2013
// if no form, then the editor is for an AJAX request, dispatch an event to the target, let the target's event handler to do the AJAX request.
2114
// the 'ce-' prefix means this is a CustomEvent

0 commit comments

Comments
 (0)