mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-27 05:39:31 +08:00
added other options
This commit is contained in:
@ -1698,43 +1698,71 @@ define([
|
||||
Common.component.Analytics.trackEvent('ToolBar', 'Cell delete');
|
||||
},
|
||||
|
||||
onShowBeforeCellFormat: function(cmp, item, e) {
|
||||
if (cmp.mnuShowSheets.menu.items.length>0) return;
|
||||
|
||||
cmp.btnFormatCell.menu.items[0].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
cmp.btnFormatCell.menu.items[1].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
cmp.btnFormatCell.menu.items[3].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
cmp.btnFormatCell.menu.items[4].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
cmp.btnFormatCell.menu.items[4].menu.items[2].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
|
||||
let hiddenItems = SSE.getController('Statusbar').statusbar.tabMenu.items[5].menu.items;
|
||||
cmp.mnuShowSheets.menu.removeAll();
|
||||
hiddenItems.forEach(item => {
|
||||
cmp.mnuShowSheets.menu.addItem(new Common.UI.MenuItem({
|
||||
style: 'white-space: pre-wrap',
|
||||
caption: item.caption,
|
||||
value: 'showSheet',
|
||||
sheetId: item.value
|
||||
}))
|
||||
})
|
||||
onShowBeforeCellFormat: function(cmp, item, e) {
|
||||
|
||||
// if (cmp.mnuShowSheets.menu.items.length>0) return;
|
||||
|
||||
// cmp.btnFormatCell.menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
// cmp.btnFormatCell.menu.items[0].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
// cmp.btnFormatCell.menu.items[1].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
// cmp.btnFormatCell.menu.items[3].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
// cmp.btnFormatCell.menu.items[4].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
// cmp.btnFormatCell.menu.items[4].menu.items[2].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
|
||||
// let hiddenItems = SSE.getController('Statusbar').statusbar.tabMenu.items[5].menu.items;
|
||||
// cmp.mnuShowSheets.menu.removeAll();
|
||||
// hiddenItems.forEach(item => {
|
||||
// cmp.mnuShowSheets.menu.addItem(new Common.UI.MenuItem({
|
||||
// style: 'white-space: pre-wrap',
|
||||
// caption: item.caption,
|
||||
// value: 'showSheet',
|
||||
// sheetId: item.value
|
||||
// }))
|
||||
// })
|
||||
// console.log(Common.NotificationCenter);
|
||||
|
||||
|
||||
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
// Common.component.Analytics.trackEvent('ToolBar', 'Cell delete');
|
||||
},
|
||||
|
||||
onCellFormatMenu: function(menu, item, e) {
|
||||
if (!this.api) return;
|
||||
|
||||
if (['row-height', 'column-width', 'auto-row-height', 'auto-column-width'].includes(item.value))
|
||||
SSE.getController('DocumentHolder').onSetSize(menu, item);
|
||||
if (item.value === 'hideCell')
|
||||
this.api[item.options.isRowMenu ? 'asc_hideRows' : 'asc_hideColumns']();
|
||||
if (item.value === 'showCell')
|
||||
this.api[item.options.isRowMenu ? 'asc_showRows' : 'asc_showColumns']();
|
||||
if (item.value === 'hideSheet')
|
||||
SSE.getController('Statusbar').hideWorksheet(true, [this.api.asc_getActiveWorksheetIndex()]);
|
||||
if (item.value === 'showSheet') {
|
||||
SSE.getController('Statusbar').hideWorksheet(false, item.options.sheetId);
|
||||
|
||||
switch (item.value) {
|
||||
case 'row-height':
|
||||
case 'column-width':
|
||||
case 'auto-row-height':
|
||||
case 'auto-column-width':
|
||||
SSE.getController('DocumentHolder').onSetSize(menu, item);
|
||||
break;
|
||||
case 'hideCell':
|
||||
this.api[item.options.isRowMenu ? 'asc_hideRows' : 'asc_hideColumns']();
|
||||
break;
|
||||
case 'showCell':
|
||||
this.api[item.options.isRowMenu ? 'asc_showRows' : 'asc_showColumns']();
|
||||
break;
|
||||
case 'hideSheet':
|
||||
SSE.getController('Statusbar').hideWorksheet(true, [this.api.asc_getActiveWorksheetIndex()]);
|
||||
break;
|
||||
case 'showSheet':
|
||||
SSE.getController('Statusbar').hideWorksheet(false, item.options.sheetId);
|
||||
break;
|
||||
case 'renameSheet':
|
||||
SSE.getController('Statusbar').statusbar.fireEvent('sheet:changename');
|
||||
break;
|
||||
case 'moveCopySheet':
|
||||
SSE.getController('Statusbar').moveWorksheet([this.api.asc_getActiveWorksheetIndex()]);
|
||||
break;
|
||||
case 'protectSheet':
|
||||
Common.NotificationCenter.trigger('protect:sheet', !this.api.asc_isProtectedSheet());
|
||||
break;
|
||||
case 'lockedCell':
|
||||
this.api.asc_setCellLocked(false);
|
||||
break;
|
||||
case 'formatCells':
|
||||
SSE.getController('RightMenu').onRightMenuOpen(Common.Utils.documentSettingsType.Cell);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
@ -2662,6 +2690,29 @@ define([
|
||||
this.api.asc_isLayoutLocked(currentSheet) ? this.onApiLockDocumentProps(currentSheet) : this.onApiUnLockDocumentProps(currentSheet);
|
||||
this.toolbar.lockToolbar(Common.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(currentSheet), {array: [this.toolbar.btnPrintArea]});
|
||||
this.toolbar.lockToolbar(Common.enumLock.pageBreakLock, this.api.asc_GetPageBreaksDisableType(currentSheet)===Asc.c_oAscPageBreaksDisableType.all, {array: [this.toolbar.btnPageBreak]});
|
||||
|
||||
if (this.toolbar.mnuShowSheets) {
|
||||
if (!this.toolbar.mnuShowSheets.menu.items.length>0) {
|
||||
this.toolbar.btnFormatCell.menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
this.toolbar.btnFormatCell.menu.items[0].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
this.toolbar.btnFormatCell.menu.items[1].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
this.toolbar.btnFormatCell.menu.items[3].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
this.toolbar.btnFormatCell.menu.items[4].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
this.toolbar.btnFormatCell.menu.items[4].menu.items[2].menu.on('item:click', _.bind(this.onCellFormatMenu, this));
|
||||
}
|
||||
|
||||
let hiddenItems = SSE.getController('Statusbar').statusbar.tabMenu.items[5].menu.items;
|
||||
this.toolbar.mnuShowSheets.menu.removeAll();
|
||||
hiddenItems.forEach(item => {
|
||||
this.toolbar.mnuShowSheets.menu.addItem(new Common.UI.MenuItem({
|
||||
style: 'white-space: pre-wrap',
|
||||
caption: item.caption,
|
||||
value: 'showSheet',
|
||||
sheetId: item.value
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onUpdateDocumentProps: function(nIndex) {
|
||||
@ -3899,6 +3950,10 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
if (this.toolbar) {
|
||||
updateColors(this.toolbar.mnuTabColorToolbar, 1);
|
||||
}
|
||||
|
||||
updateColors(this.toolbar.mnuTextColorPicker, Common.Utils.ThemeColor.getStandartColors()[1]);
|
||||
if (this.toolbar.btnTextColor.currentColor === undefined || !this.toolbar.btnTextColor.currentColor.isAuto) {
|
||||
this.toolbar.btnTextColor.currentColor=Common.Utils.ThemeColor.getStandartColors()[1];
|
||||
|
||||
@ -54,7 +54,8 @@ define([
|
||||
'common/main/lib/component/ComboBoxFonts',
|
||||
'common/main/lib/component/ComboDataView'
|
||||
,'common/main/lib/component/SynchronizeTip'
|
||||
,'common/main/lib/component/Mixtbar'
|
||||
,'common/main/lib/component/Mixtbar',
|
||||
'common/main/lib/component/ThemeColorPalette'
|
||||
], function (Backbone, template, simple, template_view) { 'use strict';
|
||||
|
||||
if (!Common.enumLock)
|
||||
@ -3339,7 +3340,7 @@ define([
|
||||
menuAlign : 'tl-tr',
|
||||
style: 'min-width: auto;',
|
||||
items: []
|
||||
})
|
||||
})
|
||||
})
|
||||
]
|
||||
})
|
||||
@ -3347,7 +3348,7 @@ define([
|
||||
{caption: '--'},
|
||||
{
|
||||
caption : this.textRenameSheet,
|
||||
value : 'rename'
|
||||
value : 'renameSheet'
|
||||
},
|
||||
{
|
||||
caption : this.textMoveCopySheet,
|
||||
@ -3356,6 +3357,18 @@ define([
|
||||
{
|
||||
caption : this.textTabColor,
|
||||
value : 'fillColor',
|
||||
menu : new Common.UI.Menu({
|
||||
menuAlign: 'tl-tr',
|
||||
cls: 'color-tab',
|
||||
items: [
|
||||
{ template: _.template('<div id="id-toolbar-menu-tab-color" style="width: 164px;display: inline-block;"></div>') },
|
||||
{ caption: '--' },
|
||||
{
|
||||
id: "id-toolbar-menu-new-color",
|
||||
template: _.template('<a tabindex="-1" type="menuitem" style="' + (this.isRtlSheet ? 'padding-right: 12px;' : 'padding-left: 12px;') + '">' + this.textNewColor + '</a>')
|
||||
}
|
||||
]
|
||||
})
|
||||
},
|
||||
{
|
||||
caption : this.textProtectSheet,
|
||||
@ -3374,7 +3387,20 @@ define([
|
||||
value : 'formatCells',
|
||||
},
|
||||
]
|
||||
}) )
|
||||
}).on('render:after', _.bind(function(menu) {
|
||||
this.mnuTabColorToolbar = new Common.UI.ThemeColorPalette({
|
||||
el: $('#id-toolbar-menu-tab-color'),
|
||||
outerMenu: { menu: menu, index: 0, focusOnShow: true },
|
||||
transparent: true
|
||||
});
|
||||
menu.setInnerMenu([{ menu: this.mnuTabColorToolbar, index: 0 }]);
|
||||
this.mnuTabColorToolbar.on('select', _.bind(function(picker, color) {
|
||||
SSE.getController('Statusbar').statusbar.fireEvent('sheet:setcolor', [color]);
|
||||
setTimeout(_.bind(function() {
|
||||
menu.hide();
|
||||
}, this), 1);
|
||||
}, this));
|
||||
}, this)) )
|
||||
}
|
||||
|
||||
if (!this.mode.isEditMailMerge && !this.mode.isEditDiagram && !this.mode.isEditOle)
|
||||
|
||||
Reference in New Issue
Block a user