@syncfusion/ej2-documenteditor
Version:
Feature-rich document editor control with built-in support for context menu, options pane and dialogs.
93 lines (92 loc) • 4.2 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 INSERT_BOOKMARK_ID = '_insert_bookmark';
export var ALL_BOOKMARKS_ID = '_all_bookmarks';
export var SHOW_BOOKMARKS_ID = '_show_bookmarks';
/**
* Bookmarks group implementation for Insert tab
* @private
*/
var BookmarksGroup = /** @class */ (function (_super) {
__extends(BookmarksGroup, _super);
function BookmarksGroup() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Get the Ribbon items for Bookmarks group
* @returns {RibbonGroupModel} - Ribbon group model for Bookmarks group
* @private
*/
BookmarksGroup.prototype.getGroupModel = function () {
return {
header: this.localObj.getConstant('Bookmarks'),
groupIconCss: 'e-icons e-de-ctnr-bookmark',
keyTip: 'K',
enableGroupOverflow: true,
overflowHeader: this.localObj.getConstant('Bookmarks'),
collections: [{
items: [{
type: 'DropDown',
dropDownSettings: {
content: this.localObj.getConstant('Bookmark'),
iconCss: 'e-icons e-de-ctnr-bookmark',
items: [
{
text: this.localObj.getConstant('Insert Bookmark'),
id: this.ribbonId + INSERT_BOOKMARK_ID,
iconCss: 'e-icons e-de-ctnr-add-bookmark'
},
{
text: this.localObj.getConstant('All Bookmarks'),
id: this.ribbonId + ALL_BOOKMARKS_ID,
iconCss: 'e-icons e-de-ctnr-all-bookmarks'
}
],
select: this.onBookmarkDropDownSelect.bind(this)
},
id: this.ribbonId + '_bookmark',
ribbonTooltipSettings: {
// title: this.localObj.getConstant('Bookmark'),
content: this.localObj.getConstant('Insert a bookmark in a specific place in this document')
}
}]
}]
};
};
BookmarksGroup.prototype.onBookmarkDropDownSelect = function (args) {
var id = args.item.id;
if (id === this.ribbonId + INSERT_BOOKMARK_ID) {
this.insertBookmarkHandler();
}
else if (id === this.ribbonId + ALL_BOOKMARKS_ID) {
this.showAllBookmarksHandler();
}
else if (id === this.ribbonId + SHOW_BOOKMARKS_ID) {
this.toggleBookmarkVisibilityHandler();
}
};
BookmarksGroup.prototype.insertBookmarkHandler = function () {
this.container.documentEditor.showDialog('Bookmark');
};
BookmarksGroup.prototype.showAllBookmarksHandler = function () {
this.container.documentEditor.documentEditorSettings.showNavigationPane = true;
};
BookmarksGroup.prototype.toggleBookmarkVisibilityHandler = function () {
var documentEditor = this.container.documentEditor;
documentEditor.documentEditorSettings.showBookmarks = !documentEditor.documentEditorSettings.showBookmarks;
};
return BookmarksGroup;
}(RibbonGroupBase));
export { BookmarksGroup };