From: Alexander Ebert Date: Thu, 7 Jul 2016 16:42:27 +0000 (+0200) Subject: Added support for callback handling inserts X-Git-Tag: 3.0.0_Beta_1~1246 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2addee561da5c157e9ffa7ce3d285814c9d04a3e;p=GitHub%2FWoltLab%2FWCF.git Added support for callback handling inserts --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js index c8255cd64a..0d07a4000a 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js @@ -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) {