Skip to content

Commit

Permalink
[common] Fix icon for custom plugin panels
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaSvinareva committed Apr 4, 2024
1 parent 2a27e5c commit ef65b5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
23 changes: 20 additions & 3 deletions apps/common/main/lib/controller/Plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,15 @@ define([
});
}
});
for (var key in this.viewPlugins.customPluginPanels) {
var panel = this.viewPlugins.customPluginPanels[key],
menu = panel.menu === 'right' ? iconsInRightMenu : iconsInLeftMenu;
menu.push({
guid: panel.frameId,
baseUrl: panel.baseUrl,
parsedIcons: this.viewPlugins.parseIcons(panel.icons)
});
}
if (iconsInLeftMenu.length > 0) {
me.viewPlugins.fireEvent('pluginsleft:updateicons', [iconsInLeftMenu]);
}
Expand Down Expand Up @@ -738,7 +747,7 @@ define([
},

onToolClose: function(panel) {
this.api.asc_pluginButtonClick(-1, panel && panel._state.insidePlugin, panel && panel.isExtraPanel && panel._state.frameId);
this.api.asc_pluginButtonClick(-1, panel && panel._state.insidePlugin, panel && panel.frameId);
},

onPluginMouseUp: function(x, y) {
Expand Down Expand Up @@ -1189,14 +1198,20 @@ define([
if (typeof variation.descriptionLocale == 'object')
description = variation.descriptionLocale[lang] || variation.descriptionLocale['en'] || description || '';

var model = this.viewPlugins.storePlugins.findWhere({guid: guid}),
modes = model.get('variations'),
icons = variation.icons ? variation.icons : modes[model.get('currentVariation')].get('icons'),
parsedIcons = this.viewPlugins.parseIcons(icons),
icon_url = model.get('baseUrl') + parsedIcons['normal'];

var $button = $('<div id="slot-btn-plugins-' + frameId + '"></div>'),
button = new Common.UI.Button({
parentEl: $button,
cls: 'btn-category plugin-buttons',
hint: description,
enableToggle: true,
toggleGroup: menu === 'right' ? 'tabpanelbtnsGroup' : 'leftMenuGroup',
//iconImg: model.get('baseUrl') + model.get('parsedIcons')['normal'],
iconImg: icon_url,
onlyIcon: true,
value: frameId,
type: 'plugin'
Expand All @@ -1206,7 +1221,9 @@ define([
this.viewPlugins.customPluginPanels[frameId] = new Common.Views.PluginPanel({
el: '#panel-plugins-' + frameId,
menu: menu,
isExtraPanel: true
frameId: frameId,
baseUrl: model.get('baseUrl'),
icons: icons
});
this.viewPlugins.customPluginPanels[frameId].on('render:after', _.bind(this.onAfterRender, this, this.viewPlugins.customPluginPanels[frameId], frameId));

Expand Down
1 change: 0 additions & 1 deletion apps/common/main/lib/view/PluginPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ define([
this.iframePlugin.src = url;
}
this._state.insidePlugin = guid;
this._state.frameId = frameId;
return true;
},

Expand Down

0 comments on commit ef65b5d

Please sign in to comment.