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

This commit is contained in:
Julia Radzhabova 2022-06-29 13:53:43 +03:00
parent 793f350a07
commit 3dbd3ba7f7
7 changed files with 83 additions and 16 deletions
apps
documenteditor/main/app/view
presentationeditor/main

View file

@ -259,7 +259,7 @@ define([
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],
lock: [_set.copyLock, _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.imageLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top',
dataHintTitle: 'X'

View file

@ -284,8 +284,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.btnBold.on('click', _.bind(this.onBold, this));
@ -717,7 +719,7 @@ define([
this._state.no_slides = (count<=0);
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, {array: [
this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnPrint, this.toolbar.btnCopy, this.toolbar.btnPaste,
this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnPrint, this.toolbar.btnCopy, this.toolbar.btnCut, this.toolbar.btnSelectAll, this.toolbar.btnPaste,
this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertChart,
this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign,
this.toolbar.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme, this.toolbar.btnEditHeader, this.toolbar.btnInsDateTime, this.toolbar.btnInsSlideNum
@ -1109,10 +1111,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("pe-hide-copywarning")) {
(new Common.Views.CopyWarningDialog({
@ -1128,6 +1130,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();

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

@ -274,6 +274,27 @@ define([
});
me.paragraphControls.push(me.btnPaste);
me.btnCut = new Common.UI.Button({
id: 'id-toolbar-btn-cut',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-cut',
lock: [_set.slideDeleted, _set.paragraphLock, _set.shapeLock, _set.slideLock, _set.lostConnect, _set.noSlides, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top',
dataHintTitle: 'X'
});
me.paragraphControls.push(me.btnCut);
me.btnSelectAll = new Common.UI.Button({
id: 'id-toolbar-btn-select-all',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon select-all',
lock: [_set.noSlides, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'bottom'
});
me.slideOnlyControls.push(me.btnSelectAll);
me.cmbFontName = new Common.UI.ComboBoxFonts({
cls: 'input-group-nr',
menuCls: 'scrollable-menu',
@ -1100,7 +1121,7 @@ define([
});
this.lockControls = [this.btnChangeSlide, this.btnSave,
this.btnCopy, this.btnPaste, this.btnUndo, this.btnRedo, this.cmbFontName, this.cmbFontSize, this.btnIncFontSize, this.btnDecFontSize,
this.btnCopy, this.btnPaste, this.btnCut, this.btnSelectAll,this.btnUndo, this.btnRedo, this.cmbFontName, this.cmbFontSize, this.btnIncFontSize, this.btnDecFontSize,
this.btnBold, this.btnItalic, this.btnUnderline, this.btnStrikeout, this.btnSuperscript, this.btnChangeCase, this.btnHighlightColor,
this.btnSubscript, this.btnFontColor, this.btnClearStyle, this.btnCopyStyle, this.btnMarkers,
this.btnNumbers, this.btnDecLeftOffset, this.btnIncLeftOffset, this.btnLineSpace, this.btnHorizontalAlign, this.btnColumns,
@ -1206,6 +1227,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-bold', this.btnBold);
_injectComponent('#slot-btn-italic', this.btnItalic);
_injectComponent('#slot-btn-underline', this.btnUnderline);
@ -1338,6 +1361,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'));
@ -2031,7 +2056,9 @@ define([
tipMarkersDash: 'Dash bullets',
tipNone: 'None',
textTabView: 'View',
mniInsertSSE: 'Insert Spreadsheet'
mniInsertSSE: 'Insert Spreadsheet',
tipSelectAll: 'Select all',
tipCut: 'Cut'
}
}()), PE.Views.Toolbar || {}));
});

View file

@ -121,7 +121,7 @@
}
.loadmask > .sktoolbar li.big {
width: 55px;
width: 50px;
height: 46px;
margin-top: -46px;
}
@ -131,7 +131,7 @@
right: 0;
top: 0;
bottom: 0;
left: 758px;
left: 800px;
width: inherit;
height: 44px;
}
@ -287,8 +287,8 @@
<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><div class="spacer"></div></div>
</div>
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space" style="width: 76px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space" style="width: 183px;"/><li style="width: 95px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li class="big" style="width: 70px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space"/><li class="big"/><li class="big"/><li class="big"/><li style="width: 95px;"/></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" style="width: 54px;"/><li class="split" /><li class="space"/><li style="width: 216px;"/><li class="space"/><li style="width: 136px;"/><li class="space" style="width: 168px;"/><li class="space"/><li style="width: 65px;"/><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 class="big" style="width: 48px;"/><li class="split" /><li class="space"/><li style="width: 216px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li class="big"/><li class="big"/><li class="big"/><li class="space"/><li style="width: 65px;"/></ul>
</div>
<div class="placeholder" style="display: none;">
<div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div>
@ -316,6 +316,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 = '868px';
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.placeholder').style.display = 'block';

View file

@ -109,7 +109,7 @@
}
.loadmask > .sktoolbar li.big {
width: 55px;
width: 50px;
height: 46px;
margin-top: -46px;
}
@ -119,7 +119,7 @@
right: 0;
top: 0;
bottom: 0;
left: 758px;
left: 800px;
width: inherit;
height: 44px;
}
@ -275,8 +275,8 @@
<div><div class="loading-logo"><img src="../../../apps/presentationeditor/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><div class="spacer"></div></div>
</div>
<div class="sktoolbar" style="display: none;">
<ul><li/><li class="space" style="width: 76px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space" style="width: 183px;"/><li style="width: 95px;"/><li class="fat"/></ul>
<ul><li/><li class="space"/><li class="big" style="width: 70px;"/><li class="split" /><li class="space"/><li style="width: 176px;"/><li class="space"/><li style="width: 115px;"/><li class="space"/><li class="big"/><li class="big"/><li class="big"/><li style="width: 95px;"/></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" style="width: 54px;"/><li class="split" /><li class="space"/><li style="width: 216px;"/><li class="space"/><li style="width: 136px;"/><li class="space" style="width: 168px;"/><li class="space"/><li style="width: 65px;"/><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 class="big" style="width: 48px;"/><li class="split" /><li class="space"/><li style="width: 216px;"/><li class="space"/><li style="width: 136px;"/><li class="space"/><li class="big"/><li class="big"/><li class="big"/><li class="space"/><li style="width: 65px;"/></ul>
</div>
<div class="placeholder" style="display: none;">
<div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div>
@ -310,6 +310,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 = '868px';
}
visible && (document.querySelector('.brendpanel').style.display = 'block');
!(view || notoolbar) && (document.querySelector('.sktoolbar').style.display = 'block');
document.querySelector('.placeholder').style.display = 'block';

View file

@ -2319,6 +2319,8 @@
"PE.Views.Toolbar.txtScheme9": "Foundry",
"PE.Views.Toolbar.txtSlideAlign": "Align to Slide",
"PE.Views.Toolbar.txtUngroup": "Ungroup",
"PE.Views.Toolbar.tipSelectAll": "Select all",
"PE.Views.Toolbar.tipCut": "Cut",
"PE.Views.Transitions.strDelay": "Delay",
"PE.Views.Transitions.strDuration": "Duration",
"PE.Views.Transitions.strStartOnClick": "Start On Click",