Added support for callback handling inserts
authorAlexander Ebert <ebert@woltlab.com>
Thu, 7 Jul 2016 16:42:27 +0000 (18:42 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 7 Jul 2016 16:42:27 +0000 (18:42 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js

index c8255cd64a2b13c61799069a562fe4055fd5fc01..0d07a4000acb2635af53ccc2aca40c0b53c896f8 100644 (file)
@@ -13,6 +13,10 @@ define(['Core', 'Dictionary', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/
         * @constructor
         */
        function MediaManagerEditor(options) {
+               options = Core.extend({
+                       callbackInsert: null
+               }, options);
+               
                MediaManagerBase.call(this, options);
                
                this._activeButton = null;
@@ -177,13 +181,18 @@ define(['Core', 'Dictionary', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/
                                thumbnailSize = elBySel('select[name=thumbnailSize]', dialogContent).value;
                        }
                        
-                       if (insertType === 'separate') {
-                               this._options.editor.buffer.set();
-                               
-                               this._mediaToInsert.forEach(this._insertMediaItem.bind(this, thumbnailSize));
+                       if (this._options.callbackInsert !== null) {
+                               this._options.callbackInsert(this._mediaToInsert, insertType, thumbnailSize);
                        }
                        else {
-                               this._insertMediaGallery();
+                               if (insertType === 'separate') {
+                                       this._options.editor.buffer.set();
+                                       
+                                       this._mediaToInsert.forEach(this._insertMediaItem.bind(this, thumbnailSize));
+                               }
+                               else {
+                                       this._insertMediaGallery();
+                               }
                        }
                        
                        if (this._mediaToInsertByClipboard) {