[PE] Add buttons for editing header/footer

This commit is contained in:
Julia Radzhabova 2019-06-26 18:38:04 +03:00
parent 25af48bfe9
commit 7dd267c03e
3 changed files with 71 additions and 3 deletions

View file

@ -309,6 +309,9 @@ define([
toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this));
toolbar.listTheme.on('click', _.bind(this.onListThemeSelect, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
toolbar.btnEditHeader.on('click', _.bind(this.onEditHeaderClick, this, 'header'));
toolbar.btnInsDateTime.on('click', _.bind(this.onEditHeaderClick, this, 'datetime'));
toolbar.btnInsSlideNum.on('click', _.bind(this.onEditHeaderClick, this, 'slidenum'));
this.onSetupCopyStyleButton();
},
@ -619,7 +622,7 @@ define([
this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnPrint, this.toolbar.btnCopy, 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.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme, this.toolbar.btnEditHeader, this.toolbar.btnInsDateTime, this.toolbar.btnInsSlideNum
]});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides,
{ array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape, this.toolbar.btnInsertEquation, this.toolbar.btnInsertTextArt) });
@ -674,13 +677,14 @@ define([
if (paragraph_locked!==undefined && this._state.prcontrolsdisable !== paragraph_locked) {
if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked;
this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls.concat(me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum)});
}
if (this._state.no_paragraph !== no_paragraph) {
if (this._state.activated) this._state.no_paragraph = no_paragraph;
this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: [me.toolbar.btnCopyStyle]});
this.toolbar.lockToolbar(PE.enumLock.paragraphLock, !no_paragraph && this._state.prcontrolsdisable, {array: [me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum]});
}
if (this._state.no_text !== no_text) {
@ -1443,6 +1447,25 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
},
onEditHeaderClick: function(type, e) {
var selectedElements = this.api.getSelectedElements(),
in_text = false;
for (var i=0; i < selectedElements.length; i++) {
if (selectedElements[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) {
in_text = true;
break;
}
}
if (in_text && type=='slidenum') {
this.api.asc_addSlideNumber();
} else if (in_text && type=='datetime') {
//insert date time
} else {
//insert header/footer
}
},
onClearStyleClick: function(btn, e) {
if (this.api)
this.api.ClearFormating();

View file

@ -121,6 +121,12 @@
<span class="btn-slot text x-huge" id="slot-btn-insertlink"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-editheader"></span>
<span class="btn-slot text x-huge" id="slot-btn-datetime"></span>
<span class="btn-slot text x-huge" id="slot-btn-slidenum"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-insertequation"></span>
</div>

View file

@ -571,6 +571,33 @@ define([
});
me.slideOnlyControls.push(me.btnInsertTextArt);
me.btnEditHeader = new Common.UI.Button({
id: 'id-toolbar-btn-editheader',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-editheader',
caption: me.capBtnInsHeader,
lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart]
});
me.slideOnlyControls.push(me.btnEditHeader);
me.btnInsDateTime = new Common.UI.Button({
id: 'id-toolbar-btn-datetime',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-editheader',
caption: me.capBtnDateTime,
lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.paragraphLock, _set.disableOnStart]
});
me.slideOnlyControls.push(me.btnInsDateTime);
me.btnInsSlideNum = new Common.UI.Button({
id: 'id-toolbar-btn-slidenum',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-editheader',
caption: me.capBtnSlideNum,
lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.paragraphLock, _set.disableOnStart]
});
me.slideOnlyControls.push(me.btnInsSlideNum);
me.btnColorSchemas = new Common.UI.Button({
id: 'id-toolbar-btn-colorschemas',
cls: 'btn-toolbar',
@ -917,6 +944,9 @@ define([
_injectComponent('#slot-btn-colorschemas', this.btnColorSchemas);
_injectComponent('#slot-btn-slidesize', this.btnSlideSize);
_injectComponent('#slot-field-styles', this.listTheme);
_injectComponent('#slot-btn-editheader', this.btnEditHeader);
_injectComponent('#slot-btn-datetime', this.btnInsDateTime);
_injectComponent('#slot-btn-slidenum', this.btnInsSlideNum);
this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg'), 'tlbtn-insertimage-', 'btn-insertimage', this.capInsertImage,
[PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true);
@ -1024,6 +1054,9 @@ define([
this.btnShapeAlign.updateHint(this.tipShapeAlign);
this.btnShapeArrange.updateHint(this.tipShapeArrange);
this.btnSlideSize.updateHint(this.tipSlideSize);
this.btnEditHeader.updateHint(this.tipEditHeader);
this.btnInsDateTime.updateHint(this.tipDateTime);
this.btnInsSlideNum.updateHint(this.tipSlideNum);
// set menus
@ -1654,7 +1687,13 @@ define([
textTabProtect: 'Protection',
mniImageFromStorage: 'Image from Storage',
txtSlideAlign: 'Align to Slide',
txtObjectsAlign: 'Align Selected Objects'
txtObjectsAlign: 'Align Selected Objects',
tipEditHeader: 'Edit Header or Footer',
tipSlideNum: 'Insert slide number',
tipDateTime: 'Insert current date and time',
capBtnInsHeader: 'Header/Footer',
capBtnSlideNum: 'Slide Number',
capBtnDateTime: 'Date & Time'
}
}()), PE.Views.Toolbar || {}));
});