UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

127 lines (126 loc) 5.53 kB
import { RectangleF, Transform } from "@aurigma/design-atoms-model/Math"; import { EventWithSenderArg } from "@aurigma/design-atoms-model/EventObject"; import { ITextEditor } from "@aurigma/design-atoms-text/TextEditor/Interfaces"; import { NewBaseTextItemHandler } from "../ItemHandlers"; import { IActiveTextCanvasHandler } from "../CanvasElementHandler"; import { ITextEditorController, StaticTextChangedHandler } from "./ITextEditorController"; import { TextRenderer } from "./TextRenderer"; import { IPointerParams, IKeyboardEventParams } from "./../Input/InputManager/IInputManager"; import * as TextWhizz from "@aurigma/text-whizz/TextWhizzJS"; import { Func } from "@aurigma/design-atoms-model"; import { IViewerConfiguration } from "../Viewer"; import { FontRegistry } from "./FontRegistry"; import { IColorParser } from "../Serialization/Color/IColorParser"; import { ICanvas } from "../ICanvas"; /** * Manages a text editor (TextWhizz or mobile versions). * @remarks The text editor is shared by item handlers, we get it from 'Canvas' entry. The TextWhizz is used as a text engine. */ export declare class TextEditorController implements ITextEditorController { private _textWhizz; private readonly _tw; private readonly _itemHandler; private _canvas; private readonly _textRenderer; private readonly _activeTextCanvasHandler; private readonly _listStyleSheetManagerFactory; private readonly _listStyleSheetManager; private readonly _colorPreviewService; private readonly _viewerConfiguration; private readonly _colorParser; private readonly _exitedEditModeEvent; private readonly _enteredEditModeEvent; private readonly _textImageChanged; private _textStateValue; private _initialFormattedText; private _mouseDownStartedInside; private _isEnterToEditModeLocked; private _isExitFromEditModeLocked; private _isTextImageValid; private _isDisposed; private _isCropped?; private _ready; private _failed; private _userZoomInProgress; private _initialBoundedRect; private _textFormattingEnabled; private _fontRegistry; private _getTextEditor; private get _textEditor(); constructor(itemHandler: NewBaseTextItemHandler, _textWhizz: typeof TextWhizz, textRenderer: TextRenderer, activeTextCanvasHandler: IActiveTextCanvasHandler, viewerConfig: IViewerConfiguration, fontRegistry: FontRegistry, colorParser: IColorParser, textFormattingEnabled: boolean, getTextEditor: Func<ITextEditor>); get isMobile(): boolean; get ready(): boolean; get failed(): boolean; get isStatic(): boolean; get isActive(): boolean; get isInEdit(): boolean; get isCropped(): boolean; get enteredEditModeEvent(): EventWithSenderArg<TextEditorController, unknown>; get exitedEditModeEvent(): EventWithSenderArg<TextEditorController, unknown>; get activeTextEditor(): ITextEditor; get canRedo(): boolean; get canUndo(): boolean; private _waitUpdatePromise; waitUpdate(): Promise<void>; initialize(): Promise<void>; enterEditMode(x: number, y: number): Promise<void>; exitEditMode(isStayActive?: boolean): Promise<void>; updateItemHandler(newFrame?: RectangleF): void; bindToCanvas(canvas: ICanvas): void; unbindFromCanvas(): void; add_staticTextImageChanged(handler: StaticTextChangedHandler): void; remove_staticTextImageChanged(handler: StaticTextChangedHandler): void; dispose(): void; processKeyEvent(e: IKeyboardEventParams): Promise<boolean>; processMouseEvent(pointerParams: IPointerParams, mouseOverCurrent: boolean): Promise<boolean>; clearText(): void; updateText(trigger: string, force?: boolean): Promise<void>; transformText(transform: Transform): void; measureText(extendToBlackBox?: boolean): RectangleF; measureTextFrame(useActiveText?: boolean): RectangleF; redrawActiveText(): void; undo(): void; redo(): void; private _createEngineWrapper; private _getEngineWrapperInitData; private _initEngineWrapper; private _getTextWhizzEditorInitData; private _getMobileEditorInitData; private _initActiveTextEditor; private _onMobileTextEditorInitialized; private _bindToEditor; private _unbindFromEditor; private _onSelectedItemHandlerChanged; private _onCanvasSelectionLocked; private _onTextStateChanged; redrawText(): void; private _onCanvasScroll; private _getMissingFonts; private _onCanvasZoomChanged; private _onFrameChanged; private _onStyleChanged; private _onInvalidInput; private _updateMouseDownStartedInside; private _getMouseCommandType; private _getMouseEvent; private _translatePoint; private get _textState(); private _setTextState; private _redrawText; private _updateTextImage; private _updateText; private _getUpdateTextTrigger; private _restorePlaceholderText; private _updateItemListStyles; private _handleTextChanged; private _extractDefaultTextStyle; private _defineCanvasCursor; private _setCanvasForExitFromEdit; private _setCanvasForEnterToEdit; private isOnlyThisItemSelected; private _serializeToItemListStyles; private _parseItemListStyles; private _convertFromModelSpanStyle; private _convertFromModelParagraphStyle; private _convertToModelParagraphAlignment; }