@univerjs/docs 0.1.16 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +1898 -1299
- package/lib/types/basics/component-tools.d.ts +9 -2
- package/lib/types/basics/custom-decoration-factory.d.ts +25 -0
- package/lib/types/basics/custom-range-factory.d.ts +25 -0
- package/lib/types/basics/custom-range.d.ts +5 -0
- package/lib/types/basics/retain-delete-params.d.ts +6 -2
- package/lib/types/basics/selection.d.ts +28 -0
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +30 -9
- package/lib/types/commands/commands/core-editing.command.d.ts +2 -2
- package/lib/types/commands/commands/delete.command.d.ts +2 -2
- package/lib/types/commands/util.d.ts +11 -0
- package/lib/types/controllers/ime-input.controller.d.ts +3 -4
- package/lib/types/controllers/move-cursor.controller.d.ts +2 -4
- package/lib/types/controllers/normal-input.controller.d.ts +1 -3
- package/lib/types/index.d.ts +21 -16
- package/lib/types/services/doc-custom-range.service.d.ts +18 -0
- package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +13 -0
- package/lib/types/services/doc-interceptor/interceptor-const.d.ts +14 -0
- package/lib/types/services/doc-skeleton-manager.service.d.ts +17 -22
- package/lib/types/services/doc-view-model-manager.service.d.ts +9 -5
- package/lib/types/services/text-selection-manager.service.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IUniverInstanceService, Nullable } from '@univerjs/core';
|
|
2
|
-
import { DocBackground, Documents, Engine, IRenderManagerService, Scene } from '@univerjs/engine-render';
|
|
1
|
+
import { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
|
|
2
|
+
import { DocBackground, Documents, Engine, IRenderContext, IRenderManagerService, Scene } from '@univerjs/engine-render';
|
|
3
3
|
|
|
4
4
|
export interface IDocObjectParam {
|
|
5
5
|
document: Documents;
|
|
@@ -7,5 +7,12 @@ export interface IDocObjectParam {
|
|
|
7
7
|
scene: Scene;
|
|
8
8
|
engine: Engine;
|
|
9
9
|
}
|
|
10
|
+
export declare function neoGetDocObject(renderContext: IRenderContext<DocumentDataModel>): {
|
|
11
|
+
document: Documents;
|
|
12
|
+
docBackground: DocBackground;
|
|
13
|
+
scene: Scene;
|
|
14
|
+
engine: Engine;
|
|
15
|
+
};
|
|
16
|
+
/** @deprecated After migrating to `RenderUnit`, use `neoGetDocObject` instead. */
|
|
10
17
|
export declare function getDocObject(univerInstanceService: IUniverInstanceService, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
|
|
11
18
|
export declare function getDocObjectById(unitId: string, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CustomDecorationType, IMutationInfo, ITextRange } from '@univerjs/core';
|
|
2
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
3
|
+
import { IRichTextEditingMutationParams } from '../commands/mutations/core-editing.mutation';
|
|
4
|
+
|
|
5
|
+
interface IAddCustomDecorationParam {
|
|
6
|
+
unitId: string;
|
|
7
|
+
range: ITextRange;
|
|
8
|
+
segmentId?: string;
|
|
9
|
+
id: string;
|
|
10
|
+
type: CustomDecorationType;
|
|
11
|
+
}
|
|
12
|
+
export declare function addCustomDecorationFactory(param: IAddCustomDecorationParam): IMutationInfo<IRichTextEditingMutationParams>;
|
|
13
|
+
interface IAddCustomDecorationFactoryParam {
|
|
14
|
+
segmentId?: string;
|
|
15
|
+
id: string;
|
|
16
|
+
type: CustomDecorationType;
|
|
17
|
+
}
|
|
18
|
+
export declare function addCustomDecorationBySelectionFactory(accessor: IAccessor, param: IAddCustomDecorationFactoryParam): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
19
|
+
export interface IDeleteCustomRangeParam {
|
|
20
|
+
unitId: string;
|
|
21
|
+
id: string;
|
|
22
|
+
segmentId?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function deleteCustomDecorationFactory(accessor: IAccessor, params: IDeleteCustomRangeParam): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CustomRangeType, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
|
|
2
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
3
|
+
import { IRichTextEditingMutationParams } from '../commands/mutations/core-editing.mutation';
|
|
4
|
+
|
|
5
|
+
interface IAddCustomRangeParam {
|
|
6
|
+
unitId: string;
|
|
7
|
+
range: ITextRange;
|
|
8
|
+
segmentId?: string;
|
|
9
|
+
rangeId: string;
|
|
10
|
+
rangeType: CustomRangeType;
|
|
11
|
+
}
|
|
12
|
+
export declare function addCustomRangeFactory(param: IAddCustomRangeParam, body: IDocumentBody): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
13
|
+
interface IAddCustomRangeFactoryParam {
|
|
14
|
+
segmentId?: string;
|
|
15
|
+
rangeId: string;
|
|
16
|
+
rangeType: CustomRangeType;
|
|
17
|
+
}
|
|
18
|
+
export declare function addCustomRangeBySelectionFactory(accessor: IAccessor, param: IAddCustomRangeFactoryParam): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
19
|
+
export interface IDeleteCustomRangeParam {
|
|
20
|
+
unitId: string;
|
|
21
|
+
rangeId: string;
|
|
22
|
+
segmentId?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function deleteCustomRangeFactory(accessor: IAccessor, params: IDeleteCustomRangeParam): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ICustomRange, DataStreamTreeTokenType } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare function isCustomRangeSplitSymbol(text: string): text is DataStreamTreeTokenType.CUSTOM_RANGE_START | DataStreamTreeTokenType.CUSTOM_RANGE_END;
|
|
4
|
+
export declare function isIntersecting(line1Start: number, line1End: number, line2Start: number, line2End: number): boolean;
|
|
5
|
+
export declare function shouldDeleteCustomRange(deleteStart: number, deleteLen: number, customRange: ICustomRange, dataStream: string): boolean;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { IDeleteAction, IRetainAction, ITextRange } from '@univerjs/core';
|
|
1
|
+
import { IDeleteAction, IDocumentBody, IRetainAction, ITextRange } from '@univerjs/core';
|
|
2
2
|
|
|
3
|
-
export declare function getRetainAndDeleteFromReplace(range: ITextRange, segmentId
|
|
3
|
+
export declare function getRetainAndDeleteFromReplace(range: ITextRange, segmentId: string | undefined, memoryCursor: number, body: IDocumentBody): {
|
|
4
|
+
dos: (IRetainAction | IDeleteAction)[];
|
|
5
|
+
cursor: number;
|
|
6
|
+
retain: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IDocumentBody, ITextRange, Nullable } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare function normalizeSelection(selection: ITextRange): {
|
|
4
|
+
startOffset: number;
|
|
5
|
+
endOffset: number;
|
|
6
|
+
collapsed: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function getSelectionWithSymbolMax(selection: ITextRange, body: IDocumentBody): {
|
|
9
|
+
startOffset: number;
|
|
10
|
+
endOffset: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function getSelectionWithNoSymbolSide(selection: ITextRange, body: IDocumentBody): {
|
|
13
|
+
startOffset: number;
|
|
14
|
+
endOffset: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function getDeleteSelection(selection: ITextRange, body: IDocumentBody): {
|
|
17
|
+
collapsed: boolean;
|
|
18
|
+
startOffset: number;
|
|
19
|
+
endOffset: number;
|
|
20
|
+
};
|
|
21
|
+
export declare function getInsertSelection(selection: ITextRange, body: IDocumentBody): ITextRange;
|
|
22
|
+
/**
|
|
23
|
+
* Ensure custom-range has a correct order,
|
|
24
|
+
* when range contains range, it won't be present as intersect. <br/>
|
|
25
|
+
* For Example `\s1\s2 text \s1\s2` is not allowed, expect `\s1\s2 text \s2\s1`
|
|
26
|
+
*/
|
|
27
|
+
export declare function getSelectionForAddCustomRange(selection: ITextRange, body: IDocumentBody): Nullable<ITextRange>;
|
|
28
|
+
export declare function getSelectionText(dataStream: string, start: number, end: number): string;
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
-
import { IDocumentData, Univer } from '@univerjs/core';
|
|
2
|
-
import { Dependency } from '@wendellhu/redi';
|
|
1
|
+
import { DocumentDataModel, IDocumentData, Nullable, IUniverInstanceService, RxDisposable, Univer } from '@univerjs/core';
|
|
2
|
+
import { Dependency, DependencyIdentifier, Injector } from '@wendellhu/redi';
|
|
3
|
+
import { DocumentSkeleton, IRender, IRenderContext, IRenderModule, DocumentViewModel, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
4
|
|
|
4
5
|
export declare function createCommandTestBed(workbookData?: IDocumentData, dependencies?: Dependency[]): {
|
|
5
6
|
univer: Univer;
|
|
6
7
|
get: {
|
|
7
|
-
<T>(id:
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
<
|
|
8
|
+
<T>(id: DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
|
|
9
|
+
<T>(id: DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
|
|
10
|
+
<T>(id: DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
|
|
11
|
+
<T>(id: DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
|
|
12
|
+
<T>(id: DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
|
|
13
|
+
<T>(id: DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
|
|
13
14
|
};
|
|
14
|
-
doc:
|
|
15
|
+
doc: DocumentDataModel;
|
|
15
16
|
};
|
|
17
|
+
export declare class MockRenderManagerService implements Pick<IRenderManagerService, 'getRenderById'> {
|
|
18
|
+
private readonly _injector;
|
|
19
|
+
constructor(_injector: Injector);
|
|
20
|
+
getRenderById(_unitId: string): Nullable<IRender>;
|
|
21
|
+
}
|
|
22
|
+
export declare class MockDocSkeletonManagerService extends RxDisposable implements IRenderModule {
|
|
23
|
+
private readonly _context;
|
|
24
|
+
private readonly _univerInstanceService;
|
|
25
|
+
private _docViewModel;
|
|
26
|
+
private readonly _currentSkeleton$;
|
|
27
|
+
readonly currentSkeleton$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
|
|
28
|
+
private readonly _currentSkeletonBefore$;
|
|
29
|
+
readonly currentSkeletonBefore$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
|
|
30
|
+
constructor(_context: IRenderContext<DocumentDataModel>, _univerInstanceService: IUniverInstanceService);
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private _update;
|
|
33
|
+
getSkeleton(): DocumentSkeleton;
|
|
34
|
+
getViewModel(): DocumentViewModel;
|
|
35
|
+
private _buildDocViewModel;
|
|
36
|
+
}
|
|
@@ -5,8 +5,9 @@ export interface IInsertCommandParams {
|
|
|
5
5
|
unitId: string;
|
|
6
6
|
body: IDocumentBody;
|
|
7
7
|
range: ITextRange;
|
|
8
|
-
textRanges
|
|
8
|
+
textRanges?: ITextRangeWithStyle[];
|
|
9
9
|
segmentId?: string;
|
|
10
|
+
cursorOffset?: number;
|
|
10
11
|
}
|
|
11
12
|
export declare const EditorInsertTextCommandId = "doc.command.insert-text";
|
|
12
13
|
/**
|
|
@@ -21,7 +22,6 @@ export interface IDeleteCommandParams {
|
|
|
21
22
|
unitId: string;
|
|
22
23
|
range: ITextRange;
|
|
23
24
|
direction: DeleteDirection;
|
|
24
|
-
textRanges: ITextRangeWithStyle[];
|
|
25
25
|
len?: number;
|
|
26
26
|
segmentId?: string;
|
|
27
27
|
}
|
|
@@ -2,11 +2,11 @@ import { ICommand } from '@univerjs/core';
|
|
|
2
2
|
import { IActiveTextRange } from '@univerjs/engine-render';
|
|
3
3
|
import { DeleteDirection } from './core-editing.command';
|
|
4
4
|
|
|
5
|
-
export declare const DeleteLeftCommand: ICommand;
|
|
6
|
-
export declare const DeleteRightCommand: ICommand;
|
|
7
5
|
interface IMergeTwoParagraphParams {
|
|
8
6
|
direction: DeleteDirection;
|
|
9
7
|
range: IActiveTextRange;
|
|
10
8
|
}
|
|
11
9
|
export declare const MergeTwoParagraphCommand: ICommand<IMergeTwoParagraphParams>;
|
|
10
|
+
export declare const DeleteLeftCommand: ICommand;
|
|
11
|
+
export declare const DeleteRightCommand: ICommand;
|
|
12
12
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IAccessor } from '@wendellhu/redi';
|
|
2
|
+
import { DocumentDataModel } from '@univerjs/core';
|
|
3
|
+
import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the skeleton of the command's target.
|
|
7
|
+
* @param accessor The injection accessor.
|
|
8
|
+
* @param unitId Unit ID.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCommandSkeleton(accessor: IAccessor, unitId: string): DocSkeletonManagerService | undefined;
|
|
11
|
+
export declare function getRichTextEditPath(docDataModel: DocumentDataModel, segmentId?: string): string[];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
-
import { ITextSelectionRenderManager } from '@univerjs/engine-render';
|
|
3
|
-
import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
|
|
2
|
+
import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
|
|
4
3
|
import { IMEInputManagerService } from '../services/ime-input-manager.service';
|
|
5
4
|
|
|
6
5
|
export declare class IMEInputController extends Disposable {
|
|
7
|
-
private readonly _docSkeletonManagerService;
|
|
8
6
|
private readonly _univerInstanceService;
|
|
7
|
+
private readonly _renderManagerSrv;
|
|
9
8
|
private readonly _textSelectionRenderManager;
|
|
10
9
|
private readonly _imeInputManagerService;
|
|
11
10
|
private readonly _commandService;
|
|
@@ -14,7 +13,7 @@ export declare class IMEInputController extends Disposable {
|
|
|
14
13
|
private _onStartSubscription;
|
|
15
14
|
private _onUpdateSubscription;
|
|
16
15
|
private _onEndSubscription;
|
|
17
|
-
constructor(
|
|
16
|
+
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerSrv: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _imeInputManagerService: IMEInputManagerService, _commandService: ICommandService);
|
|
18
17
|
dispose(): void;
|
|
19
18
|
private _initialize;
|
|
20
19
|
private _initialOnCompositionstart;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
-
import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
|
|
4
3
|
import { TextSelectionManagerService } from '../services/text-selection-manager.service';
|
|
5
4
|
|
|
6
5
|
export declare class MoveCursorController extends Disposable {
|
|
7
|
-
private readonly _docSkeletonManagerService;
|
|
8
6
|
private readonly _univerInstanceService;
|
|
9
7
|
private readonly _renderManagerService;
|
|
10
8
|
private readonly _textSelectionManagerService;
|
|
11
9
|
private readonly _commandService;
|
|
12
10
|
private _onInputSubscription;
|
|
13
|
-
constructor(
|
|
11
|
+
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _textSelectionManagerService: TextSelectionManagerService, _commandService: ICommandService);
|
|
14
12
|
dispose(): void;
|
|
15
13
|
private _commandExecutedListener;
|
|
16
14
|
private _handleShiftMoveSelection;
|
|
17
15
|
private _handleMoveCursor;
|
|
18
16
|
private _getTopOrBottomPosition;
|
|
19
|
-
private
|
|
17
|
+
private _getGlyphLeftOffsetInLine;
|
|
20
18
|
private _matchPositionByLeftOffset;
|
|
21
19
|
private _getNextOrPrevLine;
|
|
22
20
|
private _getDocObject;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
|
|
3
|
-
import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
|
|
4
3
|
|
|
5
4
|
export declare class NormalInputController extends Disposable {
|
|
6
|
-
private readonly _docSkeletonManagerService;
|
|
7
5
|
private readonly _univerInstanceService;
|
|
8
6
|
private readonly _renderManagerService;
|
|
9
7
|
private readonly _textSelectionRenderManager;
|
|
10
8
|
private readonly _commandService;
|
|
11
9
|
private _onInputSubscription;
|
|
12
|
-
constructor(
|
|
10
|
+
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _commandService: ICommandService);
|
|
13
11
|
dispose(): void;
|
|
14
12
|
private _init;
|
|
15
13
|
private _initialNormalInput;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,27 +13,32 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { getSelectionText, getDeleteSelection, getInsertSelection } from './basics/selection';
|
|
16
17
|
export type { IDocObjectParam } from './basics/component-tools';
|
|
17
|
-
export { getDocObject, getDocObjectById } from './basics/component-tools';
|
|
18
|
+
export { getDocObject, neoGetDocObject, getDocObjectById } from './basics/component-tools';
|
|
18
19
|
export * from './basics/docs-view-key';
|
|
19
|
-
export { BreakLineCommand } from './commands/commands/break-line.command';
|
|
20
|
-
export { DeleteCommand, type ICoverCommandParams, type IDeleteCommandParams, type IInsertCommandParams, InsertCommand, type IUpdateCommandParams, UpdateCommand, EditorInsertTextCommandId, } from './commands/commands/core-editing.command';
|
|
21
|
-
export { DeleteLeftCommand, DeleteRightCommand } from './commands/commands/delete.command';
|
|
22
|
-
export { type IIMEInputCommandParams, IMEInputCommand } from './commands/commands/ime-input.command';
|
|
23
|
-
export { SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextBackgroundColorCommand, } from './commands/commands/inline-format.command';
|
|
24
|
-
export { AlignOperationCommand, AlignLeftCommand, AlignCenterCommand, AlignRightCommand, AlignJustifyCommand, } from './commands/commands/paragraph-align.command';
|
|
25
|
-
export { BulletListCommand, OrderListCommand } from './commands/commands/list.command';
|
|
26
|
-
export { CoverContentCommand, ReplaceContentCommand } from './commands/commands/replace-content.command';
|
|
27
|
-
export { type IRichTextEditingMutationParams, RichTextEditingMutation, } from './commands/mutations/core-editing.mutation';
|
|
28
|
-
export { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/cursor.operation';
|
|
29
|
-
export { type ISetTextSelectionsOperationParams, SetTextSelectionsOperation, } from './commands/operations/text-selection.operation';
|
|
30
20
|
export { type IUniverDocsConfig, UniverDocsPlugin } from './doc-plugin';
|
|
31
|
-
export { DocSkeletonManagerService
|
|
32
|
-
export { DocViewModelManagerService } from './services/doc-view-model-manager.service';
|
|
21
|
+
export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
|
|
33
22
|
export { TextSelectionManagerService, serializeTextRange } from './services/text-selection-manager.service';
|
|
34
23
|
export { DocStateChangeManagerService, type IDocStateChangeParams } from './services/doc-state-change-manager.service';
|
|
35
24
|
export { IMEInputManagerService } from './services/ime-input-manager.service';
|
|
36
|
-
export {
|
|
25
|
+
export { DocCustomRangeService, type ICustomRangeHook } from './services/doc-custom-range.service';
|
|
26
|
+
export { BreakLineCommand } from './commands/commands/break-line.command';
|
|
37
27
|
export { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
|
|
38
|
-
export {
|
|
28
|
+
export { InsertCommand, DeleteCommand, UpdateCommand, EditorInsertTextCommandId, type ICoverCommandParams, type IDeleteCommandParams, type IInsertCommandParams, type IUpdateCommandParams, } from './commands/commands/core-editing.command';
|
|
29
|
+
export { DeleteLeftCommand, DeleteRightCommand, MergeTwoParagraphCommand } from './commands/commands/delete.command';
|
|
30
|
+
export { IMEInputCommand, type IIMEInputCommandParams } from './commands/commands/ime-input.command';
|
|
31
|
+
export { SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatUnderlineCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatFontSizeCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatTextColorCommand, SetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatCommand, } from './commands/commands/inline-format.command';
|
|
32
|
+
export { ListOperationCommand, BulletListCommand, OrderListCommand } from './commands/commands/list.command';
|
|
33
|
+
export { AlignOperationCommand, AlignLeftCommand, AlignCenterCommand, AlignRightCommand, AlignJustifyCommand, } from './commands/commands/paragraph-align.command';
|
|
34
|
+
export { ReplaceContentCommand, CoverContentCommand } from './commands/commands/replace-content.command';
|
|
39
35
|
export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
|
|
36
|
+
export { addCustomRangeFactory, addCustomRangeBySelectionFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
|
|
37
|
+
export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
|
|
38
|
+
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
|
|
39
|
+
export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
|
|
40
|
+
export { RichTextEditingMutation, type IRichTextEditingMutationParams, } from './commands/mutations/core-editing.mutation';
|
|
41
|
+
export { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/cursor.operation';
|
|
42
|
+
export { SelectAllOperation } from './commands/operations/select-all.operation';
|
|
43
|
+
export { SetDocZoomRatioOperation, type ISetDocZoomRatioOperationParams } from './commands/operations/set-doc-zoom-ratio.operation';
|
|
44
|
+
export { SetTextSelectionsOperation, type ISetTextSelectionsOperationParams, } from './commands/operations/text-selection.operation';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CustomRangeType } from '@univerjs/core';
|
|
2
|
+
import { IDisposable } from '@wendellhu/redi';
|
|
3
|
+
|
|
4
|
+
export interface ICustomRangeBase {
|
|
5
|
+
rangeId: string;
|
|
6
|
+
rangeType: CustomRangeType;
|
|
7
|
+
}
|
|
8
|
+
export interface ICustomRangeHook {
|
|
9
|
+
onCopyCustomRange?: (range: ICustomRangeBase) => ICustomRangeBase;
|
|
10
|
+
}
|
|
11
|
+
export declare class DocCustomRangeService {
|
|
12
|
+
private _customRangeHooks;
|
|
13
|
+
addClipboardHook(hook: ICustomRangeHook): IDisposable;
|
|
14
|
+
copyCustomRange(range: ICustomRangeBase): {
|
|
15
|
+
rangeId: string;
|
|
16
|
+
rangeType: CustomRangeType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DocumentDataModel, IInterceptor, Disposable, DisposableCollection } from '@univerjs/core';
|
|
2
|
+
import { DocumentViewModel, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
|
+
import { DocSkeletonManagerService } from '../doc-skeleton-manager.service';
|
|
4
|
+
|
|
5
|
+
export declare class DocInterceptorService extends Disposable implements IRenderModule {
|
|
6
|
+
private readonly _context;
|
|
7
|
+
private readonly _docSkeletonManagerService;
|
|
8
|
+
private _interceptorsByName;
|
|
9
|
+
constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService);
|
|
10
|
+
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): import('@wendellhu/redi').IDisposable;
|
|
11
|
+
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: import('@univerjs/core/common/type-util.js').Nullable<T>, initContext: C) => import('@univerjs/core/common/type-util.js').Nullable<T>;
|
|
12
|
+
interceptDocumentViewModel(viewModel: DocumentViewModel): DisposableCollection;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ICustomDecoration, ICustomDecorationForInterceptor, ICustomRange, ICustomRangeForInterceptor } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare const DOC_INTERCEPTOR_POINT: {
|
|
4
|
+
CUSTOM_RANGE: import('@univerjs/core').IInterceptor<ICustomRangeForInterceptor, {
|
|
5
|
+
index: number;
|
|
6
|
+
unitId: string;
|
|
7
|
+
customRanges: ICustomRange[];
|
|
8
|
+
}>;
|
|
9
|
+
CUSTOM_DECORATION: import('@univerjs/core').IInterceptor<ICustomDecorationForInterceptor, {
|
|
10
|
+
index: number;
|
|
11
|
+
unitId: string;
|
|
12
|
+
customDecorations: ICustomDecoration[];
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
import { Nullable, IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
|
|
2
|
-
import { DocumentSkeleton } from '@univerjs/engine-render';
|
|
3
|
-
import { DocViewModelManagerService } from './doc-view-model-manager.service';
|
|
1
|
+
import { DocumentDataModel, Nullable, IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule, DocumentSkeleton, DocumentViewModel } from '@univerjs/engine-render';
|
|
4
3
|
|
|
5
|
-
export interface IDocSkeletonManagerParam {
|
|
6
|
-
unitId: string;
|
|
7
|
-
skeleton: DocumentSkeleton;
|
|
8
|
-
dirty: boolean;
|
|
9
|
-
}
|
|
10
4
|
/**
|
|
11
|
-
* This service is for document build and manage doc skeletons.
|
|
5
|
+
* This service is for document build and manage doc skeletons. It also manages
|
|
6
|
+
* DocumentViewModels.
|
|
12
7
|
*/
|
|
13
|
-
export declare class DocSkeletonManagerService extends RxDisposable {
|
|
8
|
+
export declare class DocSkeletonManagerService extends RxDisposable implements IRenderModule {
|
|
9
|
+
private readonly _context;
|
|
14
10
|
private readonly _localeService;
|
|
15
|
-
private readonly _docViewModelManagerService;
|
|
16
11
|
private readonly _univerInstanceService;
|
|
17
|
-
private
|
|
18
|
-
private
|
|
12
|
+
private _skeleton;
|
|
13
|
+
private _docViewModel;
|
|
19
14
|
private readonly _currentSkeleton$;
|
|
20
|
-
readonly currentSkeleton$: import('rxjs').Observable<Nullable<
|
|
15
|
+
readonly currentSkeleton$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
|
|
21
16
|
private readonly _currentSkeletonBefore$;
|
|
22
|
-
readonly currentSkeletonBefore$: import('rxjs').Observable<Nullable<
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
readonly currentSkeletonBefore$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
|
|
18
|
+
private readonly _currentViewModel$;
|
|
19
|
+
readonly currentViewModel$: import('rxjs').Observable<Nullable<DocumentViewModel>>;
|
|
20
|
+
constructor(_context: IRenderContext<DocumentDataModel>, _localeService: LocaleService, _univerInstanceService: IUniverInstanceService);
|
|
25
21
|
dispose(): void;
|
|
22
|
+
getSkeleton(): DocumentSkeleton;
|
|
23
|
+
getViewModel(): DocumentViewModel;
|
|
26
24
|
private _init;
|
|
27
|
-
|
|
28
|
-
getAllSkeleton(): Map<string, IDocSkeletonManagerParam>;
|
|
29
|
-
makeDirty(unitId: string, state?: boolean): void;
|
|
30
|
-
getSkeletonByUnitId(unitId: string): Nullable<IDocSkeletonManagerParam>;
|
|
31
|
-
private _setCurrent;
|
|
25
|
+
private _update;
|
|
32
26
|
private _buildSkeleton;
|
|
27
|
+
private _buildDocViewModel;
|
|
33
28
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { Nullable, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
-
import { DocumentViewModel } from '@univerjs/engine-render';
|
|
1
|
+
import { DocumentDataModel, Nullable, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule, DocumentViewModel } from '@univerjs/engine-render';
|
|
3
3
|
|
|
4
4
|
export interface IDocumentViewModelManagerParam {
|
|
5
5
|
unitId: string;
|
|
6
6
|
docViewModel: DocumentViewModel;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* The view model manager is used to manage Doc view model. has a one-to-one correspondence
|
|
9
|
+
* The view model manager is used to manage Doc view model. Each view model has a one-to-one correspondence
|
|
10
|
+
* with the doc skeleton.
|
|
10
11
|
*/
|
|
11
|
-
export declare class DocViewModelManagerService extends RxDisposable {
|
|
12
|
+
export declare class DocViewModelManagerService extends RxDisposable implements IRenderModule {
|
|
13
|
+
private readonly _context;
|
|
12
14
|
private readonly _univerInstanceService;
|
|
13
15
|
private _docViewModelMap;
|
|
14
16
|
private readonly _currentDocViewModel$;
|
|
15
17
|
readonly currentDocViewModel$: import('rxjs').Observable<Nullable<IDocumentViewModelManagerParam>>;
|
|
16
|
-
|
|
18
|
+
private readonly _docViewModelAdd$;
|
|
19
|
+
readonly docViewModelAdd$: import('rxjs').Observable<DocumentViewModel>;
|
|
20
|
+
constructor(_context: IRenderContext<DocumentDataModel>, _univerInstanceService: IUniverInstanceService);
|
|
17
21
|
private _initialize;
|
|
18
22
|
dispose(): void;
|
|
19
23
|
private _init;
|
|
@@ -14,6 +14,7 @@ export interface ITextActiveRange {
|
|
|
14
14
|
direction: RANGE_DIRECTION;
|
|
15
15
|
segmentId: string;
|
|
16
16
|
style: ITextSelectionStyle;
|
|
17
|
+
segmentPage: number;
|
|
17
18
|
}
|
|
18
19
|
interface ITextSelectionManagerInsertParam extends ITextSelectionManagerSearchParam, ITextSelectionInnerParam {
|
|
19
20
|
}
|