Properly disable attachment insertion button(s) on contact form
authorMatthias Schmidt <gravatronics@live.com>
Sun, 8 Sep 2019 14:17:20 +0000 (16:17 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 8 Sep 2019 14:17:20 +0000 (16:17 +0200)
See #2687

com.woltlab.wcf/templates/contact.tpl
wcfsetup/install/files/js/WCF.Attachment.js
wcfsetup/install/files/style/ui/contact.scss

index a036f6ea3f7319ac4fbe58eb2d2a9e60111ec6fe..368a5b5990225b11e5242fc630e99e551e34b6cf 100644 (file)
@@ -73,7 +73,7 @@
                
                {if CONTACT_FORM_ENABLE_ATTACHMENTS && !$attachmentHandler|empty && $attachmentHandler->canUpload()}
                        <div class="contactFormAttachments">
-                               {include file='messageFormAttachments'}
+                               {include file='messageFormAttachments' wysiwygSelector=''}
                        </div>
                {/if}
                
index a653f0888e169ba548bbfd758187a53b769fb75f..9c386507282aaafc292a695d8af6a747e88aedc1 100644 (file)
@@ -93,14 +93,18 @@ if (COMPILER_TARGET_DEFAULT) {
                        
                        this._makeSortable();
                        
-                       this._insertAllButton = $('<p class="button jsButtonAttachmentInsertAll">' + WCF.Language.get('wcf.attachment.insertAll') + '</p>').hide().appendTo(this._buttonSelector);
-                       this._insertAllButton.click($.proxy(this._insertAll, this));
-                       
-                       if (this._fileListSelector.children('li:not(.uploadFailed)').length) {
-                               this._insertAllButton.show();
-                       }
+                       // for backwards compatibility, the object is still created but only inserted
+                       // if an editor is used
+                       this._insertAllButton = $('<p class="button jsButtonAttachmentInsertAll">' + WCF.Language.get('wcf.attachment.insertAll') + '</p>').hide();
                        
                        if (this._editorId) {
+                               this._insertAllButton.appendTo(this._buttonSelector);
+                               this._insertAllButton.click($.proxy(this._insertAll, this));
+                               
+                               if (this._fileListSelector.children('li:not(.uploadFailed)').length) {
+                                       this._insertAllButton.show();
+                               }
+                               
                                WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'submit_' + this._editorId, this._submitInline.bind(this));
                                WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'reset_' + this._editorId, this._reset.bind(this));
                                WCF.System.Event.addListener('com.woltlab.wcf.redactor2', 'dragAndDrop_' + this._editorId, this._editorUpload.bind(this));
index cfb80b7adc47d90e3002c73c0b177048dfc8b1a7..81758d383388f0ba569fe1a1c311475a9fb59061 100644 (file)
@@ -1,10 +1,3 @@
 .contactFormAttachments {
        margin-top: 20px;
-       
-       .jsButtonAttachmentInsertFull,
-       .jsButtonAttachmentInsertPlain,
-       .jsButtonAttachmentInsertThumbnail,
-       .jsButtonAttachmentInsertAll {
-               display: none;
-       }
 }