[FIX] web_editor: always hide icon & video tabs when choosing bg img
This was broken in 11.0 if the media dialog was the first dialog to be opened when using the editor. This happened for two reasons: - Never use a widget (dialog)'s `$el` before it is started (opened). This was the case here. The bug is even worse in saas-11.1 as we do not allow to do that from there so it results in a JS crash. - It worked in <= saas-16 because dialogs were started at once as they did not need to load anything. In >= 11.0, the first dialog which is opened in the page needs to request the main dialog template and this takes some time. So, this fix makes sense in >= 9.0 but I chose to merge it in 11.0 as it only induces a real bug from there.
This commit is contained in:
@@ -873,7 +873,9 @@ registry.background = SnippetOption.extend({
|
||||
var $image = $('<img/>', {class: 'hidden', src: value}).appendTo(this.$target);
|
||||
|
||||
var _editor = new widget.MediaDialog(this, {}, null, $image[0]).open();
|
||||
_editor.$('[href="#editor-media-video"], [href="#editor-media-icon"]').addClass('hidden');
|
||||
_editor.opened(function () {
|
||||
_editor.$('[href="#editor-media-video"], [href="#editor-media-icon"]').addClass('hidden');
|
||||
});
|
||||
|
||||
_editor.on('save', this, function () {
|
||||
this._setCustomBackground($image.attr('src'));
|
||||
|
||||
Reference in New Issue
Block a user