Added support for legacy clipboard action objects
authorAlexander Ebert <ebert@woltlab.com>
Mon, 24 Oct 2016 08:53:57 +0000 (10:53 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 24 Oct 2016 08:53:57 +0000 (10:53 +0200)
wcfsetup/install/files/js/WCF.js

index da301d810b0f0ca8ac7cf9a0f20c99af71ad3c22..a920a608eb429105c3e095117b073da30214763a 100755 (executable)
@@ -1312,12 +1312,24 @@ WCF.Clipboard = {
         * @param       integer         pageObjectID
         */
        init: function(page, hasMarkedItems, actionObjects, pageObjectID) {
-               require(['WoltLabSuite/Core/Controller/Clipboard'], function(ControllerClipboard) {
+               require(['EventHandler', 'WoltLabSuite/Core/Controller/Clipboard'], function(EventHandler, ControllerClipboard) {
                        ControllerClipboard.setup({
                                hasMarkedItems: (hasMarkedItems > 0),
                                pageClassName: page,
                                pageObjectId: pageObjectID
                        });
+                       
+                       for (var type in actionObjects) {
+                               if (actionObjects.hasOwnProperty(type)) {
+                                       (function (type) {
+                                               EventHandler.add('com.woltlab.wcf.clipboard', type, function (data) {
+                                                       if (actionObjects[type].hasOwnProperty(data.responseData.actionName)) {
+                                                               actionObjects[type][data.responseData.actionName].triggerEffect(data.responseData.objectIDs);
+                                                       }
+                                               });
+                                       })(type);
+                               }
+                       }
                });
        },