2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 01:47:48 +00:00

Fix file upload handling

When using enter from tag textarea, there are two events being
triggered. First one is the global textarea and the other one is post
form specific.

The check for `@current_request` didn't cancel the event if passed and
thus allowed form submission to be handled by the browser.

Additionally, jquery `submit` function doesn't trigger non-jquery event
listener so it needs to be changed to use native browser trigger.
This commit is contained in:
nanaya 2024-11-04 03:46:30 +09:00
parent 443ed6ab33
commit 06c3963894
2 changed files with 2 additions and 1 deletions

View File

@ -56,6 +56,7 @@ PostUploadForm::form_submit_event = (e) ->
if e.stopped
return
if @current_request?
e.preventDefault()
return
$('post-exists').hide()
$('post-upload-error').hide()

View File

@ -44,7 +44,7 @@
$('#post_tags').on 'keydown', (e) ->
if e.which == 13
e.preventDefault()
$('#edit-form').submit()
document.getElementById('edit-form').requestSubmit()
return
return
return