[SSE] Add cut and select all buttons to the toolbar

This commit is contained in:
Julia Radzhabova 2022-06-29 14:34:58 +03:00
parent 3dbd3ba7f7
commit 15e9c655f9
6 changed files with 83 additions and 18 deletions

View file

@ -282,8 +282,8 @@ define([
if ( me.appConfig.isEditDiagram ) {
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
toolbar.btnInsertFormula.on('click', _.bind(this.onInsertFormulaMenu, this));
toolbar.btnInsertFormula.menu.on('item:click', _.bind(this.onInsertFormulaMenu, this));
toolbar.btnDecDecimal.on('click', _.bind(this.onDecrement, this));
@ -299,8 +299,8 @@ define([
if ( me.appConfig.isEditMailMerge ) {
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
toolbar.btnSearch.on('toggle', _.bind(this.onSearch, this));
toolbar.btnSortDown.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Ascending));
toolbar.btnSortUp.on('click', _.bind(this.onSortType, this, Asc.c_oAscSortOptions.Descending));
@ -310,8 +310,8 @@ define([
if ( me.appConfig.isEditOle ) {
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
toolbar.btnSearch.on('toggle', _.bind(this.onSearch, this));
toolbar.btnInsertFormula.on('click', _.bind(this.onInsertFormulaMenu, this));
toolbar.btnInsertFormula.menu.on('item:click', _.bind(this.onInsertFormulaMenu, this));
@ -361,8 +361,10 @@ define([
toolbar.btnUndo.on('disabled', _.bind(this.onBtnChangeState, this, 'undo:disabled'));
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnRedo.on('disabled', _.bind(this.onBtnChangeState, this, 'redo:disabled'));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, true));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, false));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
toolbar.btnCut.on('click', _.bind(this.onCopyPaste, this, 'cut'));
toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this));
toolbar.btnIncFontSize.on('click', _.bind(this.onIncreaseFontSize, this));
toolbar.btnDecFontSize.on('click', _.bind(this.onDecreaseFontSize, this));
toolbar.btnBold.on('click', _.bind(this.onBold, this));
@ -559,10 +561,10 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Redo');
},
onCopyPaste: function(copy, e) {
onCopyPaste: function(type, e) {
var me = this;
if (me.api) {
var res = (copy) ? me.api.asc_Copy() : me.api.asc_Paste();
var res = (type === 'cut') ? me.api.asc_Cut() : ((type === 'copy') ? me.api.asc_Copy() : me.api.asc_Paste());
if (!res) {
var value = Common.localStorage.getItem("sse-hide-copywarning");
if (!(value && parseInt(value) == 1)) {
@ -579,6 +581,14 @@ define([
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
},
onSelectAll: function(e) {
if (this.api)
this.api.asc_EditSelectAll();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Select All');
},
onIncreaseFontSize: function(e) {
if (this.api)
this.api.asc_increaseFontSize();

View file

@ -25,6 +25,14 @@
<span class="btn-slot" id="slot-btn-redo"></span>
</div>
</div>
<div class="group small">
<div class="elset">
<span class="btn-slot" id="slot-btn-cut"></span>
</div>
<div class="elset">
<span class="btn-slot" id="slot-btn-select-all"></span>
</div>
</div>
<div class="separator long"></div>
</section>
<section class="box-panels">

View file

@ -737,6 +737,25 @@ define([
]}
);
me.btnCut = new Common.UI.Button({
id: 'id-toolbar-btn-cut',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-cut',
lock: [_set.coAuth, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top',
dataHintTitle: 'X'
});
me.btnSelectAll = new Common.UI.Button({
id: 'id-toolbar-btn-select-all',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon select-all',
lock: [_set.disableOnStart],
dataHint: '1',
dataHintDirection: 'bottom'
});
me.cmbFontSize = new Common.UI.ComboBox({
cls : 'input-group-nr',
menuStyle : 'min-width: 55px;',
@ -2031,7 +2050,7 @@ define([
me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.btnCondFormat,
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
me.btnInsertChart, me.btnColorSchemas, me.btnInsertSparkline,
me.btnCopy, me.btnPaste, me.listStyles, me.btnPrint,
me.btnCopy, me.btnPaste, me.btnCut, me.btnSelectAll, me.listStyles, me.btnPrint,
/*me.btnSave,*/ me.btnClearStyle, me.btnCopyStyle,
me.btnPageMargins, me.btnPageSize, me.btnPageOrient, me.btnPrintArea, me.btnPrintTitles, me.btnImgAlign, me.btnImgBackward, me.btnImgForward, me.btnImgGroup, me.btnScale,
me.chPrintGridlines, me.chPrintHeadings, me.btnVisibleArea, me.btnVisibleAreaClose, me.btnTextFormatting, me.btnHorizontalAlign, me.btnVerticalAlign
@ -2183,6 +2202,8 @@ define([
_injectComponent('#slot-btn-redo', this.btnRedo);
_injectComponent('#slot-btn-copy', this.btnCopy);
_injectComponent('#slot-btn-paste', this.btnPaste);
_injectComponent('#slot-btn-cut', this.btnCut);
_injectComponent('#slot-btn-select-all', this.btnSelectAll);
_injectComponent('#slot-btn-incfont', this.btnIncFontSize);
_injectComponent('#slot-btn-decfont', this.btnDecFontSize);
_injectComponent('#slot-btn-bold', this.btnBold);
@ -2274,6 +2295,8 @@ define([
_updateHint(this.btnSave, this.btnSaveTip);
_updateHint(this.btnCopy, this.tipCopy + Common.Utils.String.platformKey('Ctrl+C'));
_updateHint(this.btnPaste, this.tipPaste + Common.Utils.String.platformKey('Ctrl+V'));
_updateHint(this.btnCut, this.tipCut + Common.Utils.String.platformKey('Ctrl+X'));
_updateHint(this.btnSelectAll, this.tipSelectAll + Common.Utils.String.platformKey('Ctrl+A'));
_updateHint(this.btnUndo, this.tipUndo + Common.Utils.String.platformKey('Ctrl+Z'));
_updateHint(this.btnRedo, this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y'));
_updateHint(this.btnIncFontSize, this.tipIncFont + Common.Utils.String.platformKey('Ctrl+]'));
@ -3279,6 +3302,8 @@ define([
textDone: 'Done',
tipTextFormatting: 'More text formatting tools',
tipHAligh: 'Horizontal Align',
tipVAligh: 'Vertical Align'
tipVAligh: 'Vertical Align',
tipSelectAll: 'Select all',
tipCut: 'Cut'
}, SSE.Views.Toolbar || {}));
});

View file

@ -129,7 +129,7 @@
right: 0;
top: 0;
bottom: 0;
left: 763px;
left: 854px;
width: inherit;
height: 44px;
}
@ -299,8 +299,8 @@
<div class="spacer"></div><div class="circle"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><div class="spacer"></div></div>
</div>
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/></ul>
<ul><li class="compact" style="width: 30px;display: none;"></li><li class="compact space" style="display: none;"></li><li class="compact" style="width: 90px;display: none;"></li><li class="not-compact" style="width: 63px;"></li><li class="space"/><li style="width: 223px;"/><li class="space"/><li style="width: 146px;"/><li class="space"/><li style="width: 244px;"/><li class="space"/><li style="width: 118px;"/><li class="fat"/></ul>
<ul><li class="compact" style="width: 30px;display: none;"></li><li class="compact space" style="display: none;"></li><li class="compact" style="width: 90px;display: none;"></li><li class="not-compact" style="width: 63px;"></li><li class="space"/><li style="width: 223px;"/><li class="space"/><li style="width: 146px;"/><li class="space"/><li style="width: 244px;"/><li class="space"/><li style="width: 118px;"/></ul>
</div>
<div class="skformula" style="display: none;">
<ul><li/><li/></ul>
@ -337,6 +337,16 @@
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (compact) {
document.querySelectorAll('.not-compact').forEach(function(item){
item.remove();
});
document.querySelectorAll('.compact').forEach(function(item){
item.style.display = 'inline-block';
});
document.querySelector('.fat').style.left = '923px';
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.skformula').style.display = 'block';

View file

@ -108,7 +108,7 @@
right: 0;
top: 0;
bottom: 0;
left: 763px;
left: 854px;
width: inherit;
height: 44px;
}
@ -278,8 +278,8 @@
<div class="spacer"></div><div class="circle"></div></div><div><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><span class="rect"></span><div class="spacer"></div></div>
</div>
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li style="width: 219px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li style="width: 340px;"/></ul>
<ul><li class="compact" style="width: 30px;display: none;"></li><li class="compact space" style="display: none;"></li><li class="compact" style="width: 90px;display: none;"></li><li class="not-compact" style="width: 63px;"></li><li class="space"/><li style="width: 223px;"/><li class="space"/><li style="width: 146px;"/><li class="space"/><li style="width: 244px;"/><li class="space"/><li style="width: 118px;"/><li class="fat"/></ul>
<ul><li class="compact" style="width: 30px;display: none;"></li><li class="compact space" style="display: none;"></li><li class="compact" style="width: 90px;display: none;"></li><li class="not-compact" style="width: 63px;"></li><li class="space"/><li style="width: 223px;"/><li class="space"/><li style="width: 146px;"/><li class="space"/><li style="width: 244px;"/><li class="space"/><li style="width: 118px;"/></ul>
</div>
<div class="skformula" style="display: none;">
<ul><li/><li/></ul>
@ -323,6 +323,16 @@
document.querySelector('.brendpanel > :nth-child(1)').style.height = '28px';
}
if (compact) {
document.querySelectorAll('.not-compact').forEach(function(item){
item.remove();
});
document.querySelectorAll('.compact').forEach(function(item){
item.style.display = 'inline-block';
});
document.querySelector('.fat').style.left = '923px';
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.skformula').style.display = 'block';

View file

@ -3596,6 +3596,8 @@
"SSE.Views.Toolbar.txtTime": "Time",
"SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells",
"SSE.Views.Toolbar.txtYen": "¥ Yen",
"SSE.Views.Toolbar.tipSelectAll": "Select all cells in this sheet",
"SSE.Views.Toolbar.tipCut": "Cut",
"SSE.Views.Top10FilterDialog.textType": "Show",
"SSE.Views.Top10FilterDialog.txtBottom": "Bottom",
"SSE.Views.Top10FilterDialog.txtBy": "by",