Skip to content

Added 'clearEvent' to eventBus to prevent multiple attach event on wysiwyg editor #25671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 27, 2019
4 changes: 2 additions & 2 deletions lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ define([
/**
* @param {Object} o
*/
openFileBrowser: function (o) {
openFileBrowser: _.debounce(function (o) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, did you find out what is the reason that openFileBrowser is called multiple times in the first place?

Copy link
Member Author

@Nazar65 Nazar65 Nov 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @krzksz yes, this caused by this lines

varienGlobalEvents.fireEvent('open_browser_callback', payload);
this.eventBus.fireEvent('open_browser_callback', payload);

Where the same event fires two times with the same object, but as I observed this event needs both, but on some pages, these events triggered different result, like on product edit page this will fire twice, and on category page once as expected

var typeTitle = this.translate('Select Images'),
storeId = this.config['store_id'] ? this.config['store_id'] : 0,
frameDialog = jQuery('div.mce-container[role="dialog"]'),
Expand Down Expand Up @@ -406,7 +406,7 @@ define([
}
);
});
},
}, 250),

/**
* @param {String} string
Expand Down