@syncfusion/ej2-documenteditor
Version:
Feature-rich document editor control with built-in support for context menu, options pane and dialogs.
103 lines (102 loc) • 4.63 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { RibbonGroupBase } from '../ribbon-interfaces';
export var HEADER_ID = '_header';
export var FOOTER_ID = '_footer';
export var PAGE_NUMBER_ID = '_page_number';
/**
* Header & Footer group implementation for Insert tab
* @private
*/
var HeaderFooterGroup = /** @class */ (function (_super) {
__extends(HeaderFooterGroup, _super);
function HeaderFooterGroup() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Get the Ribbon items for Header & Footer group
* @returns {RibbonGroupModel} - Ribbon items for Header & Footer group
* @private
*/
HeaderFooterGroup.prototype.getGroupModel = function () {
return {
header: this.localObj.getConstant('Header & Footer'),
groupIconCss: 'e-icons e-de-ctnr-header',
enableGroupOverflow: true,
overflowHeader: this.localObj.getConstant('Header & Footer'),
collections: [{
items: [
{
type: 'Button',
keyTip: 'H',
buttonSettings: {
content: this.localObj.getConstant('Header'),
iconCss: 'e-icons e-de-ctnr-header',
isToggle: false,
clicked: this.headerHandler.bind(this)
},
id: this.ribbonId + HEADER_ID,
ribbonTooltipSettings: {
// title: this.localObj.getConstant('Header'),
content: this.localObj.getConstant('Add or edit the header')
}
},
{
type: 'Button',
keyTip: 'F',
buttonSettings: {
content: this.localObj.getConstant('Footer'),
iconCss: 'e-icons e-de-ctnr-footer',
isToggle: false,
clicked: this.footerHandler.bind(this)
},
id: this.ribbonId + FOOTER_ID,
ribbonTooltipSettings: {
// title: this.localObj.getConstant('Footer'),
content: this.localObj.getConstant('Add or edit the footer')
}
},
{
type: 'Button',
keyTip: 'NU',
buttonSettings: {
content: this.localObj.getConstant('Page Number'),
iconCss: 'e-icons e-de-ctnr-pagenumber',
isToggle: false,
clicked: this.pageNumberHandler.bind(this)
},
id: this.ribbonId + PAGE_NUMBER_ID,
ribbonTooltipSettings: {
// title: this.localObj.getConstant('Page Number'),
content: this.localObj.getConstant('Add page numbers')
}
}
]
}]
};
};
HeaderFooterGroup.prototype.headerHandler = function () {
this.container.documentEditor.selection.goToHeader();
this.container.statusBar.toggleWebLayout();
};
HeaderFooterGroup.prototype.footerHandler = function () {
this.container.documentEditor.selection.goToFooter();
this.container.statusBar.toggleWebLayout();
};
HeaderFooterGroup.prototype.pageNumberHandler = function () {
this.container.documentEditor.editorModule.insertPageNumber();
};
return HeaderFooterGroup;
}(RibbonGroupBase));
export { HeaderFooterGroup };