diff --git a/less/topic.less b/less/topic.less index 4433fec..751ee56 100644 --- a/less/topic.less +++ b/less/topic.less @@ -370,6 +370,7 @@ } .quick-reply { + position: relative; .icon { position: relative; border-radius: 50%; diff --git a/public/modules/quickreply.js b/public/modules/quickreply.js index f1a02d8..603c44e 100644 --- a/public/modules/quickreply.js +++ b/public/modules/quickreply.js @@ -1,8 +1,8 @@ 'use strict'; define('persona/quickreply', [ - 'components', 'composer/autocomplete', 'api', 'alerts', -], function (components, autocomplete, api, alerts) { + 'components', 'composer/autocomplete', 'api', 'alerts', 'uploadHelpers', +], function (components, autocomplete, api, alerts, uploadHelpers) { var QuickReply = {}; QuickReply.init = function () { @@ -27,6 +27,22 @@ define('persona/quickreply', [ // data.element.textcomplete(data.strategies, data.options); // $('.textcomplete-wrapper').css('height', '100%').find('textarea').css('height', '100%'); + + uploadHelpers.init({ + dragDropAreaEl: $('[component="topic/quickreply/container"] .quickreply-message'), + pasteEl: element, + uploadFormEl: $('[component="topic/quickreply/upload"]'), + inputEl: element, + route: '/api/post/upload', + callback: function (uploads) { + let text = element.val(); + uploads.forEach((upload) => { + text = text + (text ? '\n' : '') + (upload.isImage ? '!' : '') + `[${upload.filename}](${upload.url})`; + }); + element.val(text); + }, + }); + var ready = true; components.get('topic/quickreply/button').on('click', function (e) { e.preventDefault(); diff --git a/templates/chat.tpl b/templates/chat.tpl index 3084f28..2a887b4 100644 --- a/templates/chat.tpl +++ b/templates/chat.tpl @@ -21,8 +21,12 @@ {maximumChatMessageLength} +
+ +
+
[[topic:composer.drag_and_drop_images]]
\ No newline at end of file diff --git a/templates/chats.tpl b/templates/chats.tpl index 01906cf..a12b9d8 100644 --- a/templates/chats.tpl +++ b/templates/chats.tpl @@ -13,4 +13,5 @@
+
[[topic:composer.drag_and_drop_images]]
\ No newline at end of file diff --git a/templates/partials/chats/message-window.tpl b/templates/partials/chats/message-window.tpl index ac7ab8a..fe175d2 100644 --- a/templates/partials/chats/message-window.tpl +++ b/templates/partials/chats/message-window.tpl @@ -20,6 +20,9 @@ {maximumChatMessageLength} +
+ +
diff --git a/templates/partials/topic/quickreply.tpl b/templates/partials/topic/quickreply.tpl index 57421eb..592f7aa 100644 --- a/templates/partials/topic/quickreply.tpl +++ b/templates/partials/topic/quickreply.tpl @@ -1,5 +1,5 @@ -
+