Skip to content

Commit 4abdb9a

Browse files
ENGCOM-5418: Media gallery loaded twice #23621
- Merge Pull Request #23621 from sidolov/magento2:media_gallery_loaded_twice - Merged commits: 1. 76619e1
2 parents ede25ae + 76619e1 commit 4abdb9a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/web/mage/adminhtml/browser.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ define([
1818
], function ($, wysiwyg, prompt, confirm, alert) {
1919
window.MediabrowserUtility = {
2020
windowId: 'modal_dialog_message',
21+
modalLoaded: false,
2122

2223
/**
2324
* @return {Number}
@@ -51,6 +52,15 @@ define([
5152
content = '<div class="popup-window" id="' + windowId + '"></div>',
5253
self = this;
5354

55+
if (this.modalLoaded === true) {
56+
if (options && typeof options.closed !== 'undefined') {
57+
this.modal.modal('option', 'closed', options.closed);
58+
}
59+
this.modal.modal('openModal');
60+
61+
return;
62+
}
63+
5464
if (this.modal) {
5565
this.modal.html($(content).html());
5666

@@ -74,6 +84,7 @@ define([
7484

7585
}).done(function (data) {
7686
self.modal.html(data).trigger('contentUpdated');
87+
self.modalLoaded = true;
7788
});
7889
},
7990

lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ define([
117117
jQuery.when.apply(jQuery, deferreds).done(function () {
118118
tinyMCE4.init(settings);
119119
this.getPluginButtons().hide();
120+
varienGlobalEvents.clearEventHandlers('open_browser_callback');
120121
this.eventBus.attachEventHandler('open_browser_callback', tinyMceEditors.get(self.id).openFileBrowser);
121122
}.bind(this));
122123
},

0 commit comments

Comments
 (0)