Show back button in the header of the plugin dialog

This commit is contained in:
Julia Radzhabova 2022-07-28 22:59:50 +03:00
parent 7b7a579320
commit 00b63283bd
3 changed files with 47 additions and 0 deletions

View file

@ -162,6 +162,8 @@ define([
this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this));
this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this));
this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this));
this.api.asc_registerCallback('asc_onPluginShowButton', _.bind(this.onPluginsShowButton, this));
this.api.asc_registerCallback('asc_onPluginHideButton', _.bind(this.onPluginsHideButton, this));
this.loadPlugins();
}
@ -400,6 +402,9 @@ define([
},
'help': function(){
help && window.open(help, '_blank');
},
'header:click': function(type){
me.api.asc_pluginButtonClick(type);
}
});
@ -459,6 +464,14 @@ define([
this.parsePlugins(pluginsdata)
},
onPluginsShowButton: function(type) {
this.pluginDlg && this.pluginDlg.showButton(type);
},
onPluginsHideButton: function(type) {
this.pluginDlg && this.pluginDlg.hideButton(type);
},
runAutoStartPlugins: function() {
if (this.autostart && this.autostart.length > 0) {
this.api.asc_pluginRun(this.autostart.shift(), 0, '');

View file

@ -91,6 +91,8 @@ define([
if (!this.options.header) this._headerFooterHeight -= 34;
this._headerFooterHeight += ((parseInt(this.$window.css('border-top-width')) + parseInt(this.$window.css('border-bottom-width'))));
this.$window.find('.header').prepend($('<div class="tools left hidden"></div>'));
var iframe = document.createElement("iframe");
iframe.id = this.frameId;
iframe.name = 'pluginFrameEditor';
@ -183,6 +185,32 @@ define([
}
},
showButton: function(type) {
var header = this.$window.find('.header .tools.left');
if (type=='back') {
var btn = header.find('#id-plugindlg-' + type);
if (btn.length<1) {
btn = $('<div id="id-plugindlg-' + type + '" class="tool help" style="font-size:20px;">←</div>');
btn.on('click', _.bind(function() {
this.fireEvent('header:click',type);
}, this));
header.prepend(btn);
}
btn.show();
header.removeClass('hidden');
}
},
hideButton: function(type) {
var header = this.$window.find('.header .tools.left');
if (type=='back') {
var btn = header.find('#id-plugindlg-' + type);
if (btn.length>0) {
btn.hide();
}
}
},
textLoading : 'Loading'
}, Common.Views.PluginDlg || {}));
});

View file

@ -116,6 +116,12 @@
position: absolute;
right: 0;
padding-right: 6px;
&.left {
left: 0;
right: auto;
padding-left: 6px;
}
}
.tool.help {