[SSE] removed FileMenu button from 'tools' menu

This commit is contained in:
Maxim Kadushkin 2017-04-27 18:34:19 +03:00
parent a80342235d
commit 0dfd81ec5a
5 changed files with 32 additions and 61 deletions

View file

@ -111,7 +111,6 @@ define([
this.leftMenu.$el.find('button').each(function() { this.leftMenu.$el.find('button').each(function() {
$(this).on('keydown', function (e) { $(this).on('keydown', function (e) {
if (Common.UI.Keys.RETURN === e.keyCode || Common.UI.Keys.SPACE === e.keyCode) { if (Common.UI.Keys.RETURN === e.keyCode || Common.UI.Keys.SPACE === e.keyCode) {
me.leftMenu.btnFile.toggle(false);
me.leftMenu.btnAbout.toggle(false); me.leftMenu.btnAbout.toggle(false);
this.blur(); this.blur();
@ -225,7 +224,6 @@ define([
if (close_menu) { if (close_menu) {
menu.hide(); menu.hide();
this.leftMenu.btnFile.toggle(false, true);
} }
}, },
@ -240,14 +238,12 @@ define([
if (btn == 'ok') { if (btn == 'ok') {
this.api.asc_DownloadAs(format); this.api.asc_DownloadAs(format);
menu.hide(); menu.hide();
this.leftMenu.btnFile.toggle(false, true);
} }
}, this) }, this)
}); });
} else { } else {
this.api.asc_DownloadAs(format); this.api.asc_DownloadAs(format);
menu.hide(); menu.hide();
this.leftMenu.btnFile.toggle(false, true);
} }
}, },
@ -276,7 +272,6 @@ define([
if (value!==null) this.api.asc_setLocale(parseInt(value)); if (value!==null) this.api.asc_setLocale(parseInt(value));
menu.hide(); menu.hide();
this.leftMenu.btnFile.toggle(false, true);
this.leftMenu.fireEvent('settings:apply'); this.leftMenu.fireEvent('settings:apply');
}, },
@ -291,14 +286,12 @@ define([
if (menu) { if (menu) {
menu.hide(); menu.hide();
this.leftMenu.btnFile.toggle(false, true);
} }
}, },
onOpenRecent: function(menu, url) { onOpenRecent: function(menu, url) {
if (menu) { if (menu) {
menu.hide(); menu.hide();
this.leftMenu.btnFile.toggle(false, true);
} }
var recentDocPage = window.open(url); var recentDocPage = window.open(url);
@ -309,15 +302,13 @@ define([
}, },
clickToolbarSettings: function(obj) { clickToolbarSettings: function(obj) {
if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == 'opts') this.leftMenu.showMenu('file:opts');
this.leftMenu.close(); },
else
this.leftMenu.showMenu('file:opts');
}, },
/** coauthoring begin **/ /** coauthoring begin **/
clickStatusbarUsers: function() { clickStatusbarUsers: function() {
this.leftMenu.btnFile.panel.panels['rights'].changeAccessRights(); this.leftMenu.menuFile.panels['rights'].changeAccessRights();
}, },
onHideChat: function() { onHideChat: function() {
@ -566,8 +557,6 @@ define([
if (this.api) { if (this.api) {
this.api.asc_closeCellEditor(); this.api.asc_closeCellEditor();
this.api.asc_enableKeyEvents(!state); this.api.asc_enableKeyEvents(!state);
if (!state) $(this.leftMenu.btnFile.el).blur();
} }
}, },
@ -593,12 +582,13 @@ define([
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
this.showSearchDlg(true,s); this.showSearchDlg(true,s);
this.leftMenu.btnSearch.toggle(true,true); this.leftMenu.btnSearch.toggle(true,true);
this.leftMenu.btnFile.toggle(false);
this.leftMenu.btnAbout.toggle(false); this.leftMenu.btnAbout.toggle(false);
this.leftMenu.menuFile.hide();
} }
return false; return false;
case 'save': case 'save':
if (this.mode.canDownload && !this.leftMenu.btnFile.isDisabled()) { if ( this.mode.canDownload ) {
if (this.mode.isDesktopApp && this.mode.isOffline) { if (this.mode.isDesktopApp && this.mode.isOffline) {
this.api.asc_DownloadAs(); this.api.asc_DownloadAs();
} else { } else {
@ -608,20 +598,22 @@ define([
} }
return false; return false;
case 'help': case 'help':
if (!this.leftMenu.btnFile.isDisabled()) { Common.UI.Menu.Manager.hideAll();
Common.UI.Menu.Manager.hideAll(); this.api.asc_closeCellEditor();
this.api.asc_closeCellEditor(); this.leftMenu.showMenu('file:help');
this.leftMenu.showMenu('file:help');
}
return false; return false;
case 'file': case 'file':
if (!this.leftMenu.btnFile.isDisabled()) { Common.UI.Menu.Manager.hideAll();
Common.UI.Menu.Manager.hideAll(); this.leftMenu.showMenu('file');
this.leftMenu.showMenu('file');
}
return false; return false;
case 'escape': case 'escape':
// if (!this.leftMenu.isOpened()) return true; if ( this.leftMenu.menuFile.isVisible() ) {
this.leftMenu.menuFile.hide();
return false;
}
var statusbar = SSE.getController('Statusbar'); var statusbar = SSE.getController('Statusbar');
var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]'); var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]');
if (menu_opened.length) { if (menu_opened.length) {
@ -635,7 +627,7 @@ define([
return false; return false;
} }
} }
if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || if ( this.leftMenu.btnAbout.pressed ||
($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed || this.leftMenu.btnComments.pressed) && this.api.isCellEdited!==true) { ($(e.target).parents('#left-menu').length || this.leftMenu.btnPlugins.pressed || this.leftMenu.btnComments.pressed) && this.api.isCellEdited!==true) {
this.leftMenu.close(); this.leftMenu.close();
Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); Common.NotificationCenter.trigger('layout:changed', 'leftmenu');
@ -670,7 +662,6 @@ define([
onCellsRange: function(status) { onCellsRange: function(status) {
var isRangeSelection = (status != Asc.c_oAscSelectionDialogType.None); var isRangeSelection = (status != Asc.c_oAscSelectionDialogType.None);
this.leftMenu.btnFile.setDisabled(isRangeSelection);
this.leftMenu.btnAbout.setDisabled(isRangeSelection); this.leftMenu.btnAbout.setDisabled(isRangeSelection);
this.leftMenu.btnSearch.setDisabled(isRangeSelection); this.leftMenu.btnSearch.setDisabled(isRangeSelection);
if (this.mode.canPlugins && this.leftMenu.panelPlugins) { if (this.mode.canPlugins && this.leftMenu.panelPlugins) {
@ -680,10 +671,8 @@ define([
}, },
onApiEditCell: function(state) { onApiEditCell: function(state) {
var isEditFormula = (state == Asc.c_oAscCellEditorState.editFormula); var isEditFormula = (state == Asc.c_oAscCellEditorState.editFormula);
this.leftMenu.btnFile.setDisabled(isEditFormula);
this.leftMenu.btnAbout.setDisabled(isEditFormula); this.leftMenu.btnAbout.setDisabled(isEditFormula);
this.leftMenu.btnSearch.setDisabled(isEditFormula); this.leftMenu.btnSearch.setDisabled(isEditFormula);
if (this.mode.canPlugins && this.leftMenu.panelPlugins) { if (this.mode.canPlugins && this.leftMenu.panelPlugins) {

View file

@ -1,6 +1,5 @@
<div id="view-left-menu" class="tool-menu left"> <div id="view-left-menu" class="tool-menu left">
<div class="tool-menu-btns"> <div class="tool-menu-btns">
<button id="left-btn-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon img-toolbarmenu btn-menu-file">&nbsp;</span></button>
<button id="left-btn-search" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-search">&nbsp;</i></button> <button id="left-btn-search" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-search">&nbsp;</i></button>
<!-- /** coauthoring begin **/ --> <!-- /** coauthoring begin **/ -->
<button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><i class="icon img-toolbarmenu btn-menu-comments">&nbsp;</i></button> <button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><i class="icon img-toolbarmenu btn-menu-comments">&nbsp;</i></button>

View file

@ -1,12 +1,12 @@
<div class="layout-region"> <div class="layout-region">
<div id="viewport-vbox-layout" class="layout-ct vbox"> <div id="viewport-vbox-layout" class="layout-ct vbox">
<div id="header" class="layout-item"></div> <section class="layout-ct">
<div class="layout-item" style="border-bottom: 1px solid #cbcbcb;display:none;"></div> <div id="file-menu-panel" class="toolbar-fullview-panel" style="display:none;"></div>
</section>
<div id="toolbar" class="layout-item"></div> <div id="toolbar" class="layout-item"></div>
<div class="layout-item"> <div class="layout-item">
<div id="viewport-hbox-layout" class="layout-ct hbox"> <div id="viewport-hbox-layout" class="layout-ct hbox">
<div id="left-menu" class="layout-item" style="width: 40px;"></div> <div id="left-menu" class="layout-item" style="width: 40px;"></div>
<div id="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div> <div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div class="layout-item"> <div class="layout-item">
<div class="layout-ct vbox"> <div class="layout-ct vbox">

View file

@ -289,6 +289,10 @@ define([
this.panels['info'].updateInfo(this.document); this.panels['info'].updateInfo(this.document);
}, },
isVisible: function () {
return !this.$el.is(':hidden');
},
btnSaveCaption : 'Save', btnSaveCaption : 'Save',
btnDownloadCaption : 'Download as...', btnDownloadCaption : 'Download as...',
btnInfoCaption : 'Document Info...', btnInfoCaption : 'Document Info...',

View file

@ -81,15 +81,6 @@ define([
el.html(this.template({ el.html(this.template({
})); }));
this.btnFile = new Common.UI.Button({
action: 'file',
el: $('#left-btn-file', this.el),
hint: this.tipFile + Common.Utils.String.platformKey('Alt+F'),
enableToggle: true,
disabled: true,
toggleGroup: 'leftMenuGroup'
});
this.btnSearch = new Common.UI.Button({ this.btnSearch = new Common.UI.Button({
action: 'search', action: 'search',
el: $('#left-btn-search', this.el), el: $('#left-btn-search', this.el),
@ -150,10 +141,9 @@ define([
this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this)); this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this));
this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this));
this.btnFile.on('toggle', _.bind(this.onBtnMenuToggle, this));
var menuFile = new SSE.Views.FileMenu({}); this.menuFile = new SSE.Views.FileMenu({});
this.btnFile.panel = menuFile.render(); this.menuFile.render();
this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Spreadsheet Editor'})).render(); this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Spreadsheet Editor'})).render();
return this; return this;
@ -161,15 +151,12 @@ define([
onBtnMenuToggle: function(btn, state) { onBtnMenuToggle: function(btn, state) {
if (state) { if (state) {
this.btnFile.pressed && this.fireEvent('file:show', this);
btn.panel['show'](); btn.panel['show']();
this.$el.width(SCALE_MIN); this.$el.width(SCALE_MIN);
if (this.btnSearch.isActive()) if (this.btnSearch.isActive())
this.btnSearch.toggle(false); this.btnSearch.toggle(false);
} else { } else {
(this.btnFile.id == btn.id) && this.fireEvent('file:hide', this);
btn.panel['hide'](); btn.panel['hide']();
} }
if (this.mode.isEdit) SSE.getController('Toolbar').DisableToolbar(state==true); if (this.mode.isEdit) SSE.getController('Toolbar').DisableToolbar(state==true);
@ -177,7 +164,6 @@ define([
}, },
onBtnMenuClick: function(btn, e) { onBtnMenuClick: function(btn, e) {
this.btnFile.toggle(false);
this.btnAbout.toggle(false); this.btnAbout.toggle(false);
if (btn.options.action == 'search') { if (btn.options.action == 'search') {
@ -248,7 +234,6 @@ define([
/** coauthoring end **/ /** coauthoring end **/
close: function(menu) { close: function(menu) {
this.btnFile.toggle(false);
this.btnAbout.toggle(false); this.btnAbout.toggle(false);
this.$el.width(SCALE_MIN); this.$el.width(SCALE_MIN);
/** coauthoring begin **/ /** coauthoring begin **/
@ -272,7 +257,7 @@ define([
}, },
isOpened: function() { isOpened: function() {
var isopened = this.btnFile.pressed || this.btnSearch.pressed; var isopened = this.btnSearch.pressed;
/** coauthoring begin **/ /** coauthoring begin **/
!isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed); !isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed);
/** coauthoring end **/ /** coauthoring end **/
@ -280,7 +265,6 @@ define([
}, },
disableMenu: function(menu, disable) { disableMenu: function(menu, disable) {
this.btnFile.setDisabled(false);
this.btnAbout.setDisabled(false); this.btnAbout.setDisabled(false);
this.btnSupport.setDisabled(false); this.btnSupport.setDisabled(false);
this.btnSearch.setDisabled(false); this.btnSearch.setDisabled(false);
@ -293,13 +277,8 @@ define([
showMenu: function(menu) { showMenu: function(menu) {
var re = /^(\w+):?(\w*)$/.exec(menu); var re = /^(\w+):?(\w*)$/.exec(menu);
if (re[1] == 'file' && this.btnFile.isVisible()) { if ( re[1] == 'file' ) {
if (!this.btnFile.pressed) { this.menuFile.show(re[2].length ? re[2] : undefined);
this.btnFile.toggle(true);
this.btnFile.$el.focus();
// this.onBtnMenuClick(this.btnFile);
}
this.btnFile.panel.show(re[2].length ? re[2] : undefined);
} else { } else {
/** coauthoring begin **/ /** coauthoring begin **/
if (menu == 'chat') { if (menu == 'chat') {
@ -326,7 +305,7 @@ define([
getMenu: function(type) { getMenu: function(type) {
switch (type) { switch (type) {
case 'file': return this.btnFile.panel; case 'file': return this.menuFile;
case 'about': return this.btnAbout.panel; case 'about': return this.btnAbout.panel;
default: return null; default: return null;
} }