From a032ebd1539cc058aa9a1b51ac973ffea9abd69a Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 8 Sep 2019 16:17:20 +0200 Subject: [PATCH] Properly disable attachment insertion button(s) on contact form See #2687 --- com.woltlab.wcf/templates/contact.tpl | 2 +- wcfsetup/install/files/js/WCF.Attachment.js | 16 ++++++++++------ wcfsetup/install/files/style/ui/contact.scss | 7 ------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/com.woltlab.wcf/templates/contact.tpl b/com.woltlab.wcf/templates/contact.tpl index a036f6ea3f..368a5b5990 100644 --- a/com.woltlab.wcf/templates/contact.tpl +++ b/com.woltlab.wcf/templates/contact.tpl @@ -73,7 +73,7 @@ {if CONTACT_FORM_ENABLE_ATTACHMENTS && !$attachmentHandler|empty && $attachmentHandler->canUpload()}
- {include file='messageFormAttachments'} + {include file='messageFormAttachments' wysiwygSelector=''}
{/if} diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index a653f0888e..9c38650728 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -93,14 +93,18 @@ if (COMPILER_TARGET_DEFAULT) { this._makeSortable(); - this._insertAllButton = $('

' + WCF.Language.get('wcf.attachment.insertAll') + '

').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 = $('

' + WCF.Language.get('wcf.attachment.insertAll') + '

').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)); diff --git a/wcfsetup/install/files/style/ui/contact.scss b/wcfsetup/install/files/style/ui/contact.scss index cfb80b7adc..81758d3833 100644 --- a/wcfsetup/install/files/style/ui/contact.scss +++ b/wcfsetup/install/files/style/ui/contact.scss @@ -1,10 +1,3 @@ .contactFormAttachments { margin-top: 20px; - - .jsButtonAttachmentInsertFull, - .jsButtonAttachmentInsertPlain, - .jsButtonAttachmentInsertThumbnail, - .jsButtonAttachmentInsertAll { - display: none; - } } -- 2.20.1