@syncfusion/ej2-documenteditor
Version:
Feature-rich document editor control with built-in support for context menu, options pane and dialogs.
232 lines (231 loc) • 7.96 kB
TypeScript
import { DocumentEditorContainer } from '../document-editor-container';
import { L10n } from '@syncfusion/ej2-base';
import { Ribbon as EJ2Ribbon, RibbonTabModel, RibbonGroupModel, RibbonItemModel, BackStageMenuModel } from '@syncfusion/ej2-ribbon';
import { Dictionary, FileMenuItemType } from '../../document-editor/base/index';
import { RibbonTabManager } from './ribbon-base/ribbon-tab-manager';
import { RibbonContextualTabManager } from './ribbon-base/ribbon-contextual-tab-manager';
import { RibbonStateManager } from './ribbon-base/ribbon-state-manager';
import { RibbonEventManager } from './ribbon-base/ribbon-event-manager';
import { MenuItemModel } from '@syncfusion/ej2-navigations';
import { RibbonTabType } from '../../document-editor/base/ribbon-types';
import { RibbonGroupInfo, RibbonItemInfo } from '../helper/ribbon-interfaces';
import { IToolbarHandler } from '../helper/toolbar-handler';
/**
* Ribbon class for DocumentEditorContainer
*/
export declare class Ribbon implements IToolbarHandler {
/**
* @private
*/
container: DocumentEditorContainer;
/**
* @private
*/
ribbonElement: HTMLElement;
/**
* @private
*/
localObj: L10n;
/**
* @private
*/
ribbon: EJ2Ribbon;
/**
* @private
*/
tabManager: RibbonTabManager;
/**
* @private
*/
contextualTabManager: RibbonContextualTabManager;
/**
* @private
*/
stateManager: RibbonStateManager;
/**
* @private
*/
eventManager: RibbonEventManager;
/**
* @private
*/
numericTextBoxCollection: Dictionary<string, string>;
/**
* @private
*/
backstageMenu: BackStageMenuModel;
/**
* @private
*/
fileMenuItems: (FileMenuItemType | MenuItemModel)[];
/**
* @private
*/
previousContext: string;
/**
* Gets the document editor instance
* @private
* @returns {DocumentEditor} The document editor instance
*/
private readonly documentEditor;
/**
* Constructor for the Ribbon class
* @param {DocumentEditorContainer} container - Specifies the document editor container
* @private
*/
constructor(container: DocumentEditorContainer);
/**
* Gets the module name
* @returns {string} Module name
* @private
*/
private getModuleName;
/**
* Initializes the ribbon component
* @returns {void}
* @private
*/
initializeRibbon(): void;
private initializeInternal;
private createRibbonElement;
private renderRibbon;
/**
* Adds a new tab to the ribbon UI.
* @param {RibbonTabModel} tab - The ribbon tab model to add.
* @param {string | RibbonTabType} insertBefore - Specifies the existing tab ID or type before which the new tab will be inserted.
* If not specified, the new tab will be inserted at the end of the ribbon.
* @returns {void}
* @public
*/
addTab(tab: RibbonTabModel, insertBefore?: string | RibbonTabType): void;
/**
* Adds a new item to an existing group in the ribbon.
* @param {RibbonGroupInfo} groupId - The information about the group to add the item to.
* @param {RibbonItemModel} item - The ribbon item model to add.
* @param {string | number} insertBefore - Specifies the existing item ID or index before which the new item will be inserted.
* If a string is provided, it's treated as an item ID. If a number is provided, it's treated as an item index.
* If not specified, the new item will be inserted at the end of the group.
* @returns {void}
* @public
*/
addItem(groupId: RibbonGroupInfo, item: RibbonItemModel, insertBefore?: string | number): void;
/**
* Adds a new group to an existing tab in the ribbon.
* @param {string | RibbonTabType} tabId - The ID or type of the tab to add the group to.
* @param {RibbonGroupModel} group - The ribbon group model to add.
* @param {number} insertBefore - Specifies the existing group index before which the new group will be inserted. If not specified, the new group will be inserted at the end.
* @returns {void}
* @public
*/
addGroup(tabId: string | RibbonTabType, group: RibbonGroupModel, insertBefore?: number): void;
/**
* Shows or hides a specific tab in the ribbon.
* @param {string | RibbonTabType} tabId - The ID or type of the tab to show or hide.
* @param {boolean} show - Whether to show (true) or hide (false) the tab.
* @returns {void}
* @public
*/
showTab(tabId: string | RibbonTabType, show: boolean): void;
/**
* Shows or hides a specific group in a tab.
* @param {string | RibbonGroupInfo} groupId - The ID of the group or group info to show or hide.
* @param {boolean} show - Whether to show (true) or hide (false) the group.
* @returns {void}
* @public
*/
showGroup(groupId: string | RibbonGroupInfo, show: boolean): void;
/**
* Shows or hides specific items in the ribbon.
* @param {string | RibbonItemInfo} itemId - The ID of the item or item information object to show or hide.
* If a string is provided, it's treated as an item ID. If a RibbonItemInfo object is provided,
* it will show/hide items based on the specified tab, group, and item indexes.
* @param {boolean} show - Whether to show (true) or hide (false) the item(s).
* @returns {void}
* @public
*/
showItems(itemId: string | RibbonItemInfo, show: boolean): void;
private showItemInternal;
/**
* Enables or disables specific items in the ribbon.
* @param {string | RibbonItemInfo} itemId - The ID of the item or item information object to show or hide.
* If a string is provided, it's treated as an item ID. If a RibbonItemInfo object is provided,
* it will enable/disable items based on the specified tab, group, and item indexes.
* @param {boolean} enable - Whether to enable (true) or disable (false) the items.
* @returns {void}
* @public
*/
enableItems(itemId: string | RibbonItemInfo, enable: boolean): void;
private enableItemInternal;
/**
* Update ribbon state based on current selection
* @returns {void}
* @private
*/
updateRibbonState(): void;
/**
* Updates the contextual tab based on the current selection context
* @returns {void}
* @private
*/
updateContextualTab(): void;
/**
* Updates the zoom button state when zoom factor changes
* @returns {void}
* @private
*/
onZoomFactorChange(): void;
/**
* Refresh the ribbon
* @returns {void}
* @private
*/
refresh(): void;
/**
* @returns {void}
* @private
*/
onContentChange(): void;
/**
* @returns {void}
* @private
*/
onDocumentChange(): void;
/**
* @param {boolean} isToggle - toggle track changes.
* @returns {void}
* @private
*/
initialize(isToggle?: boolean): void;
/**
* @param {boolean} restrictEditing - Whether to restrict editing or not
* @returns {void}
* @private
*/
restrictEditingToggleHelper(restrictEditing: boolean): void;
private onRibbonContentChange;
/**
* @param {boolean} enable - Emable/Disable insert comment toolbar item.
* @returns {void}
* @private
*/
enableDisableInsertComment(enable: boolean): void;
private onRibbonDocumentChange;
/**
* Enable or disable ribbon items based on protection state
* @param {boolean} enable - Whether to enable or disable items
* @returns {void}
* @private
*/
enableDisableRibbonItem(enable: boolean): void;
/**
* @returns {void}
* @private
*/
toggleTrackChanges(): void;
/**
* Destroy the ribbon instance
* @returns {void}
* @private
*/
destroy(): void;
}