[PDF] Add plugins and more in left panel

This commit is contained in:
Julia.Svinareva
2023-11-16 21:42:49 +03:00
parent 705e4769fe
commit fa8e91ebeb
10 changed files with 55 additions and 59 deletions

View File

@ -90,6 +90,8 @@ define([
},
setMoreButton: function () {
if (!this.buttons.length) return;
var $more = this.btnMoreContainer;
var btnHeight = this.buttons[0].cmpEl.outerHeight(true),

View File

@ -19,6 +19,5 @@
<!-- /** coauthoring end **/ -->
<div id="left-panel-navigation" class="" style="display: none; height: 100%;"></div>
<div id="left-panel-thumbnails" class="" style="display: none; height: 100%;"></div>
<div id="left-panel-plugins" class="" style="display: none; height: 100%;"></div>
</div>
</div>

View File

@ -265,9 +265,6 @@ define([
if (name == 'history') {
this.panelHistory = panel.render('#left-panel-history');
} else
if (name == 'plugins' && !this.panelPlugins) {
this.panelPlugins = panel.render(/*'#left-panel-plugins'*/);
} else
if (name == 'navigation' && !this.panelNavigation) {
this.panelNavigation = panel.render('#left-panel-navigation');
} else

View File

@ -72,12 +72,15 @@ define([
'hide': _.bind(this.aboutShowHide, this, true)
},
'Common.Views.Plugins': {
'plugin:open': _.bind(this.onPluginOpen, this),
'hide': _.bind(this.onHidePlugins, this)
'plugins:addtoleft': _.bind(this.addNewPlugin, this),
'plugins:open': _.bind(this.openPlugin, this),
'plugins:close': _.bind(this.closePlugin, this),
'hide': _.bind(this.onHidePlugins, this)
},
'LeftMenu': {
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
'comments:hide': _.bind(this.commentsShowHide, this, 'hide')
'comments:hide': _.bind(this.commentsShowHide, this, 'hide'),
'button:click': _.bind(this.onBtnCategoryClick, this)
},
'FileMenu': {
'menu:hide': _.bind(this.menuFilesShowHide, this, 'hide'),
@ -207,6 +210,7 @@ define([
(this.mode.trialMode || this.mode.isBeta) && this.leftMenu.setDeveloperMode(this.mode.trialMode, this.mode.isBeta, this.mode.buildVersion);
Common.util.Shortcuts.resumeEvents();
this.leftMenu.setMoreButton();
return this;
},
@ -509,11 +513,36 @@ define([
$(this.leftMenu.btnChat.el).blur();
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
},
/** coauthoring end **/
onHidePlugins: function() {
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
},
/** coauthoring end **/
addNewPlugin: function (button, $button, $panel) {
this.leftMenu.insertButton(button, $button);
this.leftMenu.insertPanel($panel);
},
onBtnCategoryClick: function (btn) {
if (btn.options.type === 'plugin' && !btn.isDisabled()) {
if (btn.pressed) {
this.tryToShowLeftMenu();
this.leftMenu.fireEvent('plugins:showpanel', [btn.options.value]); // show plugin panel
} else {
this.leftMenu.fireEvent('plugins:hidepanel', [btn.options.value]);
}
this.leftMenu.onBtnMenuClick(btn);
}
},
openPlugin: function (guid) {
this.leftMenu.openPlugin(guid);
},
closePlugin: function (guid) {
this.leftMenu.closePlugin(guid);
},
onApiServerDisconnect: function(enableDownload) {
this.mode.isEdit = false;
@ -523,8 +552,8 @@ define([
this.leftMenu.btnComments.setDisabled(true);
this.leftMenu.btnChat.setDisabled(true);
/** coauthoring end **/
this.leftMenu.btnPlugins.setDisabled(true);
this.leftMenu.btnNavigation.setDisabled(true);
this.leftMenu.setDisabledPluginButtons(true);
this.leftMenu.getMenu('file').setMode({isDisconnected: true, enableDownload: !!enableDownload});
},
@ -562,7 +591,7 @@ define([
if (!options || options.navigation && options.navigation.disable)
this.leftMenu.btnNavigation.setDisabled(disable);
this.leftMenu.btnPlugins.setDisabled(disable);
this.leftMenu.setDisabledPluginButtons(disable);
},
/** coauthoring begin **/

View File

@ -5,13 +5,13 @@
<button id="left-btn-comments" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target="left-panel-comments"><i class="icon toolbar__icon btn-menu-comments">&nbsp;</i></button>
<button id="left-btn-chat" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target="left-panel-chat"><i class="icon toolbar__icon btn-menu-chat">&nbsp;</i></button>
<!-- /** coauthoring end **/ -->
<button id="left-btn-plugins" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target=""><i class="icon toolbar__icon btn-menu-plugin">&nbsp;</i></button>
<button id="left-btn-navigation" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target="" data-layout-name="leftMenu-navigation"><i class="icon toolbar__icon btn-menu-navigation">&nbsp;</i></button>
<button id="left-btn-thumbnails" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target=""><i class="icon toolbar__icon btn-menu-thumbs">&nbsp;</i></button>
<button id="left-btn-support" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target=""><i class="icon toolbar__icon btn-menu-support">&nbsp;</i></button>
<button id="left-btn-about" class="btn btn-category" data-hint="0" data-hint-direction="right" data-hint-offset="big" content-target=""><i class="icon toolbar__icon btn-menu-about">&nbsp;</i></button>
<div id="slot-left-menu-more"></div>
</div>
<div class="left-panel" style="">
<div class="left-panel side-panel" style="">
<div id="left-panel-search" class="" style="display: none;"></div>
<!-- /** coauthoring begin **/ -->
<div id="left-panel-comments" class="" style="display: none;"></div>
@ -19,6 +19,5 @@
<!-- /** coauthoring end **/ -->
<div id="left-panel-navigation" class="" style="display: none; height: 100%;"></div>
<div id="left-panel-thumbnails" class="" style="display: none; height: 100%;"></div>
<div id="left-panel-plugins" class="" style="display: none; height: 100%;"></div>
</div>
</div>

View File

@ -42,6 +42,7 @@ define([
'jquery',
'underscore',
'backbone',
'common/main/lib/component/SideMenu',
'common/main/lib/component/Button',
'common/main/lib/view/About',
/** coauthoring begin **/
@ -59,23 +60,11 @@ define([
var SCALE_MIN = 40;
var MENU_SCALE_PART = 300;
PDFE.Views.LeftMenu = Backbone.View.extend(_.extend({
PDFE.Views.LeftMenu = Common.UI.SideMenu.extend(_.extend({
el: '#left-menu',
template: _.template(menuTemplate),
// Delegated events for creating new items, and clearing completed ones.
events: function() {
return {
'click #left-btn-support': function() {
var config = this.mode.customization;
config && !!config.feedback && !!config.feedback.url ?
window.open(config.feedback.url) :
window.open('{{SUPPORT_URL}}');
}
}
},
initialize: function () {
this.minimizedMode = true;
this._state = {disabled: false};
@ -84,6 +73,10 @@ define([
render: function () {
var $markup = $(this.template({}));
this.btnMoreContainer = $markup.find('#slot-left-menu-more');
Common.UI.SideMenu.prototype.render.call(this);
this.btnMore.menu.menuAlign = 'tl-tr';
this.btnSearchBar = new Common.UI.Button({
action: 'advancedsearch',
el: $markup.elementById('#left-btn-searchbar'),
@ -113,6 +106,12 @@ define([
iconCls: 'btn-menu-support',
disabled: true
});
this.btnSupport.on('click', _.bind(function() {
var config = this.mode.customization;
config && !!config.feedback && !!config.feedback.url ?
window.open(config.feedback.url) :
window.open('{{SUPPORT_URL}}');
}, this));
/** coauthoring begin **/
this.btnComments = new Common.UI.Button({
@ -141,17 +140,6 @@ define([
/** coauthoring end **/
this.btnPlugins = new Common.UI.Button({
el: $markup.elementById('#left-btn-plugins'),
hint: this.tipPlugins,
enableToggle: true,
disabled: true,
iconCls: 'btn-menu-plugin',
toggleGroup: 'leftMenuGroup'
});
this.btnPlugins.hide();
this.btnPlugins.on('click', this.onBtnMenuClick.bind(this));
this.btnNavigation = new Common.UI.Button({
el: $markup.elementById('#left-btn-navigation'),
hint: this.tipOutline,
@ -176,6 +164,8 @@ define([
this.btnThumbnails.hide();
this.btnThumbnails.on('click', this.onBtnMenuClick.bind(this));
this.setButtons([this.btnSearchBar, this.btnComments, this.btnChat, this.btnNavigation, this.btnThumbnails, this.btnSupport, this.btnAbout]);
this.$el.html($markup);
return this;
@ -262,12 +252,6 @@ define([
}
}
/** coauthoring end **/
// if (this.mode.canPlugins && this.panelPlugins) {
// if (this.btnPlugins.pressed) {
// this.panelPlugins.show();
// } else
// this.panelPlugins['hide']();
// }
},
setOptionsPanel: function(name, panel) {
@ -277,9 +261,6 @@ define([
} else if (name == 'comment') {
this.panelComments = panel;
} else /** coauthoring end **/
if (name == 'plugins' && !this.panelPlugins) {
this.panelPlugins = panel.render(/*'#left-panel-plugins'*/);
} else
if (name == 'navigation' && !this.panelNavigation) {
this.panelNavigation = panel.render('#left-panel-navigation');
} else
@ -325,10 +306,6 @@ define([
}
}
/** coauthoring end **/
if (this.mode.canPlugins && this.panelPlugins && !this._state.pluginIsRunning) {
this.panelPlugins['hide']();
this.btnPlugins.toggle(false, true);
}
if (this.panelNavigation) {
this.panelNavigation['hide']();
this.btnNavigation.toggle(false);
@ -360,9 +337,9 @@ define([
this.btnComments.setDisabled(false);
this.btnChat.setDisabled(false);
/** coauthoring end **/
this.btnPlugins.setDisabled(false);
this.btnNavigation.setDisabled(false);
this.btnThumbnails.setDisabled(false);
this.setDisabledAllMoreMenuItems(false);
},
showMenu: function(menu, opts, suspendAfter) {

View File

@ -17,6 +17,5 @@
<div id="left-panel-comments" class="" style="display: none;"></div>
<div id="left-panel-chat" class="" style="display: none;"></div>
<!-- /** coauthoring end **/ -->
<div id="left-panel-plugins" class="" style="display: none; height: 100%;"></div>
</div>
</div>

View File

@ -246,9 +246,7 @@ define([
} else if (name == 'comment') {
this.panelComments = panel;
} else /** coauthoring end **/
if (name == 'plugins' && !this.panelPlugins) {
this.panelPlugins = panel.render('#left-panel-plugins');
} else if (name == 'history') {
if (name == 'history') {
this.panelHistory = panel.render('#left-panel-history');
} else
if (name == 'advancedsearch') {

View File

@ -18,6 +18,5 @@
<div id="left-panel-chat" class="" style="display: none;"></div>
<div id="left-panel-spellcheck" class="" style="display: none; height: 100%;"></div>
<!-- /** coauthoring end **/ -->
<div id="left-panel-plugins" class="" style="display: none; height: 100%; position: relative;"></div>
</div>
</div>

View File

@ -227,9 +227,6 @@ define([
} else if (name == 'comment') {
this.panelComments = panel;
} else
if (name == 'plugins' && !this.panelPlugins) {
this.panelPlugins = panel.render('#left-panel-plugins');
} else
if (name == 'spellcheck' && !this.panelSpellcheck) {
this.panelSpellcheck = panel.render('#left-panel-spellcheck');
} else if (name == 'history') {