@univerjs/docs 0.1.0-beta.4 → 0.1.1

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.
Files changed (36) hide show
  1. package/lib/cjs/index.js +1 -2
  2. package/lib/es/index.js +1167 -2121
  3. package/lib/types/commands/commands/ime-input.command.d.ts +2 -5
  4. package/lib/types/commands/commands/list.command.d.ts +4 -4
  5. package/lib/types/commands/mutations/core-editing.mutation.d.ts +10 -4
  6. package/lib/types/commands/operations/text-selection.operation.d.ts +3 -2
  7. package/lib/types/controllers/ime-input.controller.d.ts +3 -5
  8. package/lib/types/controllers/text-selection.controller.d.ts +3 -9
  9. package/lib/types/index.d.ts +8 -4
  10. package/lib/types/services/doc-skeleton-manager.service.d.ts +6 -3
  11. package/lib/types/services/doc-state-change-manager.service.d.ts +45 -0
  12. package/lib/types/services/doc-view-model-manager.service.d.ts +3 -2
  13. package/lib/types/services/ime-input-manager.service.d.ts +11 -0
  14. package/lib/types/services/text-selection-manager.service.d.ts +4 -3
  15. package/lib/umd/index.js +1 -2
  16. package/package.json +24 -15
  17. package/lib/types/commands/commands/clipboard.command.d.ts +0 -20
  18. package/lib/types/controllers/clipboard.controller.d.ts +0 -29
  19. package/lib/types/controllers/doc-render.controller.d.ts +0 -27
  20. package/lib/types/controllers/floating-object.controller.d.ts +0 -33
  21. package/lib/types/controllers/page-render.controller.d.ts +0 -25
  22. package/lib/types/controllers/zoom.controller.d.ts +0 -36
  23. package/lib/types/services/clipboard/__test__/html-and-udm-convert.spec.d.ts +0 -16
  24. package/lib/types/services/clipboard/clipboard.service.d.ts +0 -55
  25. package/lib/types/services/clipboard/copy-content-cache.d.ts +0 -25
  26. package/lib/types/services/clipboard/html-to-udm/converter.d.ts +0 -30
  27. package/lib/types/services/clipboard/html-to-udm/parse-node-style.d.ts +0 -17
  28. package/lib/types/services/clipboard/html-to-udm/parse-to-dom.d.ts +0 -16
  29. package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-lark.d.ts +0 -18
  30. package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-word.d.ts +0 -18
  31. package/lib/types/services/clipboard/html-to-udm/paste-plugins/type.d.ts +0 -30
  32. package/lib/types/services/clipboard/html-to-udm/utils.d.ts +0 -18
  33. package/lib/types/services/clipboard/udm-to-html/convertor.d.ts +0 -19
  34. package/lib/types/shortcuts/core-editing.shortcut.d.ts +0 -19
  35. package/lib/types/shortcuts/cursor.shortcut.d.ts +0 -25
  36. package/lib/types/views/doc-canvas-view.d.ts +0 -34
@@ -13,15 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ICommand, ITextRange } from '@univerjs/core';
17
- import type { ITextRangeWithStyle } from '@univerjs/engine-render';
16
+ import type { ICommand } from '@univerjs/core';
18
17
  export interface IIMEInputCommandParams {
19
18
  unitId: string;
20
19
  newText: string;
21
20
  oldTextLen: number;
22
- range: ITextRange;
23
- textRanges: ITextRangeWithStyle[];
21
+ isCompositionStart: boolean;
24
22
  isCompositionEnd: boolean;
25
- segmentId?: string;
26
23
  }
27
24
  export declare const IMEInputCommand: ICommand<IIMEInputCommandParams>;
@@ -15,14 +15,14 @@
15
15
  */
16
16
  import type { ICommand } from '@univerjs/core';
17
17
  import { PresetListType } from '@univerjs/core';
18
+ interface IListOperationCommandParams {
19
+ listType: PresetListType;
20
+ }
21
+ export declare const ListOperationCommand: ICommand<IListOperationCommandParams>;
18
22
  interface IBulletListCommandParams {
19
23
  }
20
24
  export declare const BulletListCommand: ICommand<IBulletListCommandParams>;
21
25
  interface IOrderListCommandParams {
22
26
  }
23
27
  export declare const OrderListCommand: ICommand<IOrderListCommandParams>;
24
- interface IListOperationCommandParams {
25
- listType: PresetListType;
26
- }
27
- export declare const ListOperationCommand: ICommand<IListOperationCommandParams>;
28
28
  export {};
@@ -13,13 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { type IMutation, type TextXAction } from '@univerjs/core';
17
- export interface IRichTextEditingMutationParams {
16
+ import type { IMutation, IMutationCommonParams, Nullable, TextXAction } from '@univerjs/core';
17
+ import type { ITextRangeWithStyle } from '@univerjs/engine-render';
18
+ export interface IRichTextEditingMutationParams extends IMutationCommonParams {
18
19
  unitId: string;
19
- mutations: TextXAction[];
20
+ actions: TextXAction[];
21
+ textRanges: Nullable<ITextRangeWithStyle[]>;
22
+ prevTextRanges?: Nullable<ITextRangeWithStyle[]>;
23
+ noNeedSetTextRange?: boolean;
24
+ noHistory?: boolean;
25
+ isCompositionEnd?: boolean;
20
26
  }
21
27
  /**
22
- * The core mutator to change rich text mutations. The execution result would be undo mutation params. Could be directly
28
+ * The core mutator to change rich text actions. The execution result would be undo mutation params. Could be directly
23
29
  * send to undo redo service (will be used by the triggering command).
24
30
  */
25
31
  export declare const RichTextEditingMutation: IMutation<IRichTextEditingMutationParams, IRichTextEditingMutationParams>;
@@ -14,12 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IOperation } from '@univerjs/core';
17
- import type { ITextSelectionStyle, TextRange } from '@univerjs/engine-render';
17
+ import type { ITextRangeWithStyle, ITextSelectionStyle } from '@univerjs/engine-render';
18
18
  export interface ISetTextSelectionsOperationParams {
19
19
  unitId: string;
20
20
  subUnitId: string;
21
21
  segmentId: string;
22
+ isEditing: boolean;
22
23
  style: ITextSelectionStyle;
23
- ranges: TextRange[];
24
+ ranges: ITextRangeWithStyle[];
24
25
  }
25
26
  export declare const SetTextSelectionsOperation: IOperation<ISetTextSelectionsOperationParams>;
@@ -14,22 +14,21 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
17
- import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
17
+ import { ITextSelectionRenderManager } from '@univerjs/engine-render';
18
18
  import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
19
19
  import { IMEInputManagerService } from '../services/ime-input-manager.service';
20
20
  export declare class IMEInputController extends Disposable {
21
21
  private readonly _docSkeletonManagerService;
22
22
  private readonly _currentUniverService;
23
- private readonly _renderManagerService;
24
23
  private readonly _textSelectionRenderManager;
25
24
  private readonly _imeInputManagerService;
26
25
  private readonly _commandService;
27
26
  private _previousIMEContent;
28
- private _previousIMERange;
27
+ private _isCompositionStart;
29
28
  private _onStartSubscription;
30
29
  private _onUpdateSubscription;
31
30
  private _onEndSubscription;
32
- constructor(_docSkeletonManagerService: DocSkeletonManagerService, _currentUniverService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _imeInputManagerService: IMEInputManagerService, _commandService: ICommandService);
31
+ constructor(_docSkeletonManagerService: DocSkeletonManagerService, _currentUniverService: IUniverInstanceService, _textSelectionRenderManager: ITextSelectionRenderManager, _imeInputManagerService: IMEInputManagerService, _commandService: ICommandService);
33
32
  dispose(): void;
34
33
  private _initialize;
35
34
  private _initialOnCompositionstart;
@@ -37,5 +36,4 @@ export declare class IMEInputController extends Disposable {
37
36
  private _initialOnCompositionend;
38
37
  private _updateContent;
39
38
  private _resetIME;
40
- private _getDocObject;
41
39
  }
@@ -15,7 +15,6 @@
15
15
  */
16
16
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
17
17
  import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
18
- import { LayoutService } from '@univerjs/ui';
19
18
  import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';
20
19
  import { TextSelectionManagerService } from '../services/text-selection-manager.service';
21
20
  export declare class TextSelectionController extends Disposable {
@@ -25,16 +24,11 @@ export declare class TextSelectionController extends Disposable {
25
24
  private readonly _renderManagerService;
26
25
  private readonly _textSelectionRenderManager;
27
26
  private readonly _textSelectionManagerService;
28
- private readonly _layoutService?;
29
- private _moveInObserver;
30
- private _moveOutObserver;
31
- private _downObserver;
32
- private _dblClickObserver;
33
- private _tripleClickObserver;
34
27
  private _loadedMap;
35
- constructor(_docSkeletonManagerService: DocSkeletonManagerService, _currentUniverService: IUniverInstanceService, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _textSelectionManagerService: TextSelectionManagerService, _layoutService?: LayoutService | undefined);
28
+ constructor(_docSkeletonManagerService: DocSkeletonManagerService, _currentUniverService: IUniverInstanceService, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _textSelectionManagerService: TextSelectionManagerService);
36
29
  private _initialize;
37
- dispose(): void;
30
+ private _init;
31
+ private _create;
38
32
  private _initialMain;
39
33
  private _commandExecutedListener;
40
34
  private _skeletonListener;
@@ -17,7 +17,6 @@ export type { IDocObjectParam } from './basics/component-tools';
17
17
  export { getDocObject } from './basics/component-tools';
18
18
  export * from './basics/docs-view-key';
19
19
  export { BreakLineCommand } from './commands/commands/break-line.command';
20
- export { DocCopyCommand, DocCutCommand, DocPasteCommand } from './commands/commands/clipboard.command';
21
20
  export { DeleteCommand, type ICoverCommandParams, type IDeleteCommandParams, type IInsertCommandParams, InsertCommand, type IUpdateCommandParams, UpdateCommand, } from './commands/commands/core-editing.command';
22
21
  export { DeleteLeftCommand, DeleteRightCommand } from './commands/commands/delete.command';
23
22
  export { type IIMEInputCommandParams, IMEInputCommand } from './commands/commands/ime-input.command';
@@ -28,7 +27,12 @@ export { type IRichTextEditingMutationParams, RichTextEditingMutation, } from '.
28
27
  export { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/cursor.operation';
29
28
  export { type ISetTextSelectionsOperationParams, SetTextSelectionsOperation, } from './commands/operations/text-selection.operation';
30
29
  export { type IUniverDocsConfig, UniverDocsPlugin } from './doc-plugin';
31
- export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
30
+ export { DocSkeletonManagerService, type IDocSkeletonManagerParam } from './services/doc-skeleton-manager.service';
32
31
  export { DocViewModelManagerService } from './services/doc-view-model-manager.service';
33
- export { TextSelectionManagerService } from './services/text-selection-manager.service';
34
- export { DocCanvasView } from './views/doc-canvas-view';
32
+ export { TextSelectionManagerService, serializeTextRange } from './services/text-selection-manager.service';
33
+ export { DocStateChangeManagerService, type IDocStateChangeParams } from './services/doc-state-change-manager.service';
34
+ export { IMEInputManagerService } from './services/ime-input-manager.service';
35
+ export { SelectAllOperation } from './commands/operations/select-all.operation';
36
+ export { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
37
+ export { SetDocZoomRatioOperation } from './commands/operations/set-doc-zoom-ratio.operation';
38
+ export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
- import { LocaleService, RxDisposable } from '@univerjs/core';
17
+ import { IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
18
18
  import { DocumentSkeleton } from '@univerjs/engine-render';
19
19
  import { DocViewModelManagerService } from './doc-view-model-manager.service';
20
20
  export interface IDocSkeletonManagerParam {
@@ -23,21 +23,24 @@ export interface IDocSkeletonManagerParam {
23
23
  dirty: boolean;
24
24
  }
25
25
  /**
26
- * This service is for worksheet build sheet skeleton.
26
+ * This service is for document build and manage doc skeletons.
27
27
  */
28
28
  export declare class DocSkeletonManagerService extends RxDisposable {
29
29
  private readonly _localeService;
30
30
  private readonly _docViewModelManagerService;
31
+ private readonly _currentUniverService;
31
32
  private _currentSkeletonUnitId;
32
33
  private _docSkeletonMap;
33
34
  private readonly _currentSkeleton$;
34
35
  readonly currentSkeleton$: import("rxjs").Observable<Nullable<IDocSkeletonManagerParam>>;
35
36
  private readonly _currentSkeletonBefore$;
36
37
  readonly currentSkeletonBefore$: import("rxjs").Observable<Nullable<IDocSkeletonManagerParam>>;
37
- constructor(_localeService: LocaleService, _docViewModelManagerService: DocViewModelManagerService);
38
+ constructor(_localeService: LocaleService, _docViewModelManagerService: DocViewModelManagerService, _currentUniverService: IUniverInstanceService);
38
39
  private _initialize;
39
40
  dispose(): void;
41
+ private _init;
40
42
  getCurrent(): Nullable<IDocSkeletonManagerParam>;
43
+ getAllSkeleton(): Map<string, IDocSkeletonManagerParam>;
41
44
  makeDirtyCurrent(state?: boolean): void;
42
45
  makeDirty(unitId: string, state?: boolean): void;
43
46
  getSkeletonByUnitId(unitId: string): Nullable<IDocSkeletonManagerParam>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { Nullable, TextXAction } from '@univerjs/core';
17
+ import { ICommandService, IUndoRedoService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
18
+ import type { ITextRangeWithStyle } from '@univerjs/engine-render';
19
+ interface IDocChangeState {
20
+ actions: TextXAction[];
21
+ textRanges: Nullable<ITextRangeWithStyle[]>;
22
+ }
23
+ export interface IDocStateChangeParams {
24
+ commandId: string;
25
+ unitId: string;
26
+ trigger: Nullable<string>;
27
+ redoState: IDocChangeState;
28
+ undoState: IDocChangeState;
29
+ noHistory?: boolean;
30
+ }
31
+ export declare class DocStateChangeManagerService extends RxDisposable {
32
+ private _undoRedoService;
33
+ private readonly _commandService;
34
+ private readonly _univerInstanceService;
35
+ private readonly _docStateChange$;
36
+ readonly docStateChange$: import("rxjs").Observable<Nullable<IDocStateChangeParams>>;
37
+ private _stateCache;
38
+ private _timer;
39
+ constructor(_undoRedoService: IUndoRedoService, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
40
+ setChangeState(changeState: IDocStateChangeParams): void;
41
+ private _initialize;
42
+ private _cacheChangeState;
43
+ private _pushHistory;
44
+ }
45
+ export {};
@@ -25,14 +25,15 @@ export interface IDocumentViewModelManagerParam {
25
25
  */
26
26
  export declare class DocViewModelManagerService extends RxDisposable {
27
27
  private readonly _currentUniverService;
28
- private _currentViewModelUnitId;
29
28
  private _docViewModelMap;
30
29
  private readonly _currentDocViewModel$;
31
30
  readonly currentDocViewModel$: import("rxjs").Observable<Nullable<IDocumentViewModelManagerParam>>;
32
31
  constructor(_currentUniverService: IUniverInstanceService);
33
32
  private _initialize;
34
33
  dispose(): void;
35
- getCurrent(): IDocumentViewModelManagerParam | undefined;
34
+ private _init;
35
+ private _create;
36
+ getAllModel(): Map<string, IDocumentViewModelManagerParam>;
36
37
  getViewModel(unitId: string): DocumentViewModel | undefined;
37
38
  private _setCurrent;
38
39
  private _buildDocViewModel;
@@ -17,11 +17,21 @@ import type { Nullable } from '@univerjs/core';
17
17
  import type { ITextRangeWithStyle } from '@univerjs/engine-render';
18
18
  import type { IDisposable } from '@wendellhu/redi';
19
19
  import type { IRichTextEditingMutationParams } from '../commands/mutations/core-editing.mutation';
20
+ interface ICacheParams {
21
+ undoCache: IRichTextEditingMutationParams[];
22
+ redoCache: IRichTextEditingMutationParams[];
23
+ }
20
24
  export declare class IMEInputManagerService implements IDisposable {
21
25
  private _previousActiveRange;
22
26
  private _undoMutationParamsCache;
23
27
  private _redoMutationParamsCache;
24
28
  clearUndoRedoMutationParamsCache(): void;
29
+ getUndoRedoMutationParamsCache(): {
30
+ undoCache: IRichTextEditingMutationParams[];
31
+ redoCache: IRichTextEditingMutationParams[];
32
+ };
33
+ setUndoRedoMutationParamsCache({ undoCache, redoCache }: ICacheParams): void;
34
+ getActiveRange(): Nullable<ITextRangeWithStyle>;
25
35
  setActiveRange(range: Nullable<ITextRangeWithStyle>): void;
26
36
  pushUndoRedoMutationParams(undoParams: IRichTextEditingMutationParams, redoParams: IRichTextEditingMutationParams): void;
27
37
  fetchComposedUndoRedoMutationParams(): {
@@ -31,3 +41,4 @@ export declare class IMEInputManagerService implements IDisposable {
31
41
  } | null;
32
42
  dispose(): void;
33
43
  }
44
+ export {};
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { Nullable } from '@univerjs/core';
17
17
  import { ICommandService, RxDisposable } from '@univerjs/core';
18
- import type { INodePosition, ISuccinctTextRangeParam, ITextSelectionInnerParam, ITextSelectionStyle, RANGE_DIRECTION, TextRange } from '@univerjs/engine-render';
18
+ import type { INodePosition, ISuccinctTextRangeParam, ITextRangeWithStyle, ITextSelectionInnerParam, ITextSelectionStyle, RANGE_DIRECTION, TextRange } from '@univerjs/engine-render';
19
19
  import { ITextSelectionRenderManager } from '@univerjs/engine-render';
20
20
  interface ITextSelectionManagerSearchParam {
21
21
  unitId: string;
@@ -33,6 +33,7 @@ export interface ITextActiveRange {
33
33
  }
34
34
  interface ITextSelectionManagerInsertParam extends ITextSelectionManagerSearchParam, ITextSelectionInnerParam {
35
35
  }
36
+ export declare function serializeTextRange(textRange: TextRange): ITextRangeWithStyle;
36
37
  /**
37
38
  * This service is for text selection.
38
39
  */
@@ -52,8 +53,8 @@ export declare class TextSelectionManagerService extends RxDisposable {
52
53
  setCurrentSelectionNotRefresh(param: ITextSelectionManagerSearchParam): void;
53
54
  getSelections(): Readonly<Nullable<TextRange[]>>;
54
55
  getActiveRange(): Nullable<ITextActiveRange>;
55
- add(textRanges: ISuccinctTextRangeParam[]): void;
56
- replaceTextRanges(textRanges: ISuccinctTextRangeParam[]): void;
56
+ add(textRanges: ISuccinctTextRangeParam[], isEditing?: boolean): void;
57
+ replaceTextRanges(textRanges: ISuccinctTextRangeParam[], isEditing?: boolean): void;
57
58
  private _syncSelectionFromRenderService;
58
59
  private _replaceTextRangesWithNoRefresh;
59
60
  private _getTextRanges;