@univerjs/docs-ui 0.2.11 → 0.2.13

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 (94) hide show
  1. package/lib/cjs/index.js +28 -6
  2. package/lib/es/index.js +9750 -4046
  3. package/lib/index.css +1 -1
  4. package/lib/locale/en-US.json +3 -1
  5. package/lib/locale/ru-RU.json +3 -1
  6. package/lib/locale/vi-VN.json +3 -1
  7. package/lib/locale/zh-CN.json +3 -1
  8. package/lib/locale/zh-TW.json +3 -1
  9. package/lib/types/basics/__tests__/plain-text.spec.d.ts +16 -0
  10. package/lib/types/basics/component-tools.d.ts +17 -0
  11. package/lib/types/basics/const/default-univer-doc-config.d.ts +0 -34
  12. package/lib/types/basics/const/plugin-name.d.ts +1 -1
  13. package/lib/types/basics/custom-decoration-factory.d.ts +24 -0
  14. package/lib/types/basics/custom-range-factory.d.ts +25 -0
  15. package/lib/types/basics/docs-view-key.d.ts +30 -0
  16. package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts +15 -8
  17. package/lib/types/basics/paragraph.d.ts +2 -0
  18. package/lib/types/basics/plain-text.d.ts +11 -0
  19. package/lib/types/basics/replace.d.ts +20 -0
  20. package/lib/types/basics/table.d.ts +16 -0
  21. package/lib/types/commands/commands/__tests__/clipboard.command.spec.d.ts +16 -0
  22. package/lib/types/commands/commands/__tests__/core-editing.command.spec.d.ts +16 -0
  23. package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +34 -0
  24. package/lib/types/commands/commands/__tests__/inline-format.command.spec.d.ts +16 -0
  25. package/lib/types/commands/commands/__tests__/replace-content.command.spec.d.ts +16 -0
  26. package/lib/types/commands/commands/auto-format.command.d.ts +7 -0
  27. package/lib/types/commands/commands/break-line.command.d.ts +3 -0
  28. package/lib/types/commands/commands/clipboard.inner.command.d.ts +16 -0
  29. package/lib/types/commands/commands/core-editing.command.d.ts +44 -0
  30. package/lib/types/commands/commands/delete.command.d.ts +19 -0
  31. package/lib/types/commands/commands/doc-paragraph-setting.command.d.ts +4 -1
  32. package/lib/types/commands/commands/ime-input.command.d.ts +9 -0
  33. package/lib/types/commands/commands/inline-format.command.d.ts +17 -0
  34. package/lib/types/commands/commands/list.command.d.ts +42 -0
  35. package/lib/types/commands/commands/paragraph-align.command.d.ts +18 -0
  36. package/lib/types/commands/commands/replace-content.command.d.ts +26 -0
  37. package/lib/types/commands/commands/set-doc-zoom-ratio.command.d.ts +6 -0
  38. package/lib/types/commands/commands/table/doc-table-create.command.d.ts +10 -0
  39. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +10 -0
  40. package/lib/types/commands/commands/table/doc-table-insert.command.d.ts +34 -0
  41. package/lib/types/commands/commands/table/doc-table-tab.command.d.ts +5 -0
  42. package/lib/types/commands/commands/table/table.d.ts +93 -0
  43. package/lib/types/commands/operations/doc-cursor.operation.d.ts +12 -0
  44. package/lib/types/commands/operations/select-all.operation.d.ts +5 -0
  45. package/lib/types/commands/operations/set-doc-zoom-ratio.operation.d.ts +7 -0
  46. package/lib/types/commands/util.d.ts +9 -0
  47. package/lib/types/controllers/app-ui-controller.d.ts +2 -19
  48. package/lib/types/controllers/config.schema.d.ts +12 -0
  49. package/lib/types/controllers/doc-auto-format.controller.d.ts +1 -1
  50. package/lib/types/controllers/doc-container-ui-controller.d.ts +5 -5
  51. package/lib/types/controllers/doc-header-footer.controller.d.ts +6 -5
  52. package/lib/types/controllers/doc-move-cursor.controller.d.ts +20 -0
  53. package/lib/types/controllers/doc-paragraph-setting.controller.d.ts +2 -0
  54. package/lib/types/controllers/doc-ui.controller.d.ts +5 -6
  55. package/lib/types/controllers/menu/context-menu.d.ts +2 -0
  56. package/lib/types/controllers/menu/menu.d.ts +1 -1
  57. package/lib/types/controllers/menu.schema.d.ts +2 -0
  58. package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +4 -4
  59. package/lib/types/controllers/render-controllers/doc-checklist.render-controller.d.ts +3 -3
  60. package/lib/types/controllers/render-controllers/doc-clipboard.controller.d.ts +14 -0
  61. package/lib/types/controllers/render-controllers/{contextmenu.render-controller.d.ts → doc-contextmenu.render-controller.d.ts} +3 -5
  62. package/lib/types/controllers/render-controllers/doc-editor-bridge.controller.d.ts +27 -0
  63. package/lib/types/controllers/render-controllers/doc-ime-input.controller.d.ts +25 -0
  64. package/lib/types/controllers/render-controllers/doc-input.controller.d.ts +15 -0
  65. package/lib/types/controllers/render-controllers/doc-resize.render-controller.d.ts +2 -2
  66. package/lib/types/controllers/render-controllers/{text-selection.render-controller.d.ts → doc-selection-render.controller.d.ts} +9 -6
  67. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +2 -2
  68. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +4 -4
  69. package/lib/types/docs-ui-plugin.d.ts +4 -3
  70. package/lib/types/index.d.ts +62 -10
  71. package/lib/types/locale/zh-CN.d.ts +2 -0
  72. package/lib/types/services/clipboard/clipboard.service.d.ts +5 -6
  73. package/lib/types/services/clipboard/html-to-udm/converter.d.ts +2 -0
  74. package/lib/types/services/doc-auto-format.service.d.ts +38 -0
  75. package/lib/types/services/doc-event-manager.service.d.ts +3 -1
  76. package/lib/types/services/doc-ime-input-manager.service.d.ts +30 -0
  77. package/lib/types/services/doc-page-layout.service.d.ts +1 -1
  78. package/lib/types/services/doc-popup-manager.service.d.ts +13 -5
  79. package/lib/types/services/doc-state-change-manager.service.d.ts +23 -0
  80. package/lib/types/services/selection/convert-rect-range.d.ts +27 -0
  81. package/lib/types/services/selection/convert-text-range.d.ts +60 -0
  82. package/lib/types/services/selection/doc-selection-render.service.d.ts +121 -0
  83. package/lib/types/services/selection/range-interface.d.ts +19 -0
  84. package/lib/types/services/selection/rect-range.d.ts +47 -0
  85. package/lib/types/services/selection/selection-utils.d.ts +26 -0
  86. package/lib/types/services/selection/text-range.d.ts +63 -0
  87. package/lib/types/types/const/padding.d.ts +16 -0
  88. package/lib/types/types/delete-direction.d.ts +19 -0
  89. package/lib/types/views/doc-container/DocContainer.d.ts +1 -1
  90. package/lib/types/views/paragraph-setting/hook/utils.d.ts +6 -2
  91. package/lib/umd/index.js +28 -6
  92. package/package.json +17 -17
  93. package/lib/types/controllers/clipboard.controller.d.ts +0 -14
  94. package/lib/types/controllers/doc-editor-bridge.controller.d.ts +0 -23
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-panel{padding-top:20px;font-size:var(--font-size-sm)}.univer-options-section{margin-top:10px;padding-bottom:10px}.univer-options-form-item{display:block;margin-bottom:5px}.univer-options-input{width:80%;margin-top:5px}.univer-options-margin-setting{display:flex}.univer-doc-count-bar{display:flex;flex:0 0 260px;justify-content:flex-end}.univer-doc-footer-container{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 var(--padding-xl)}.univer-doc-list-type-picker{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;padding:var(--padding-sm);width:240px;margin-bottom:-var(--margin-xs)}.univer-doc-list-type-picker-item{width:72px;height:81px;border-radius:4px;border:1px solid rgb(var(--border-color));margin-bottom:var(--margin-xs)}.univer-doc-list-type-picker-item:hover,.univer-doc-list-type-picker-item-active{border:1px solid rgb(var(--blue-400))}.univer-paragraph-setting-icon-list{display:flex;width:100%;padding:4px;align-items:center;gap:4px;justify-content:space-between;border:1px solid var(---Grey-200, #e5e5e5);border-radius:var(--radius-m, 6px)}.univer-paragraph-setting-icon-list-item{padding:4px 14px;border-radius:4px;background:none;display:flex;justify-content:center;align-items:center;cursor:pointer}.univer-paragraph-setting-icon-list-item:hover{background:var(--black-6, rgba(30, 34, 43, .06))}.univer-paragraph-setting-icon-list-item.univer-paragraph-setting-icon-list-active{background:var(--black-9, rgba(30, 34, 43, .09))}.univer-paragraph-setting-title{margin-top:var(--margin-base);font-size:13px;color:#1e222b;font-weight:500}.univer-paragraph-setting-label{font-size:12px;margin-top:var(--margin-sm);color:#1e222b;font-weight:400}.univer-paragraph-setting-mt-base{margin-top:var(--margin-base)}.univer-paragraph-setting-flex-col{display:flex;justify-content:space-between;align-items:center}.univer-create{padding:20px auto;display:flex;align-content:center;justify-content:space-between}.univer-create-item{display:flex;align-items:center}.univer-create-label{margin-right:5px}.univer-create-input{width:110px}
1
+ .univer-panel{padding-top:20px;font-size:var(--font-size-sm)}.univer-options-section{margin-top:10px;padding-bottom:10px}.univer-options-form-item{display:block;margin-bottom:5px}.univer-options-input{width:80%;margin-top:5px}.univer-options-margin-setting{display:flex}.univer-doc-list-type-picker{display:flex;flex-direction:row;justify-content:space-between;flex-wrap:wrap;padding:var(--padding-sm);width:240px;margin-bottom:-var(--margin-xs)}.univer-doc-list-type-picker-item{width:72px;height:81px;border-radius:4px;border:1px solid rgb(var(--border-color));margin-bottom:var(--margin-xs)}.univer-doc-list-type-picker-item:hover,.univer-doc-list-type-picker-item-active{border:1px solid rgb(var(--blue-400))}.univer-doc-count-bar{display:flex;flex:0 0 260px;justify-content:flex-end}.univer-doc-footer-container{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0 var(--padding-xl)}.univer-paragraph-setting-icon-list{display:flex;width:100%;padding:4px;align-items:center;gap:4px;justify-content:space-between;border:1px solid var(---Grey-200, #e5e5e5);border-radius:var(--radius-m, 6px)}.univer-paragraph-setting-icon-list-item{padding:4px 14px;border-radius:4px;background:none;display:flex;justify-content:center;align-items:center;cursor:pointer}.univer-paragraph-setting-icon-list-item:hover{background:var(--black-6, rgba(30, 34, 43, .06))}.univer-paragraph-setting-icon-list-item.univer-paragraph-setting-icon-list-active{background:var(--black-9, rgba(30, 34, 43, .09))}.univer-paragraph-setting-title{margin-top:var(--margin-base);font-size:13px;color:#1e222b;font-weight:500}.univer-paragraph-setting-label{font-size:12px;margin-top:var(--margin-sm);color:#1e222b;font-weight:400}.univer-paragraph-setting-mt-base{margin-top:var(--margin-base)}.univer-paragraph-setting-flex-col{display:flex;justify-content:space-between;align-items:center}.univer-paragraph-setting-space-line{display:flex;flex-direction:column;gap:6px}.univer-create{padding:20px auto;display:flex;align-content:center;justify-content:space-between}.univer-create-item{display:flex;align-items:center}.univer-create-label{margin-right:5px}.univer-create-input{width:110px}
@@ -73,7 +73,9 @@
73
73
  "spacing": "Spacing",
74
74
  "before": "Before",
75
75
  "after": "After",
76
- "lineSpace": "Line Space"
76
+ "lineSpace": "Line Space",
77
+ "multiSpace": "Multi Space",
78
+ "fixedValue": "Fixed Value(px)"
77
79
  }
78
80
  }
79
81
  }
@@ -73,7 +73,9 @@
73
73
  "spacing": "Spacing",
74
74
  "before": "Before",
75
75
  "after": "After",
76
- "lineSpace": "Line Space"
76
+ "lineSpace": "Line Space",
77
+ "multiSpace": "Multi Space",
78
+ "fixedValue": "Fixed Value(px)"
77
79
  }
78
80
  }
79
81
  }
@@ -73,7 +73,9 @@
73
73
  "spacing": "Spacing",
74
74
  "before": "Before",
75
75
  "after": "After",
76
- "lineSpace": "Line Space"
76
+ "lineSpace": "Line Space",
77
+ "multiSpace": "Multi Space",
78
+ "fixedValue": "Fixed Value(px)"
77
79
  }
78
80
  }
79
81
  }
@@ -73,7 +73,9 @@
73
73
  "spacing": "间距",
74
74
  "before": "段落前",
75
75
  "after": "段落后",
76
- "lineSpace": "行距"
76
+ "lineSpace": "行距",
77
+ "multiSpace": "多倍行距",
78
+ "fixedValue": "固定值(px)"
77
79
  }
78
80
  }
79
81
  }
@@ -73,7 +73,9 @@
73
73
  "spacing": "Spacing",
74
74
  "before": "Before",
75
75
  "after": "After",
76
- "lineSpace": "Line Space"
76
+ "lineSpace": "Line Space",
77
+ "multiSpace": "Multi Space",
78
+ "fixedValue": "Fixed Value(px)"
77
79
  }
78
80
  }
79
81
  }
@@ -0,0 +1,16 @@
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
+ export {};
@@ -0,0 +1,17 @@
1
+ import { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
2
+ import { DocBackground, Documents, Engine, IRenderContext, IRenderManagerService, Scene } from '@univerjs/engine-render';
3
+ export interface IDocObjectParam {
4
+ document: Documents;
5
+ docBackground: DocBackground;
6
+ scene: Scene;
7
+ engine: Engine;
8
+ }
9
+ export declare function neoGetDocObject(renderContext: IRenderContext<DocumentDataModel>): {
10
+ document: Documents;
11
+ docBackground: DocBackground;
12
+ scene: Scene;
13
+ engine: Engine;
14
+ };
15
+ /** @deprecated After migrating to `RenderUnit`, use `neoGetDocObject` instead. */
16
+ export declare function getDocObject(univerInstanceService: IUniverInstanceService, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
17
+ export declare function getDocObjectById(unitId: string, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
@@ -43,37 +43,3 @@ export declare const DefaultDocContainerConfig: {
43
43
  infoBar: boolean;
44
44
  toolbar: boolean;
45
45
  };
46
- export declare const DefaultDocUiConfig: {
47
- layout: {
48
- docContainerConfig: {
49
- outerLeft: boolean;
50
- outerRight: boolean;
51
- header: boolean;
52
- footer: boolean;
53
- innerLeft: boolean;
54
- innerRight: boolean;
55
- frozenHeaderLT: boolean;
56
- frozenHeaderRT: boolean;
57
- frozenHeaderLM: boolean;
58
- frozenContent: boolean;
59
- infoBar: boolean;
60
- toolbar: boolean;
61
- };
62
- toolbarConfig: {
63
- undo: boolean;
64
- redo: boolean;
65
- font: boolean;
66
- fontSize: boolean;
67
- bold: boolean;
68
- italic: boolean;
69
- strikethrough: boolean;
70
- underline: boolean;
71
- textColor: boolean;
72
- fillColor: boolean;
73
- horizontalAlignMode: boolean;
74
- verticalAlignMode: boolean;
75
- textWrapMode: boolean;
76
- textRotateMode: boolean;
77
- };
78
- };
79
- };
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const DOC_UI_PLUGIN_NAME = "DocUI";
16
+ export declare const DOC_UI_PLUGIN_NAME = "DOC_UI_PLUGIN";
@@ -0,0 +1,24 @@
1
+ import { CustomDecorationType, IAccessor, IMutationInfo } from '@univerjs/core';
2
+ import { IRichTextEditingMutationParams } from '@univerjs/docs';
3
+ import { ITextRangeWithStyle } from '@univerjs/engine-render';
4
+ interface IAddCustomDecorationParam {
5
+ unitId: string;
6
+ ranges: ITextRangeWithStyle[];
7
+ segmentId?: string;
8
+ id: string;
9
+ type: CustomDecorationType;
10
+ }
11
+ export declare function addCustomDecorationFactory(param: IAddCustomDecorationParam): IMutationInfo<IRichTextEditingMutationParams>;
12
+ interface IAddCustomDecorationFactoryParam {
13
+ segmentId?: string;
14
+ id: string;
15
+ type: CustomDecorationType;
16
+ }
17
+ export declare function addCustomDecorationBySelectionFactory(accessor: IAccessor, param: IAddCustomDecorationFactoryParam): false | IMutationInfo<IRichTextEditingMutationParams>;
18
+ export interface IDeleteCustomRangeParam {
19
+ unitId: string;
20
+ id: string;
21
+ segmentId?: string;
22
+ }
23
+ export declare function deleteCustomDecorationFactory(accessor: IAccessor, params: IDeleteCustomRangeParam): false | IMutationInfo<IRichTextEditingMutationParams>;
24
+ export {};
@@ -0,0 +1,25 @@
1
+ import { CustomRangeType, IAccessor, IAddCustomRangeTextXParam, IDocumentBody, IMutationInfo, ITextRangeParam, Nullable, TextX } from '@univerjs/core';
2
+ import { IRichTextEditingMutationParams } from '@univerjs/docs';
3
+ interface IAddCustomRangeParam extends IAddCustomRangeTextXParam {
4
+ unitId: string;
5
+ }
6
+ export declare function addCustomRangeFactory(accessor: IAccessor, param: IAddCustomRangeParam, body: IDocumentBody): false | IMutationInfo<IRichTextEditingMutationParams>;
7
+ interface IAddCustomRangeFactoryParam {
8
+ rangeId: string;
9
+ rangeType: CustomRangeType;
10
+ wholeEntity?: boolean;
11
+ properties?: Record<string, any>;
12
+ unitId: string;
13
+ selection?: ITextRangeParam;
14
+ }
15
+ export declare function addCustomRangeBySelectionFactory(accessor: IAccessor, param: IAddCustomRangeFactoryParam): false | (IMutationInfo<IRichTextEditingMutationParams> & {
16
+ textX: TextX;
17
+ });
18
+ export interface IDeleteCustomRangeFactoryParams {
19
+ rangeId: string;
20
+ segmentId?: string;
21
+ unitId: string;
22
+ insert?: Nullable<IDocumentBody>;
23
+ }
24
+ export declare function deleteCustomRangeFactory(accessor: IAccessor, params: IDeleteCustomRangeFactoryParams): false | IMutationInfo<IRichTextEditingMutationParams>;
25
+ export {};
@@ -0,0 +1,30 @@
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
+ export declare enum DOCS_VIEW_KEY {
17
+ MAIN = "__Document_Render_Main__",
18
+ BACKGROUND = "__Document_Render_Background__"
19
+ }
20
+ export declare enum VIEWPORT_KEY {
21
+ VIEW_MAIN = "viewMain",
22
+ VIEW_TOP = "viewTop",
23
+ VIEW_LEFT = "viewLeft",
24
+ VIEW_LEFT_TOP = "viewLeftTop"
25
+ }
26
+ export declare const DOCS_COMPONENT_BACKGROUND_LAYER_INDEX = 0;
27
+ export declare const DOCS_COMPONENT_MAIN_LAYER_INDEX = 2;
28
+ export declare const DOCS_COMPONENT_HEADER_LAYER_INDEX = 4;
29
+ export declare const DOCS_COMPONENT_DEFAULT_Z_INDEX = 10;
30
+ export declare const NORMAL_TEXT_SELECTION_PLUGIN_NAME = "normalTextSelectionPluginName";
@@ -1,15 +1,22 @@
1
- import { DependencyOverride } from '@univerjs/core';
2
- import { MenuConfig } from '@univerjs/ui';
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
+ */
3
16
  export interface ILayout {
4
17
  docContainerConfig?: DocContainerConfig;
5
18
  toolbarConfig?: DocToolbarConfig;
6
19
  }
7
- export interface IUniverDocsUIConfig {
8
- menu?: MenuConfig;
9
- container?: HTMLElement | string;
10
- layout?: ILayout;
11
- override?: DependencyOverride;
12
- }
13
20
  export interface DocContainerConfig {
14
21
  outerLeft?: boolean;
15
22
  outerRight?: boolean;
@@ -0,0 +1,2 @@
1
+ import { ICustomTable, IParagraph } from '@univerjs/core';
2
+ export declare function hasParagraphInTable(paragraph: IParagraph, tables: ICustomTable[]): boolean;
@@ -0,0 +1,11 @@
1
+ import { IDocumentBody, IDocumentData } from '@univerjs/core';
2
+ export declare const getPlainText: (text: string) => string;
3
+ /**
4
+ * get plain text from rich-text
5
+ */
6
+ export declare const getPlainTextFormBody: (body: IDocumentBody) => string;
7
+ /**
8
+ * get plain text from rich-text
9
+ */
10
+ export declare const getPlainTextFormDocument: (data: IDocumentData) => string;
11
+ export declare function getSelectionText(dataStream: string, start: number, end: number): string;
@@ -0,0 +1,20 @@
1
+ import { DocumentDataModel, IAccessor, IDocumentBody, IMutationInfo, ITextRangeParam, TextX } from '@univerjs/core';
2
+ import { IRichTextEditingMutationParams } from '@univerjs/docs';
3
+ import { ITextRangeWithStyle } from '@univerjs/engine-render';
4
+ export interface IReplaceSelectionFactoryParams {
5
+ unitId: string;
6
+ /**
7
+ * slelection to be replaced, if not provided, use the current selection.
8
+ */
9
+ selection?: ITextRangeParam;
10
+ /** Body to be inserted at the given position. */
11
+ body: IDocumentBody;
12
+ /**
13
+ * Text ranges to be replaced.
14
+ */
15
+ textRanges?: ITextRangeWithStyle[];
16
+ doc?: DocumentDataModel;
17
+ }
18
+ export declare function replaceSelectionFactory(accessor: IAccessor, params: IReplaceSelectionFactoryParams): false | (IMutationInfo<IRichTextEditingMutationParams> & {
19
+ textX: TextX;
20
+ });
@@ -0,0 +1,16 @@
1
+ import { Nullable } from '@univerjs/core';
2
+ import { IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonTable } from '@univerjs/engine-render';
3
+ export declare function firstLineInTable(table: IDocumentSkeletonTable): IDocumentSkeletonLine;
4
+ export declare function lastLineInTable(table: IDocumentSkeletonTable): IDocumentSkeletonLine | undefined;
5
+ export declare function findTableAfterLine(line: IDocumentSkeletonLine, page: IDocumentSkeletonPage): IDocumentSkeletonTable | null;
6
+ export declare function findLineBeforeAndAfterTable(table: Nullable<IDocumentSkeletonTable>): {
7
+ lineBeforeTable: null;
8
+ lineAfterTable: null;
9
+ };
10
+ export declare function findBellowCell(cell: IDocumentSkeletonPage): IDocumentSkeletonPage | undefined;
11
+ export declare function findAboveCell(cell: IDocumentSkeletonPage): IDocumentSkeletonPage | undefined;
12
+ export declare function findTableBeforeLine(line: IDocumentSkeletonLine, page: IDocumentSkeletonPage): IDocumentSkeletonTable | null;
13
+ export declare function firstLineInCell(cell: IDocumentSkeletonPage): IDocumentSkeletonLine;
14
+ export declare function lastLineInCell(cell: IDocumentSkeletonPage): IDocumentSkeletonLine | undefined;
15
+ export declare function isFirstLineInCell(line: IDocumentSkeletonLine, cell: IDocumentSkeletonPage): boolean;
16
+ export declare function isLastLineInCell(line: IDocumentSkeletonLine, cell: IDocumentSkeletonPage): boolean;
@@ -0,0 +1,16 @@
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
+ export {};
@@ -0,0 +1,16 @@
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
+ export {};
@@ -0,0 +1,34 @@
1
+ import { Injector, IUniverInstanceService, RxDisposable, Univer, Dependency, DependencyIdentifier, DocumentDataModel, IDocumentData, Nullable } from '@univerjs/core';
2
+ import { DocumentViewModel, IRenderManagerService, DocumentSkeleton, IRender, IRenderContext, IRenderModule } from '@univerjs/engine-render';
3
+ export declare function createCommandTestBed(docData?: IDocumentData, dependencies?: Dependency[]): {
4
+ univer: Univer;
5
+ get: {
6
+ <T>(id: DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
7
+ <T>(id: DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
8
+ <T>(id: DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
9
+ <T>(id: DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
10
+ <T>(id: DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
11
+ <T>(id: DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
12
+ };
13
+ doc: DocumentDataModel;
14
+ };
15
+ export declare class MockRenderManagerService implements Pick<IRenderManagerService, 'getRenderById'> {
16
+ private readonly _injector;
17
+ constructor(_injector: Injector);
18
+ getRenderById(_unitId: string): Nullable<IRender>;
19
+ }
20
+ export declare class MockDocSkeletonManagerService extends RxDisposable implements IRenderModule {
21
+ private readonly _context;
22
+ private readonly _univerInstanceService;
23
+ private _docViewModel;
24
+ private readonly _currentSkeleton$;
25
+ readonly currentSkeleton$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
26
+ private readonly _currentSkeletonBefore$;
27
+ readonly currentSkeletonBefore$: import('rxjs').Observable<Nullable<DocumentSkeleton>>;
28
+ constructor(_context: IRenderContext<DocumentDataModel>, _univerInstanceService: IUniverInstanceService);
29
+ dispose(): void;
30
+ private _update;
31
+ getSkeleton(): DocumentSkeleton;
32
+ getViewModel(): DocumentViewModel;
33
+ private _buildDocViewModel;
34
+ }
@@ -0,0 +1,16 @@
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
+ export {};
@@ -0,0 +1,16 @@
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
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export interface ITabCommandParams {
3
+ shift?: boolean;
4
+ }
5
+ export declare const TabCommand: ICommand<ITabCommandParams>;
6
+ export declare const AfterSpaceCommand: ICommand;
7
+ export declare const EnterCommand: ICommand;
@@ -0,0 +1,3 @@
1
+ import { ICommand, IParagraph } from '@univerjs/core';
2
+ export declare function generateParagraphs(dataStream: string, prevParagraph?: IParagraph): IParagraph[];
3
+ export declare const BreakLineCommand: ICommand;
@@ -0,0 +1,16 @@
1
+ import { DocumentDataModel, ICommand, IDocumentBody, IDocumentData, ITextRange, JSONXActions, Nullable } from '@univerjs/core';
2
+ import { DocumentViewModel, IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
3
+ export declare function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[];
4
+ export interface IInnerPasteCommandParams {
5
+ segmentId: string;
6
+ doc: Partial<IDocumentData>;
7
+ textRanges: ITextRangeWithStyle[];
8
+ }
9
+ export declare const InnerPasteCommand: ICommand<IInnerPasteCommandParams>;
10
+ export declare function getCutActionsFromDocRanges(textRanges: Readonly<Nullable<ITextRangeWithStyle[]>>, rectRanges: Readonly<Nullable<IRectRangeWithStyle[]>>, docDataModel: DocumentDataModel, viewModel: DocumentViewModel, segmentId: string): JSONXActions;
11
+ export interface IInnerCutCommandParams {
12
+ segmentId: string;
13
+ textRanges: ITextRangeWithStyle[];
14
+ selections?: ITextRange[];
15
+ }
16
+ export declare const CutContentCommand: ICommand<IInnerCutCommandParams>;
@@ -0,0 +1,44 @@
1
+ import { ICommand, IDocumentBody, IDocumentData, ITextRange, UpdateDocsAttributeType } from '@univerjs/core';
2
+ import { ITextRangeWithStyle } from '@univerjs/engine-render';
3
+ import { DeleteDirection } from '../../types/delete-direction';
4
+ export interface IInsertCommandParams {
5
+ unitId: string;
6
+ body: IDocumentBody;
7
+ range: ITextRange;
8
+ segmentId?: string;
9
+ cursorOffset?: number;
10
+ extendLastRange?: boolean;
11
+ }
12
+ export declare const EditorInsertTextCommandId = "doc.command.insert-text";
13
+ /**
14
+ * The command to insert text. The changed range could be non-collapsed, mainly use in line break and normal input.
15
+ */
16
+ export declare const InsertCommand: ICommand<IInsertCommandParams>;
17
+ export interface IDeleteCommandParams {
18
+ unitId: string;
19
+ range: ITextRange;
20
+ direction: DeleteDirection;
21
+ len?: number;
22
+ segmentId?: string;
23
+ }
24
+ /**
25
+ * The command to delete text, mainly used in BACKSPACE and DELETE when collapsed is true. ONLY handle collapsed range!!!
26
+ */
27
+ export declare const DeleteCommand: ICommand<IDeleteCommandParams>;
28
+ export interface IUpdateCommandParams {
29
+ unitId: string;
30
+ updateBody: IDocumentBody;
31
+ range: ITextRange;
32
+ coverType: UpdateDocsAttributeType;
33
+ textRanges: ITextRangeWithStyle[];
34
+ segmentId?: string;
35
+ }
36
+ /**
37
+ * The command to update text properties, mainly used in BACKSPACE.
38
+ */
39
+ export declare const UpdateCommand: ICommand<IUpdateCommandParams>;
40
+ export interface ICoverCommandParams {
41
+ unitId: string;
42
+ snapshot?: IDocumentData;
43
+ clearUndoRedoStack?: boolean;
44
+ }
@@ -0,0 +1,19 @@
1
+ import { ICommand, Nullable } from '@univerjs/core';
2
+ import { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
3
+ import { DeleteDirection } from '../../types/delete-direction';
4
+ export interface IDeleteCustomBlockParams {
5
+ direction: DeleteDirection;
6
+ range: ITextRangeWithStyle;
7
+ unitId: string;
8
+ drawingId: string;
9
+ }
10
+ export declare const DeleteCustomBlockCommand: ICommand<IDeleteCustomBlockParams>;
11
+ interface IMergeTwoParagraphParams {
12
+ direction: DeleteDirection;
13
+ range: ITextRangeWithStyle;
14
+ }
15
+ export declare const MergeTwoParagraphCommand: ICommand<IMergeTwoParagraphParams>;
16
+ export declare function getCursorWhenDelete(textRanges: Readonly<Nullable<ITextRangeWithStyle[]>>, rectRanges: readonly IRectRangeWithStyle[]): number;
17
+ export declare const DeleteLeftCommand: ICommand;
18
+ export declare const DeleteRightCommand: ICommand;
19
+ export {};
@@ -1,3 +1,6 @@
1
1
  import { ICommand, IParagraphStyle } from '@univerjs/core';
2
- export type IDocParagraphSettingCommandParams = Partial<Pick<IParagraphStyle, 'hanging' | 'horizontalAlign' | 'spaceBelow' | 'spaceAbove' | 'indentEnd' | 'indentStart' | 'lineSpacing' | 'indentFirstLine'>>;
2
+ export interface IDocParagraphSettingCommandParams {
3
+ paragraph: Partial<Pick<IParagraphStyle, 'hanging' | 'horizontalAlign' | 'spaceBelow' | 'spaceAbove' | 'indentEnd' | 'indentStart' | 'lineSpacing' | 'indentFirstLine' | 'snapToGrid' | 'spacingRule'>>;
4
+ sections?: Record<string, any>;
5
+ }
3
6
  export declare const DocParagraphSettingCommand: ICommand<IDocParagraphSettingCommandParams>;
@@ -0,0 +1,9 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export interface IIMEInputCommandParams {
3
+ unitId: string;
4
+ newText: string;
5
+ oldTextLen: number;
6
+ isCompositionStart: boolean;
7
+ isCompositionEnd: boolean;
8
+ }
9
+ export declare const IMEInputCommand: ICommand<IIMEInputCommandParams>;
@@ -0,0 +1,17 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ export interface ISetInlineFormatCommandParams {
3
+ preCommandId: string;
4
+ value?: string;
5
+ }
6
+ export declare const SetInlineFormatBoldCommand: ICommand;
7
+ export declare const SetInlineFormatItalicCommand: ICommand;
8
+ export declare const SetInlineFormatUnderlineCommand: ICommand;
9
+ export declare const SetInlineFormatStrikethroughCommand: ICommand;
10
+ export declare const SetInlineFormatSubscriptCommand: ICommand;
11
+ export declare const SetInlineFormatSuperscriptCommand: ICommand;
12
+ export declare const SetInlineFormatFontSizeCommand: ICommand;
13
+ export declare const SetInlineFormatFontFamilyCommand: ICommand;
14
+ export declare const SetInlineFormatTextColorCommand: ICommand;
15
+ export declare const SetInlineFormatTextBackgroundColorCommand: ICommand;
16
+ export declare const ResetInlineFormatTextBackgroundColorCommand: ICommand;
17
+ export declare const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams>;
@@ -0,0 +1,42 @@
1
+ import { PresetListType, ICommand, IParagraph, IParagraphRange, ISectionBreak } from '@univerjs/core';
2
+ import { ITextRangeWithStyle } from '@univerjs/engine-render';
3
+ interface IListOperationCommandParams {
4
+ listType: PresetListType;
5
+ }
6
+ export declare const ListOperationCommand: ICommand<IListOperationCommandParams>;
7
+ interface IChangeListTypeCommandParams {
8
+ listType: PresetListType;
9
+ }
10
+ export declare const ChangeListTypeCommand: ICommand<IChangeListTypeCommandParams>;
11
+ export declare enum ChangeListNestingLevelType {
12
+ increase = 1,
13
+ decrease = -1
14
+ }
15
+ interface IChangeListNestingLevelCommandParams {
16
+ type: ChangeListNestingLevelType;
17
+ }
18
+ export declare const ChangeListNestingLevelCommand: ICommand<IChangeListNestingLevelCommandParams>;
19
+ interface IBulletListCommandParams {
20
+ value?: PresetListType;
21
+ }
22
+ export declare const BulletListCommand: ICommand<IBulletListCommandParams>;
23
+ export declare const CheckListCommand: ICommand<IBulletListCommandParams>;
24
+ export interface IToggleCheckListCommandParams {
25
+ index: number;
26
+ segmentId?: string;
27
+ }
28
+ export declare const ToggleCheckListCommand: ICommand<IToggleCheckListCommandParams>;
29
+ interface IOrderListCommandParams {
30
+ value?: PresetListType;
31
+ }
32
+ export declare const OrderListCommand: ICommand<IOrderListCommandParams>;
33
+ interface IQuickListCommandParams {
34
+ listType: PresetListType;
35
+ paragraph: IParagraphRange;
36
+ }
37
+ export declare const QuickListCommand: ICommand<IQuickListCommandParams>;
38
+ export declare function getParagraphsInRange(activeRange: ITextRangeWithStyle, paragraphs: IParagraph[]): IParagraph[];
39
+ export declare function getParagraphsRelative(ranges: ITextRangeWithStyle[], paragraphs: IParagraph[]): IParagraph[];
40
+ export declare function getParagraphsInRanges(ranges: ITextRangeWithStyle[], paragraphs: IParagraph[]): IParagraph[];
41
+ export declare function findNearestSectionBreak(currentIndex: number, sectionBreaks: ISectionBreak[]): ISectionBreak | undefined;
42
+ export {};
@@ -0,0 +1,18 @@
1
+ import { HorizontalAlign, ICommand } from '@univerjs/core';
2
+ interface IAlignOperationCommandParams {
3
+ alignType: HorizontalAlign;
4
+ }
5
+ export declare const AlignOperationCommand: ICommand<IAlignOperationCommandParams>;
6
+ interface IAlignLeftCommandParams {
7
+ }
8
+ export declare const AlignLeftCommand: ICommand<IAlignLeftCommandParams>;
9
+ interface IAlignCenterCommandParams {
10
+ }
11
+ export declare const AlignCenterCommand: ICommand<IAlignCenterCommandParams>;
12
+ interface IAlignRightCommandParams {
13
+ }
14
+ export declare const AlignRightCommand: ICommand<IAlignRightCommandParams>;
15
+ interface IAlignJustifyCommandParams {
16
+ }
17
+ export declare const AlignJustifyCommand: ICommand<IAlignJustifyCommandParams>;
18
+ export {};