@univerjs/docs-ui
Version:
Editor UI layer for Univer Docs.
155 lines (154 loc) • 6.48 kB
TypeScript
/**
* Copyright 2023-present DreamNum Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { DocumentDataModel, Nullable } from '@univerjs/core';
import type { IDocSelectionInnerParam, IMouseEvent, INodePosition, IPointerEvent, IRenderContext, IRenderModule, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
import { ILogService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
import { DocSkeletonManagerService } from '@univerjs/docs';
import { ILayoutService } from '@univerjs/ui';
import { TextRange } from './text-range';
export interface IEditorInputConfig {
event: Event | CompositionEvent | KeyboardEvent;
content?: string;
activeRange?: Nullable<ITextRangeWithStyle>;
rangeList?: ITextRangeWithStyle[];
}
export declare class DocSelectionRenderService extends RxDisposable implements IRenderModule {
private readonly _context;
private readonly _layoutService;
private readonly _logService;
private readonly _univerInstanceService;
private readonly _docSkeletonManagerService;
private readonly _onInputBefore$;
readonly onInputBefore$: import("rxjs").Observable<Nullable<IEditorInputConfig>>;
private readonly _onKeydown$;
readonly onKeydown$: import("rxjs").Observable<IEditorInputConfig>;
private readonly _onInput$;
readonly onInput$: import("rxjs").Observable<IEditorInputConfig>;
private readonly _onCompositionstart$;
readonly onCompositionstart$: import("rxjs").Observable<Nullable<IEditorInputConfig>>;
private readonly _onCompositionupdate$;
readonly onCompositionupdate$: import("rxjs").Observable<Nullable<IEditorInputConfig>>;
private readonly _onCompositionend$;
readonly onCompositionend$: import("rxjs").Observable<Nullable<IEditorInputConfig>>;
private readonly _onSelectionStart$;
readonly onSelectionStart$: import("rxjs").Observable<Nullable<INodePosition>>;
readonly onChangeByEvent$: import("rxjs").Observable<Nullable<IEditorInputConfig>>;
private readonly _onPaste$;
readonly onPaste$: import("rxjs").Observable<IEditorInputConfig>;
private readonly _textSelectionInner$;
readonly textSelectionInner$: import("rxjs").Observable<Nullable<IDocSelectionInnerParam>>;
private readonly _onFocus$;
readonly onFocus$: import("rxjs").Observable<IEditorInputConfig>;
private readonly _onBlur$;
readonly onBlur$: import("rxjs").Observable<IEditorInputConfig>;
private readonly _onPointerDown$;
readonly onPointerDown$: import("rxjs").Observable<void>;
private _container;
private _inputParent;
private _input;
private _scrollTimers;
private _rangeList;
private _rangeListCache;
private _rectRangeList;
private _rectRangeListCache;
private _anchorNodePosition;
private _focusNodePosition;
private _currentSegmentId;
private _currentSegmentPage;
private _selectionStyle;
private _onPointerEvent;
private _viewPortObserverMap;
private _isIMEInputApply;
private _scenePointerMoveSubs;
private _scenePointerUpSubs;
private _reserveRanges;
get isOnPointerEvent(): boolean;
get isFocusing(): boolean;
get canFocusing(): boolean;
constructor(_context: IRenderContext<DocumentDataModel>, _layoutService: ILayoutService, _logService: ILogService, _univerInstanceService: IUniverInstanceService, _docSkeletonManagerService: DocSkeletonManagerService);
private _listenCurrentUnitChange;
get activeViewPort(): import("@univerjs/engine-render").Viewport;
setSegment(id: string): void;
getSegment(): string;
setSegmentPage(pageIndex: number): void;
getSegmentPage(): number;
setReserveRangesStatus(status: boolean): void;
private _setRangeStyle;
addDocRanges(ranges: ISuccinctDocRangeParam[], isEditing?: boolean, options?: {
[key: string]: boolean;
}): void;
setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
sync(): void;
/**
* @deprecated
*/
activate(x: number, y: number, force?: boolean): void;
hasFocus(): boolean;
focus(): void;
blur(): void;
/**
* @deprecated
*/
deactivate(): void;
__handleDblClick(evt: IPointerEvent | IMouseEvent): void;
__handleTripleClick(evt: IPointerEvent | IMouseEvent): void;
__onPointDown(evt: IPointerEvent | IMouseEvent): void;
removeAllRanges(): void;
getActiveTextRange(): TextRange | undefined;
private _disposeScrollTimers;
private _setSystemHighlightColorToStyle;
private _getAllTextRanges;
private _getAllRectRanges;
getAllTextRanges(): ITextRangeWithStyle[];
getAllRectRanges(): import("@univerjs/engine-render").IRectRangeWithStyle[];
private _getActiveRange;
private _getActiveRangeInstance;
dispose(): void;
private _initDOM;
private _registerContainer;
private _initInput;
private _ensureHostContainer;
private _getNodePosition;
private _interactTextRanges;
private _interactRectRanges;
private _removeAllRanges;
private _removeAllCacheRanges;
private _removeAllTextRanges;
private _removeAllRectRanges;
private _removeAllCollapsedTextRanges;
private _deactivateAllTextRanges;
private _deactivateAllRectRanges;
private _addTextRangesToCache;
private _addTextRange;
private _addRectRangesToCache;
private _addRectRanges;
private _createTextRangeByAnchorPosition;
private _updateActiveRangePosition;
private _isEmpty;
private _getCanvasOffset;
private _updateInputPosition;
private _moving;
private _hasVisibleSelectionRanges;
private _shouldSnapBackwardFocusToGlyphStart;
private _isBeforeNodePosition;
private _isFirstSelectableGlyphInDivide;
__attachScrollEvent(): void;
private _initInputEvents;
private _eventHandle;
private _getTransformCoordForDocumentOffset;
private _findNodeByCoord;
private _detachEvent;
}