Skip to content

Commit afd16e9

Browse files
committed
MC-3311: Bug fixing for MC-1416
Localize open_browser_callback to prevent observable from being called for every instance
1 parent 8110142 commit afd16e9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ define([
4848
varienGlobalEvents.attachEventHandler('tinymceSetContent', this.updateTextArea);
4949
varienGlobalEvents.attachEventHandler('tinymceSaveContent', this.saveContent);
5050
varienGlobalEvents.attachEventHandler('tinymceUndo', this.onUndo);
51-
varienGlobalEvents.attachEventHandler('open_browser_callback', this.openFileBrowser);
5251

5352
if (typeof tinyMceEditors === 'undefined') {
5453
window.tinyMceEditors = $H({});
@@ -117,6 +116,7 @@ define([
117116
jQuery.when.apply(jQuery, deferreds).done(function () {
118117
tinyMCE4.init(settings);
119118
this.getPluginButtons().hide();
119+
this.eventBus.attachEventHandler('open_browser_callback', this.openFileBrowser);
120120
}.bind(this));
121121
},
122122

@@ -264,12 +264,15 @@ define([
264264
* @param {*} w
265265
*/
266266
settings['file_browser_callback'] = function (fieldName, url, objectType, w) {
267-
varienGlobalEvents.fireEvent('open_browser_callback', {
267+
var payload = {
268268
win: w,
269269
type: objectType,
270270
field: fieldName
271-
});
272-
};
271+
};
272+
273+
varienGlobalEvents.fireEvent('open_browser_callback', payload);
274+
this.eventBus.fireEvent('open_browser_callback', payload);
275+
}.bind(this);
273276
}
274277

275278
if (this.config.width) {

0 commit comments

Comments
 (0)