From 2addee561da5c157e9ffa7ce3d285814c9d04a3e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 7 Jul 2016 18:42:27 +0200 Subject: [PATCH] Added support for callback handling inserts --- .../js/WoltLab/WCF/Media/Manager/Editor.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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) { -- 2.20.1