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

This commit is contained in:
Julia Radzhabova 2022-06-29 12:37:51 +03:00
parent d0413a7115
commit 793f350a07
6 changed files with 79 additions and 12 deletions

View file

@ -268,8 +268,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.onIncrease, this));
toolbar.btnDecFontSize.on('click', _.bind(this.onDecrease, this));
toolbar.mnuChangeCase.on('item:click', _.bind(this.onChangeCase, this));
@ -515,7 +517,7 @@ define([
onApiCanCopyCut: function(can) {
if (this._state.can_copycut !== can) {
this.toolbar.lockToolbar(Common.enumLock.copyLock, !can, {array: [this.toolbar.btnCopy]});
this.toolbar.lockToolbar(Common.enumLock.copyLock, !can, {array: [this.toolbar.btnCopy, this.toolbar.btnCut]});
this._state.can_copycut = can;
}
},
@ -1101,10 +1103,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.Copy() : me.api.Paste();
var res = (type === 'cut') ? me.api.Cut() : ((type === 'copy') ? me.api.Copy() : me.api.Paste());
if (!res) {
if (!Common.localStorage.getBool("de-hide-copywarning")) {
(new Common.Views.CopyWarningDialog({
@ -1120,6 +1122,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');
},
onIncrease: function(e) {
if (this.api)
this.api.FontSizeIn();
@ -2883,7 +2893,7 @@ define([
this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false);
this.toolbar.lockToolbar(Common.enumLock.undoLock, this._state.can_undo!==true, {array: [this.toolbar.btnUndo]});
this.toolbar.lockToolbar(Common.enumLock.redoLock, this._state.can_redo!==true, {array: [this.toolbar.btnRedo]});
this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copycut!==true, {array: [this.toolbar.btnCopy]});
this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copycut!==true, {array: [this.toolbar.btnCopy, this.toolbar.btnCut]});
this.toolbar.lockToolbar(Common.enumLock.mmergeLock, !!this._state.mmdisable, {array: [this.toolbar.btnMailRecepients]});
if (!this._state.mmdisable) {
this.toolbar.mnuMailRecepients.items[2].setVisible(this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestMailMergeRecipients);

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

@ -255,6 +255,27 @@ define([
});
this.paragraphControls.push(this.btnPaste);
this.btnCut = new Common.UI.Button({
id: 'id-toolbar-btn-cut',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-cut',
lock: [_set.copyLock, _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top',
dataHintTitle: 'X'
});
this.paragraphControls.push(this.btnCut);
this.btnSelectAll = new Common.UI.Button({
id: 'id-toolbar-btn-select-all',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon select-all',
lock: [_set.viewFormMode, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'bottom'
});
this.toolbarControls.push(this.btnSelectAll);
this.btnIncFontSize = new Common.UI.Button({
id: 'id-toolbar-btn-incfont',
cls: 'btn-toolbar',
@ -1652,6 +1673,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);
@ -1952,6 +1975,8 @@ define([
this.btnRedo.updateHint(this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y'));
this.btnCopy.updateHint(this.tipCopy + Common.Utils.String.platformKey('Ctrl+C'));
this.btnPaste.updateHint(this.tipPaste + Common.Utils.String.platformKey('Ctrl+V'));
this.btnCut.updateHint(this.tipCut + Common.Utils.String.platformKey('Ctrl+X'));
this.btnSelectAll.updateHint(this.tipSelectAll + Common.Utils.String.platformKey('Ctrl+A'));
this.btnIncFontSize.updateHint(this.tipIncFont + Common.Utils.String.platformKey('Ctrl+]'));
this.btnDecFontSize.updateHint(this.tipDecFont + Common.Utils.String.platformKey('Ctrl+['));
this.btnBold.updateHint(this.textBold + Common.Utils.String.platformKey('Ctrl+B'));
@ -2837,7 +2862,9 @@ define([
textTabView: 'View',
mniRemoveHeader: 'Remove Header',
mniRemoveFooter: 'Remove Footer',
mniInsertSSE: 'Insert Spreadsheet'
mniInsertSSE: 'Insert Spreadsheet',
tipSelectAll: 'Select all',
tipCut: 'Cut'
}
})(), DE.Views.Toolbar || {}));
});

View file

@ -139,7 +139,7 @@
right: 0;
top: 0;
bottom: 0;
left: 525px;
left: 587px;
width: inherit;
height: 44px;
}
@ -272,8 +272,8 @@
<div class="brendpanel" style="display: none;">
<div><div class="loading-logo"><img src="../../common/main/resources/img/header/header-logo_s.svg"></div><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></div></div>
<div class="sktoolbar" style="display: none;">
<ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li><li class="fat"></li></ul>
<ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li></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><li style="width: 212px;"></li><li class="space"></li><li style="width: 200px;"></li><li class="space"></li><li style="width: 63px;"></li><li class="fat"></li></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><li style="width: 212px;"></li><li class="space"></li><li style="width: 200px;"></li><li class="space"></li><li style="width: 63px;"></li></ul>
</div>
<div class="placeholder" style="display: none;">
<div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div>
@ -301,6 +301,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 = '655px';
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view && (params["toolbar"] !== 'true') || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
view && (document.querySelector('.placeholder').style.marginTop = '19px');

View file

@ -117,7 +117,7 @@
right: 0;
top: 0;
bottom: 0;
left: 525px;
left: 587px;
width: inherit;
height: 44px;
}
@ -236,7 +236,7 @@
<body>
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
<div id="loading-mask" class="loadmask"><div class="brendpanel" style="display: none;"><div><div class="loading-logo"><img src="../../../apps/documenteditor/main/resources/img/header/header-logo_s.svg"></div><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></div></div><div class="sktoolbar" style="display: none;"><ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li><li class="fat"></li></ul><ul><li></li><li class="space"></li><li style="width: 209px;"></li><li class="space"></li><li style="width: 187px;"></li><li class="space"></li><li style="width: 60px;"></li></ul></div><div class="placeholder" style="display: none;"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div></div>
<div id="loading-mask" class="loadmask"><div class="brendpanel" style="display: none;"><div><div class="loading-logo"><img src="../../../apps/documenteditor/main/resources/img/header/header-logo_s.svg"></div><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></div></div><div class="sktoolbar" style="display: none;"><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><li style="width: 212px;"></li><li class="space"></li><li style="width: 200px;"></li><li class="space"></li><li style="width: 63px;"></li><li class="fat"></li></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><li style="width: 212px;"></li><li class="space"></li><li style="width: 200px;"></li><li class="space"></li><li style="width: 63px;"></li></ul></div><div class="placeholder" style="display: none;"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div></div>
<div id="viewport"></div>
<script>
@ -265,6 +265,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 = '655px';
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view && (params["toolbar"] !== 'true') || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
view && (document.querySelector('.placeholder').style.marginTop = '19px');

View file

@ -2907,6 +2907,8 @@
"DE.Views.Toolbar.txtScheme7": "Equity",
"DE.Views.Toolbar.txtScheme8": "Flow",
"DE.Views.Toolbar.txtScheme9": "Foundry",
"DE.Views.Toolbar.tipSelectAll": "Select all",
"DE.Views.Toolbar.tipCut": "Cut",
"DE.Views.ViewTab.textAlwaysShowToolbar": "Always show toolbar",
"DE.Views.ViewTab.textDarkDocument": "Dark document",
"DE.Views.ViewTab.textFitToPage": "Fit To Page",