From f1f694ffb025cd4d3aa8bd448ca3116a30a09e78 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 17 Apr 2014 13:57:42 +0200 Subject: [PATCH] Added support for attachment management during inline edit --- com.woltlab.wcf/templates/wysiwyg.tpl | 13 ++++++++++ .../js/3rdParty/redactor/plugins/wupload.js | 26 ++++++++++++++++++- wcfsetup/install/files/js/WCF.Message.js | 15 +++++++++++ .../message/QuickReplyManager.class.php | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index 889da3d328..c721a908b8 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -46,12 +46,25 @@ $(function() { {if $wysiwygEnableUpload} $config.plugins.push('wupload'); $config.wattachment = { + attachments: [ ], maxCount: {@$attachmentHandler->getMaxCount()}, objectType: '{@$attachmentObjectType}', objectID: '{@$attachmentObjectID}', parentObjectID: '{@$attachmentParentObjectID}', tmpHash: '{$tmpHash|encodeJS}' }; + + {if $attachmentList|isset && !$attachmentList|empty} + {foreach from=$attachmentList item=attachment} + $config.wattachment.attachments.push({ + attachmentID: {@$attachment->attachmentID}, + filename: '{$attachment->filename|encodeJs}', + isImage: {if $attachment->isImage}true{else}false{/if}, + tinyThumbnailUrl: '{if $attachment->tinyThumbnailType}{link controller='Attachment' object=$attachment}tiny=1{/link}{/if}', + url: '{link controller='Attachment' object=$attachment}{/link}' + }); + {/foreach} + {/if} {/if} {event name='javascriptInit'} diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js index eb7b2142f5..2ba974dcb0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wupload.js @@ -30,10 +30,34 @@ RedactorPlugins.wupload = { */ _initAttachments: function() { this._attachmentsContainer = $('
').hide().appendTo(this.$box); - $('