Prevent attachment buttons from submitting the form
authorAlexander Ebert <ebert@woltlab.com>
Thu, 18 Aug 2022 11:46:22 +0000 (13:46 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 18 Aug 2022 11:46:22 +0000 (13:46 +0200)
See https://www.woltlab.com/community/thread/296855-drag-drop-eines-bildes-f%C3%BChrt-zum-absenden-eines-neuen-themas-firefox/

wcfsetup/install/files/js/WCF.Attachment.js

index b6b28ce0834711959dfbdda8e4f236d22f0b4461..0ca54e93e7bb7e76301f80b54ae3889dcb9787bc 100644 (file)
@@ -93,7 +93,7 @@ WCF.Attachment.Upload = WCF.Upload.extend({
                
                // for backwards compatibility, the object is still created but only inserted
                // if an editor is used
-               this._insertAllButton = $('<button class="button jsButtonAttachmentInsertAll">' + WCF.Language.get('wcf.attachment.insertAll') + '</button>').hide();
+               this._insertAllButton = $('<button type="button" class="button jsButtonAttachmentInsertAll">' + WCF.Language.get('wcf.attachment.insertAll') + '</button>').hide();
                
                if (this._editorId) {
                        this._insertAllButton.appendTo(this._buttonSelector);
@@ -574,7 +574,7 @@ WCF.Attachment.Upload = WCF.Upload.extend({
                                
                                // init buttons
                                var $buttonList = $li.find('ul').addClass('buttonGroup');
-                               var $deleteButton = $('<li><button class="button small jsObjectAction" data-object-action="delete" data-confirm-message="' + WCF.Language.get('wcf.attachment.delete.sure') + '" data-event-name="attachment">' + WCF.Language.get('wcf.global.button.delete') + '</button></li>');
+                               var $deleteButton = $('<li><button type="button" class="button small jsObjectAction" data-object-action="delete" data-confirm-message="' + WCF.Language.get('wcf.attachment.delete.sure') + '" data-event-name="attachment">' + WCF.Language.get('wcf.global.button.delete') + '</button></li>');
                                $buttonList.append($deleteButton);
                                
                                $li.data('objectID', attachmentData.attachmentID);
@@ -582,13 +582,13 @@ WCF.Attachment.Upload = WCF.Upload.extend({
                                if (this._editorId) {
                                        if (attachmentData.tinyURL) {
                                                if (attachmentData.thumbnailURL) {
-                                                       $('<li><button class="button small jsButtonAttachmentInsertThumbnail" data-object-id="' + attachmentData.attachmentID + '" data-url="' + WCF.String.escapeHTML(attachmentData.thumbnailURL) + '">' + WCF.Language.get('wcf.attachment.insertThumbnail') + '</button></li>').appendTo($buttonList);
+                                                       $('<li><button type="button" class="button small jsButtonAttachmentInsertThumbnail" data-object-id="' + attachmentData.attachmentID + '" data-url="' + WCF.String.escapeHTML(attachmentData.thumbnailURL) + '">' + WCF.Language.get('wcf.attachment.insertThumbnail') + '</button></li>').appendTo($buttonList);
                                                }
                                                
-                                               $('<li><button class="button small jsButtonAttachmentInsertFull" data-object-id="' + attachmentData.attachmentID + '" data-url="' + WCF.String.escapeHTML(attachmentData.url) + '">' + WCF.Language.get('wcf.attachment.insertFull') + '</button></li>').appendTo($buttonList);
+                                               $('<li><button type="button" class="button small jsButtonAttachmentInsertFull" data-object-id="' + attachmentData.attachmentID + '" data-url="' + WCF.String.escapeHTML(attachmentData.url) + '">' + WCF.Language.get('wcf.attachment.insertFull') + '</button></li>').appendTo($buttonList);
                                        }
                                        else {
-                                               $('<li><button class="button small jsButtonAttachmentInsertPlain" data-object-id="' + attachmentData.attachmentID + '">' + WCF.Language.get('wcf.attachment.insert') + '</button></li>').appendTo($buttonList);
+                                               $('<li><button type="button" class="button small jsButtonAttachmentInsertPlain" data-object-id="' + attachmentData.attachmentID + '">' + WCF.Language.get('wcf.attachment.insert') + '</button></li>').appendTo($buttonList);
                                        }
                                }