@syncfusion/ej2-documenteditor
Version:
Feature-rich document editor control with built-in support for context menu, options pane and dialogs.
124 lines (123 loc) • 5.55 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';
import { RibbonConstants } from '../ribbon-constants';
/**
* Show group implementation for View tab
* @private
*/
var ShowGroup = /** @class */ (function (_super) {
__extends(ShowGroup, _super);
function ShowGroup() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Get the Ribbon items for Show group
*
* @returns {RibbonGroupModel} The ribbon group model
*/
ShowGroup.prototype.getGroupModel = function () {
return {
header: this.localObj.getConstant(RibbonConstants.SHOW_GROUP_HEADER),
// enableGroupOverflow: true,
id: this.ribbonId + '_showGroup',
overflowHeader: this.localObj.getConstant(RibbonConstants.SHOW_GROUP_HEADER),
collections: [
{
items: [
{
type: 'CheckBox',
keyTip: 'R',
checkBoxSettings: {
label: this.localObj.getConstant('Ruler'),
checked: false,
change: this.rulerChangeHandler.bind(this)
},
id: this.ribbonId + RibbonConstants.RULER_CHECKBOX_ID,
ribbonTooltipSettings: {
content: this.localObj.getConstant('Show or hide the rulers')
}
},
{
type: 'CheckBox',
keyTip: 'B',
checkBoxSettings: {
label: this.localObj.getConstant('Show Bookmarks'),
checked: false,
change: this.bookmarkMarkersChangeHandler.bind(this)
},
id: this.ribbonId + RibbonConstants.BOOKMARK_MARKERS_CHECKBOX_ID,
ribbonTooltipSettings: {
content: this.localObj.getConstant('Show or hide bookmarks')
}
},
{
type: 'CheckBox',
keyTip: 'K',
checkBoxSettings: {
label: this.localObj.getConstant('Navigation Pane'),
checked: false,
change: this.navigationPaneChangeHandler.bind(this)
},
id: this.ribbonId + RibbonConstants.NAVIGATION_PANE_CHECKBOX_ID,
ribbonTooltipSettings: {
content: this.localObj.getConstant('Show or hide the navigation pane')
}
}
]
}
]
};
};
ShowGroup.prototype.rulerChangeHandler = function (args) {
this.documentEditor.documentEditorSettings.showRuler = args.checked;
this.documentEditor.focusIn();
};
ShowGroup.prototype.bookmarkMarkersChangeHandler = function (args) {
this.documentEditor.documentEditorSettings.showBookmarks = args.checked;
this.documentEditor.focusIn();
};
ShowGroup.prototype.navigationPaneChangeHandler = function (args) {
this.documentEditor.documentEditorSettings.showNavigationPane = args.checked;
this.documentEditor.focusIn();
};
/**
* Update selection to reflect current state
*
* @returns {void}
*/
ShowGroup.prototype.updateSelection = function () {
var ribbon = this.container.ribbon.ribbon;
var rulerCheckBox = this.container.ribbon.ribbon.getItem(this.ribbonId + RibbonConstants.RULER_CHECKBOX_ID);
if (rulerCheckBox) {
rulerCheckBox.checkBoxSettings.checked =
this.documentEditor.documentEditorSettings.showRuler;
ribbon.updateItem(rulerCheckBox);
}
// Bookmark markers checkbox
var bookmarkCheckBox = ribbon.getItem(this.ribbonId + RibbonConstants.BOOKMARK_MARKERS_CHECKBOX_ID);
if (bookmarkCheckBox) {
bookmarkCheckBox.checkBoxSettings.checked = this.documentEditor.documentEditorSettings.showBookmarks;
ribbon.updateItem(bookmarkCheckBox);
}
// Navigation pane checkbox
var navigationCheckBox = ribbon.getItem(this.ribbonId + RibbonConstants.NAVIGATION_PANE_CHECKBOX_ID);
if (navigationCheckBox) {
navigationCheckBox.checkBoxSettings.checked = this.documentEditor.documentEditorSettings.showNavigationPane;
ribbon.updateItem(navigationCheckBox);
}
};
return ShowGroup;
}(RibbonGroupBase));
export { ShowGroup };