UNPKG

@syncfusion/ej2-richtexteditor

Version:
145 lines (139 loc) 4.37 kB
import { Popup } from '@syncfusion/ej2-popups'; import { IRichTextEditor, IBaseQuickToolbar } from '../base/interface'; import { IQuickToolbarOptions } from '../base/interface'; import { ServiceLocator } from '../services/service-locator'; import { BaseToolbar } from './base-toolbar'; import { IToolbarStatus } from '../../common/interface'; import { RichTextEditorModel } from '../base/rich-text-editor-model'; import { QuickToolbarType } from '../../common/types'; /** * `Quick toolbar` module is used to handle Quick toolbar actions. */ export declare class BaseQuickToolbar implements IBaseQuickToolbar { isDestroyed: boolean; popupObj: Popup; element: HTMLElement; isRendered: boolean; quickTBarObj: BaseToolbar; private stringItems; private dropDownButtons; private colorPickerObj; private menuButtons; private locator; private parent; toolbarElement: HTMLElement; private tooltip; private previousToolbarStatus; /** * Specifies the Quick Toolbar type. */ type: QuickToolbarType; popupWidth: number; popupHeight: number; private tipPointerElem; private currentTipPosition; private tipPointerHeight; previousTarget: HTMLElement; private toolbarHeight; constructor(type: QuickToolbarType, parent?: IRichTextEditor, locator?: ServiceLocator); private appendToolbarElement; /** * render method * * @param {IQuickToolbarOptions} args - specifies the arguments * @returns {void} * @hidden */ render(args: IQuickToolbarOptions): void; private createToolbar; /** * Show the Quick toolbar popup. * * @param {Element} target - The target element relative to which the Quick toolbar is opened. * @param {MouseEvent | KeyboardEvent} [originalEvent] - The original event causing the Quick toolbar to open. * @returns {void} */ showPopup(target: Element, originalEvent?: MouseEvent | KeyboardEvent): void; private renderSubComponents; private tooltipBeforeRender; /** * The method to hide the Quick toolbar. * * @returns {void} * @hidden */ hidePopup(): void; private removeEleFromDOM; /** * Updates the status of the quick toolbar by enabling or disabling toolbar items * based on the current selection and editor state. * * @param {IToolbarStatus} args - An object containing the current toolbar status, including details about the selection and applied formatting. * @returns {void} * @public * @hidden */ updateStatus(args: IToolbarStatus): void; /** * Destroys the Quick toolbar. * * @function destroy * @returns {void} * @hidden */ destroy(): void; /** * addEventListener method * * @returns {void} * @hidden */ addEventListener(): void; /** * Called internally if any of the property value changed. * * @param {RichTextEditorModel} e - specifies the model element * @returns {void} * @hidden */ protected onPropertyChanged(e: { [key: string]: RichTextEditorModel; }): void; /** * removeEventListener method * * @returns {void} * @hidden */ removeEventListener(): void; private getPopupDimension; private getRelativeElement; private calculateOffsetX; private calculateOffsetY; private setTipPointerPostion; private getSelectionDirection; private addCSSClass; private enableDisableToolbarItems; private handleVerticalCollision; private handleMediaVerticalCollision; private isElemVisible; private handleIFrameMediaCollision; private getSpaceAbove; private getSpaceBelow; private handleTextVerticalCollision; private handleIFrameTextVerticalCollision; /** * Retrieves the previous toolbar status before the recent update. * * @returns {IToolbarStatus} An object representing the status of the toolbar including formatting and selection details. * @public * @hidden */ getPreviousStatus(): IToolbarStatus; private getTopCollisionType; private getBottomCollisionType; private getIFrameSpaceAbove; private getIFrameSpaceBelow; private getIFrameTopCollisionType; private getIFrameBottomCollisionType; }