Skip to content

Commit 2da1025

Browse files
committed
corectly bind this
1 parent dba6863 commit 2da1025

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/web/mage/adminhtml/browser.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ define([
1919
], function ($, wysiwyg, prompt, confirm, alert, _) {
2020
window.MediabrowserUtility = {
2121
windowId: 'modal_dialog_message',
22-
modalLoaded: false,
22+
intialized: false,
2323
targetElementId: false,
2424

2525
/**
@@ -51,17 +51,16 @@ define([
5151
*/
5252
openDialog: function (url, width, height, title, options) {
5353
var windowId = this.windowId,
54-
content = '<div class="popup-window" id="' + windowId + '"></div>',
55-
self = this;
54+
content = '<div class="popup-window" id="' + windowId + '"></div>';
5655

57-
if (this.modalLoaded) {
56+
if (this.initialized) {
5857

5958
if (!_.isUndefined(options)) {
6059
this.modal.modal('option', 'closed', options.closed);
6160
}
6261

6362
this.modal.modal('openModal');
64-
self.setTargetElementId(options, url);
63+
this.setTargetElementId(options, url);
6564
$(window).trigger('reload.MediaGallery');
6665

6766
return;
@@ -83,10 +82,10 @@ define([
8382
showLoader: true
8483

8584
}).done(function (data) {
86-
self.modal.html(data).trigger('contentUpdated');
87-
self.modalLoaded = true;
88-
self.setTargetElementId(options, url);
89-
});
85+
this.modal.html(data).trigger('contentUpdated');
86+
this.initialized = true;
87+
this.setTargetElementId(options, url);
88+
}.bind(this));
9089

9190
},
9291

0 commit comments

Comments
 (0)