Skip to content

Commit

Permalink
Merge pull request #2723 from ONLYOFFICE/fix/fix-bugs
Browse files Browse the repository at this point in the history
[DE PE SSE] Fix bug 65348
  • Loading branch information
JuliaRadzhabova authored Dec 1, 2023
2 parents 966b813 + fdc1a72 commit eae4978
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 11 deletions.
16 changes: 16 additions & 0 deletions apps/common/main/lib/component/SideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,22 @@ define([
}
}
},

updatePluginButtonsIcons: function (icons) {
var me = this;
icons.forEach(function (item) {
var arr = me.getPluginButton(item.guid),
btn = arr[0],
index = arr[1],
menuItem = _.findWhere(me.btnMore.menu.items, {value: index}),
src = item.baseUrl + item.parsedIcons['normal'];
btn.options.iconImg = src;
btn.cmpEl.find("img").attr("src", src);
if (menuItem) {
menuItem.cmpEl.find("img").attr("src", src);
}
});
},
}
}()));
});
14 changes: 13 additions & 1 deletion apps/common/main/lib/controller/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,22 @@ define([

updatePluginsButtons: function() {
var storePlugins = this.getApplication().getCollection('Common.Collections.Plugins'),
me = this;
me = this,
iconsInSideMenu = [];
storePlugins.each(function(item){
me.viewPlugins.updatePluginIcons(item);
var guid = item.get('guid');
if (me.viewPlugins.pluginPanels[guid]) {
iconsInSideMenu.push({
guid: guid,
baseUrl: item.get('baseUrl'),
parsedIcons: item.get('parsedIcons')
});
}
});
if (iconsInSideMenu.length > 0) {
me.viewPlugins.fireEvent('plugins:updateicons', [iconsInSideMenu]);
}
},

onSelectPlugin: function(picker, item, record, e){
Expand Down
6 changes: 0 additions & 6 deletions apps/common/main/lib/view/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ define([
};
this.lockedControls = [];
this.pluginPanels = {};
this.pluginBtns = {};
Common.UI.BaseView.prototype.initialize.call(this, arguments);
},

Expand Down Expand Up @@ -302,11 +301,6 @@ define([
menuItem.cmpEl.find("img").attr("src", model.get('baseUrl') + model.get('parsedIcons')['normal']);
} else if (btn && btn.cmpEl) {
btn.cmpEl.find(".inner-box-icon img").attr("src", model.get('baseUrl') + model.get('parsedIcons')[btn.isActive() ? 'active' : 'normal']);
var guid = model.get('guid'),
leftBtn = this.pluginBtns[guid];
if (leftBtn && leftBtn.cmpEl) {
leftBtn.cmpEl.find("img").attr("src", model.get('baseUrl') + model.get('parsedIcons')[leftBtn.isActive() ? 'active' : 'normal']);
}
}
},

Expand Down
7 changes: 6 additions & 1 deletion apps/documenteditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ define([
'plugins:addtoleft': _.bind(this.addNewPlugin, this),
'plugins:open': _.bind(this.openPlugin, this),
'plugins:close': _.bind(this.closePlugin, this),
'hide': _.bind(this.onHidePlugins, this)
'hide': _.bind(this.onHidePlugins, this),
'plugins:updateicons': _.bind(this.updatePluginButtonsIcons, this)
},
'LeftMenu': {
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
Expand Down Expand Up @@ -620,6 +621,10 @@ define([
this.leftMenu.closePlugin(guid);
},

updatePluginButtonsIcons: function (icons) {
this.leftMenu.updatePluginButtonsIcons(icons);
},

onApiServerDisconnect: function(enableDownload) {
this.mode.isEdit = false;
this.leftMenu.close();
Expand Down
7 changes: 6 additions & 1 deletion apps/pdfeditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ define([
'plugins:addtoleft': _.bind(this.addNewPlugin, this),
'plugins:open': _.bind(this.openPlugin, this),
'plugins:close': _.bind(this.closePlugin, this),
'hide': _.bind(this.onHidePlugins, this)
'hide': _.bind(this.onHidePlugins, this),
'plugins:updateicons': _.bind(this.updatePluginButtonsIcons, this)
},
'LeftMenu': {
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
Expand Down Expand Up @@ -543,6 +544,10 @@ define([
this.leftMenu.closePlugin(guid);
},

updatePluginButtonsIcons: function (icons) {
this.leftMenu.updatePluginButtonsIcons(icons);
},

onApiServerDisconnect: function(enableDownload) {
this.mode.isEdit = false;
this.leftMenu.close();
Expand Down
7 changes: 6 additions & 1 deletion apps/presentationeditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ define([
'plugins:addtoleft': _.bind(this.addNewPlugin, this),
'plugins:open': _.bind(this.openPlugin, this),
'plugins:close': _.bind(this.closePlugin, this),
'hide': _.bind(this.onHidePlugins, this)
'hide': _.bind(this.onHidePlugins, this),
'plugins:updateicons': _.bind(this.updatePluginButtonsIcons, this)
},
'Common.Views.About': {
'show': _.bind(this.aboutShowHide, this, false),
Expand Down Expand Up @@ -480,6 +481,10 @@ define([
this.leftMenu.closePlugin(guid);
},

updatePluginButtonsIcons: function (icons) {
this.leftMenu.updatePluginButtonsIcons(icons);
},

onShowTumbnails: function(obj, show) {
this.api.ShowThumbnails(show);

Expand Down
7 changes: 6 additions & 1 deletion apps/spreadsheeteditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ define([
'plugins:addtoleft': _.bind(this.addNewPlugin, this),
'plugins:open': _.bind(this.openPlugin, this),
'plugins:close': _.bind(this.closePlugin, this),
'hide': _.bind(this.onHidePlugins, this)
'hide': _.bind(this.onHidePlugins, this),
'plugins:updateicons': _.bind(this.updatePluginButtonsIcons, this)
},
'Common.Views.Header': {
'history:show': function () {
Expand Down Expand Up @@ -624,6 +625,10 @@ define([
this.leftMenu.closePlugin(guid);
},

updatePluginButtonsIcons: function (icons) {
this.leftMenu.updatePluginButtonsIcons(icons);
},

setPreviewMode: function(mode) {
if (this.viewmode === mode) return;
this.viewmode = mode;
Expand Down

0 comments on commit eae4978

Please sign in to comment.