UNPKG

@syncfusion/ej2-documenteditor

Version:

Feature-rich document editor control with built-in support for context menu, options pane and dialogs.

81 lines (80 loc) 3.34 kB
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 PAGE_BREAK_ID = '_page_break'; /** * Pages group implementation for Insert tab * @private */ var PagesGroup = /** @class */ (function (_super) { __extends(PagesGroup, _super); function PagesGroup() { return _super !== null && _super.apply(this, arguments) || this; } /** * Get the Ribbon items for Pages group * @returns {RibbonGroupModel} - Pages group model * @private */ PagesGroup.prototype.getGroupModel = function () { return { header: this.localObj.getConstant('Pages'), groupIconCss: 'e-icons e-de-ctnr-page-break', enableGroupOverflow: true, overflowHeader: this.localObj.getConstant('Pages'), collections: [{ items: [{ type: 'Button', keyTip: 'B', buttonSettings: { content: this.localObj.getConstant('Page Break'), iconCss: 'e-icons e-de-ctnr-page-break', isToggle: false, clicked: this.insertPageBreakHandler.bind(this) }, id: this.ribbonId + PAGE_BREAK_ID, ribbonTooltipSettings: { // title: this.localObj.getConstant('Page Break'), content: this.localObj.getConstant('Insert a page break at the current position') } }] }] }; }; PagesGroup.prototype.insertPageBreakHandler = function () { this.documentEditor.editorModule.insertPageBreak(); }; /** * Update selection to reflect current state * @returns {void} * @private */ PagesGroup.prototype.updateSelection = function () { var isHeaderFooter = this.documentEditor.selection.contextType.indexOf('Header') >= 0 || this.documentEditor.selection.contextType.indexOf('Footer') >= 0; var isInTable = this.documentEditor.selection.contextType.indexOf('Table') >= 0; var ribbon = this.container.ribbon.ribbon; if (ribbon) { if (isInTable || isHeaderFooter || this.container.documentEditor.selection.isinFootnote || this.container.documentEditor.selection.isinEndnote) { ribbon.disableItem(this.ribbonId + PAGE_BREAK_ID); } else { ribbon.enableItem(this.ribbonId + PAGE_BREAK_ID); } } }; return PagesGroup; }(RibbonGroupBase)); export { PagesGroup };