Skip to content

Commit 261c61d

Browse files
ENGCOM-6272: WYSIWYG-Editor Insert Image-Popup is not working correctly with multiple WYSIWYG-Editors on page #25556
2 parents 80d8cbe + 4c7c618 commit 261c61d

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

lib/web/mage/adminhtml/browser.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ define([
1111
'Magento_Ui/js/modal/prompt',
1212
'Magento_Ui/js/modal/confirm',
1313
'Magento_Ui/js/modal/alert',
14+
'underscore',
1415
'Magento_Ui/js/modal/modal',
1516
'jquery/ui',
1617
'jquery/jstree/jquery.jstree',
1718
'mage/mage'
18-
], function ($, wysiwyg, prompt, confirm, alert) {
19+
], function ($, wysiwyg, prompt, confirm, alert, _) {
1920
window.MediabrowserUtility = {
2021
windowId: 'modal_dialog_message',
2122
modalLoaded: false,
@@ -52,16 +53,21 @@ define([
5253
content = '<div class="popup-window" id="' + windowId + '"></div>',
5354
self = this;
5455

55-
if (this.modalLoaded === true &&
56-
options &&
56+
if (options &&
5757
self.targetElementId &&
58-
self.targetElementId === options.targetElementId
59-
) {
58+
self.targetElementId === options.targetElementId) {
6059
if (typeof options.closed !== 'undefined') {
6160
this.modal.modal('option', 'closed', options.closed);
6261
}
6362
this.modal.modal('openModal');
6463

64+
return;
65+
} else if (_.isUndefined(options) &&
66+
self.modalLoaded === true &&
67+
self.targetElementId === url
68+
) {
69+
this.modal.modal('openModal');
70+
6571
return;
6672
}
6773

@@ -89,8 +95,11 @@ define([
8995
}).done(function (data) {
9096
self.modal.html(data).trigger('contentUpdated');
9197
self.modalLoaded = true;
92-
self.targetElementId = options.targetElementId;
98+
self.targetElementId = options ?
99+
options.targetElementId
100+
: url;
93101
});
102+
94103
},
95104

96105
/**
@@ -487,7 +496,7 @@ define([
487496
var nodeData = $(element).data('node');
488497

489498
if (index > 0) {
490-
breadcrumbs.append($('<li>\/</li>'));
499+
breadcrumbs.append($('<li>\/</li>')); //eslint-disable-line
491500
}
492501
breadcrumbs.append($('<li />')
493502
.data('node', nodeData).attr('data-row', 'breadcrumb').text(nodeData.text));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ define([
375375
*/
376376
openFileBrowser: function (o) {
377377
var typeTitle = this.translate('Select Images'),
378-
storeId = this.config['store_id'] !== null ? this.config['store_id'] : 0,
378+
storeId = this.config['store_id'] ? this.config['store_id'] : 0,
379379
frameDialog = jQuery('div.mce-container[role="dialog"]'),
380380
self = this,
381381
wUrl = this.config['files_browser_window_url'] +

0 commit comments

Comments
 (0)