@univerjs/docs-ui 1.0.0-rc.0 → 1.0.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.
Files changed (178) hide show
  1. package/README.md +27 -0
  2. package/lib/cjs/index.js +27388 -23213
  3. package/lib/cjs/locale/ar-SA.js +28 -1
  4. package/lib/cjs/locale/ca-ES.js +28 -1
  5. package/lib/cjs/locale/de-DE.js +28 -1
  6. package/lib/cjs/locale/en-US.js +28 -1
  7. package/lib/cjs/locale/es-ES.js +28 -1
  8. package/lib/cjs/locale/fa-IR.js +28 -1
  9. package/lib/cjs/locale/fr-FR.js +28 -1
  10. package/lib/cjs/locale/id-ID.js +28 -1
  11. package/lib/cjs/locale/it-IT.js +28 -1
  12. package/lib/cjs/locale/ja-JP.js +28 -1
  13. package/lib/cjs/locale/ko-KR.js +28 -1
  14. package/lib/cjs/locale/pl-PL.js +28 -1
  15. package/lib/cjs/locale/pt-BR.js +28 -1
  16. package/lib/cjs/locale/ru-RU.js +28 -1
  17. package/lib/cjs/locale/sk-SK.js +28 -1
  18. package/lib/cjs/locale/vi-VN.js +28 -1
  19. package/lib/cjs/locale/zh-CN.js +28 -1
  20. package/lib/cjs/locale/zh-HK.js +28 -1
  21. package/lib/cjs/locale/zh-TW.js +28 -1
  22. package/lib/es/index.js +26448 -22297
  23. package/lib/es/locale/ar-SA.js +28 -0
  24. package/lib/es/locale/ca-ES.js +28 -0
  25. package/lib/es/locale/de-DE.js +28 -0
  26. package/lib/es/locale/en-US.js +28 -0
  27. package/lib/es/locale/es-ES.js +28 -0
  28. package/lib/es/locale/fa-IR.js +28 -0
  29. package/lib/es/locale/fr-FR.js +28 -0
  30. package/lib/es/locale/id-ID.js +28 -0
  31. package/lib/es/locale/it-IT.js +28 -0
  32. package/lib/es/locale/ja-JP.js +28 -0
  33. package/lib/es/locale/ko-KR.js +28 -0
  34. package/lib/es/locale/pl-PL.js +28 -0
  35. package/lib/es/locale/pt-BR.js +28 -0
  36. package/lib/es/locale/ru-RU.js +28 -0
  37. package/lib/es/locale/sk-SK.js +28 -0
  38. package/lib/es/locale/vi-VN.js +28 -0
  39. package/lib/es/locale/zh-CN.js +28 -0
  40. package/lib/es/locale/zh-HK.js +28 -0
  41. package/lib/es/locale/zh-TW.js +28 -0
  42. package/lib/index.css +322 -84
  43. package/lib/index.js +26448 -22297
  44. package/lib/locale/ar-SA.js +28 -0
  45. package/lib/locale/ca-ES.js +28 -0
  46. package/lib/locale/de-DE.js +28 -0
  47. package/lib/locale/en-US.js +28 -0
  48. package/lib/locale/es-ES.js +28 -0
  49. package/lib/locale/fa-IR.js +28 -0
  50. package/lib/locale/fr-FR.js +28 -0
  51. package/lib/locale/id-ID.js +28 -0
  52. package/lib/locale/it-IT.js +28 -0
  53. package/lib/locale/ja-JP.js +28 -0
  54. package/lib/locale/ko-KR.js +28 -0
  55. package/lib/locale/pl-PL.js +28 -0
  56. package/lib/locale/pt-BR.js +28 -0
  57. package/lib/locale/ru-RU.js +28 -0
  58. package/lib/locale/sk-SK.js +28 -0
  59. package/lib/locale/vi-VN.js +28 -0
  60. package/lib/locale/zh-CN.js +28 -0
  61. package/lib/locale/zh-HK.js +28 -0
  62. package/lib/locale/zh-TW.js +28 -0
  63. package/lib/types/basics/paragraph.d.ts +4 -1
  64. package/lib/types/basics/transform-position.d.ts +18 -0
  65. package/lib/types/commands/commands/clipboard.command.d.ts +9 -2
  66. package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -1
  67. package/lib/types/commands/commands/core-editing.command.d.ts +58 -0
  68. package/lib/types/commands/commands/doc-select-all.command.d.ts +1 -0
  69. package/lib/types/commands/commands/format-painter.command.d.ts +33 -0
  70. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +1 -0
  71. package/lib/types/components/const.d.ts +16 -0
  72. package/lib/types/components/doc-page-render-component.d.ts +21 -0
  73. package/lib/types/components/editor/utils.d.ts +22 -0
  74. package/lib/types/components/float-toolbar/FloatToolbar.d.ts +20 -0
  75. package/lib/types/components/float-toolbar/FloatToolbar.stories.d.ts +22 -0
  76. package/lib/types/components/list-type-picker/Picker.d.ts +30 -0
  77. package/lib/types/components/list-type-picker/index.d.ts +18 -0
  78. package/lib/types/components/paragraph-menu/index.d.ts +41 -0
  79. package/lib/types/components/side-menu/SideMenu.stories.d.ts +31 -0
  80. package/lib/types/components/side-menu/index.d.ts +41 -0
  81. package/lib/types/config/config.d.ts +2 -0
  82. package/lib/types/consts/mobile-context.d.ts +17 -0
  83. package/lib/types/controllers/doc-header-footer.controller.d.ts +3 -6
  84. package/lib/types/controllers/doc-move-cursor.controller.d.ts +1 -0
  85. package/lib/types/controllers/doc-ui.controller.d.ts +36 -0
  86. package/lib/types/controllers/format-painter.controller.d.ts +23 -0
  87. package/lib/types/controllers/mobile/components.controller.d.ts +25 -0
  88. package/lib/types/controllers/mobile/ui.controller.d.ts +29 -0
  89. package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +4 -3
  90. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +4 -3
  91. package/lib/types/controllers/render-controllers/doc-paste-options.render-controller.d.ts +27 -0
  92. package/lib/types/controllers/render-controllers/doc-selection-render.controller.d.ts +2 -0
  93. package/lib/types/controllers/render-controllers/doc-selection-render.util.d.ts +21 -0
  94. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +19 -5
  95. package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +23 -0
  96. package/lib/types/controllers/render-controllers/mobile/back-scroll.render-controller.d.ts +30 -0
  97. package/lib/types/controllers/render-controllers/mobile/doc-pinch-zoom.d.ts +51 -0
  98. package/lib/types/controllers/render-controllers/mobile/doc-selection-render.controller.d.ts +73 -0
  99. package/lib/types/controllers/render-controllers/mobile/doc.render-controller.d.ts +36 -0
  100. package/lib/types/controllers/render-controllers/mobile/zoom.render-controller.d.ts +30 -0
  101. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +8 -6
  102. package/lib/types/facade/f-univer.d.ts +52 -0
  103. package/lib/types/index.d.ts +10 -1
  104. package/lib/types/locale/en-US.d.ts +30 -0
  105. package/lib/types/menu/context-menu.d.ts +3 -0
  106. package/lib/types/menu/mobile-schema.d.ts +17 -0
  107. package/lib/types/mobile-plugin.d.ts +36 -0
  108. package/lib/types/services/clipboard/clipboard.service.d.ts +53 -20
  109. package/lib/types/services/clipboard/paste-options.d.ts +33 -0
  110. package/lib/types/services/doc-content-insert.service.d.ts +28 -0
  111. package/lib/types/services/doc-contextual-ribbon.service.d.ts +29 -0
  112. package/lib/types/services/doc-event-manager.service.d.ts +3 -0
  113. package/lib/types/services/doc-mobile-element-menu.service.d.ts +44 -0
  114. package/lib/types/services/doc-page-layout.service.d.ts +3 -0
  115. package/lib/types/services/doc-paragraph-menu.service.d.ts +3 -2
  116. package/lib/types/services/doc-popup-manager.service.d.ts +1 -0
  117. package/lib/types/services/doc-state-change-manager.service.d.ts +50 -0
  118. package/lib/types/services/doc-view-scale.d.ts +1 -1
  119. package/lib/types/services/editor/editor-manager.service.d.ts +2 -0
  120. package/lib/types/services/editor/editor-runtime-config.d.ts +24 -0
  121. package/lib/types/services/editor/editor.d.ts +9 -0
  122. package/lib/types/services/float-menu.service.d.ts +12 -4
  123. package/lib/types/services/mobile/doc-selection-render.service.d.ts +60 -0
  124. package/lib/types/services/mobile/doc-view-scale.d.ts +19 -0
  125. package/lib/types/services/mobile/float-menu.service.d.ts +20 -0
  126. package/lib/types/services/mobile/mobile-text-selection-visuals.d.ts +32 -0
  127. package/lib/types/services/selection/convert-text-range.d.ts +7 -0
  128. package/lib/types/services/selection/doc-selection-render.service.d.ts +38 -21
  129. package/lib/types/types/delete-direction.d.ts +19 -0
  130. package/lib/types/views/DocPasteOptions.d.ts +17 -0
  131. package/lib/types/views/Icon.d.ts +0 -3
  132. package/lib/types/views/PageSettings.d.ts +5 -1
  133. package/lib/types/views/ParagraphMenu.d.ts +1 -2
  134. package/lib/types/views/RichTextEditor.d.ts +20 -1
  135. package/lib/types/views/SideMenu.d.ts +1 -0
  136. package/lib/types/views/doc-statistics/DocPageStatus.d.ts +30 -0
  137. package/lib/types/views/float-toolbar/FloatToolbar.d.ts +1 -0
  138. package/lib/types/views/header-footer/content-cover.d.ts +30 -0
  139. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +4 -0
  140. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +2 -1
  141. package/lib/types/views/header-footer/panel/use-header-footer-options.d.ts +25 -0
  142. package/lib/types/views/mobile/MobileDocCanvasViewport.d.ts +20 -0
  143. package/lib/types/views/mobile/MobileDocPasteOptions.d.ts +21 -0
  144. package/lib/types/views/mobile/MobileDocSettings.d.ts +20 -0
  145. package/lib/types/views/mobile-doc-toolbar/MobileDocToolbar.d.ts +30 -0
  146. package/lib/types/views/mobile-element-menu/MobileDocElementMenu.d.ts +25 -0
  147. package/lib/types/views/mobile-rich-text-editor/MobileRichTextEditor.d.ts +33 -0
  148. package/lib/types/views/page-settings/index.d.ts +39 -0
  149. package/lib/types/views/paragraph-setting/Setting.d.ts +30 -1
  150. package/lib/types/views/paragraph-setting/hook/utils.d.ts +4 -0
  151. package/lib/types/views/paragraph-setting/index.d.ts +2 -1
  152. package/lib/types/views/rich-text-editor/hooks/use-editor.d.ts +8 -0
  153. package/lib/types/views/rich-text-editor/hooks/use-resize.d.ts +2 -1
  154. package/lib/types/views/rich-text-editor/index.d.ts +40 -0
  155. package/lib/types/views/section-setting/Setting.d.ts +12 -1
  156. package/lib/types/views/section-setting/index.d.ts +2 -1
  157. package/lib/types/views/side-menu/index.d.ts +16 -0
  158. package/lib/umd/index.js +19 -18
  159. package/lib/umd/locale/ar-SA.js +1 -1
  160. package/lib/umd/locale/ca-ES.js +1 -1
  161. package/lib/umd/locale/de-DE.js +1 -1
  162. package/lib/umd/locale/en-US.js +1 -1
  163. package/lib/umd/locale/es-ES.js +1 -1
  164. package/lib/umd/locale/fa-IR.js +1 -1
  165. package/lib/umd/locale/fr-FR.js +1 -1
  166. package/lib/umd/locale/id-ID.js +1 -1
  167. package/lib/umd/locale/it-IT.js +1 -1
  168. package/lib/umd/locale/ja-JP.js +1 -1
  169. package/lib/umd/locale/ko-KR.js +1 -1
  170. package/lib/umd/locale/pl-PL.js +1 -1
  171. package/lib/umd/locale/pt-BR.js +1 -1
  172. package/lib/umd/locale/ru-RU.js +1 -1
  173. package/lib/umd/locale/sk-SK.js +1 -1
  174. package/lib/umd/locale/vi-VN.js +1 -1
  175. package/lib/umd/locale/zh-CN.js +1 -1
  176. package/lib/umd/locale/zh-HK.js +1 -1
  177. package/lib/umd/locale/zh-TW.js +1 -1
  178. package/package.json +13 -12
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { Disposable } from '@univerjs/core';
17
+ export interface IDocContentInsertRange {
18
+ unitId: string;
19
+ startOffset: number;
20
+ endOffset: number;
21
+ segmentId?: string;
22
+ }
23
+ export declare class DocContentInsertService extends Disposable {
24
+ private _range;
25
+ setInsertRange(range: IDocContentInsertRange): void;
26
+ consumeInsertRange(unitId?: string): IDocContentInsertRange | null;
27
+ clearInsertRange(): void;
28
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { Disposable } from '@univerjs/core';
17
+ import { IRibbonService } from '@univerjs/ui';
18
+ /** Coordinates the document's containing table and selected content control, not global ribbon priority. */
19
+ export declare class DocContextualRibbonService extends Disposable {
20
+ private readonly _ribbonService;
21
+ private _tableTab;
22
+ private _contentControlTab;
23
+ private _activeTab;
24
+ constructor(_ribbonService: IRibbonService);
25
+ setTableTab(tab: string, visible: boolean): void;
26
+ setContentControlTab(tab: string, visible: boolean): void;
27
+ private _setTab;
28
+ dispose(): void;
29
+ }
@@ -129,6 +129,8 @@ export declare class DocEventManagerService extends Disposable implements IRende
129
129
  readonly hoverTable$: import("rxjs").Observable<Nullable<ITableBound>>;
130
130
  readonly hoverTableRealTime$: import("rxjs").Observable<Nullable<ITableBound>>;
131
131
  private _customRangeDirty;
132
+ private _customRangeCount;
133
+ private _customRangeSkeletonSignature;
132
134
  private _bulletDirty;
133
135
  private _paragraphDirty;
134
136
  private _tableBoundsDirty;
@@ -164,6 +166,7 @@ export declare class DocEventManagerService extends Disposable implements IRende
164
166
  private _initResetDirty;
165
167
  private _initEvents;
166
168
  isPointerOnBullet(offsetX: number, offsetY: number): boolean;
169
+ isPointerOnInteractiveRange(offsetX: number, offsetY: number): boolean;
167
170
  isPointerOnNonChecklistBullet(offsetX: number, offsetY: number): boolean;
168
171
  getBulletBounds(): IBulletBound[];
169
172
  getListContextMenuBulletByOffset(offsetX: number, offsetY: number): Nullable<IBulletBound>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { IBoundRectNoAngle, IMouseEvent, IPointerEvent } from '@univerjs/engine-render';
17
+ import type { IMobileDocElementMenuProps } from '../views/mobile-element-menu/MobileDocElementMenu';
18
+ import { Disposable, IUniverInstanceService } from '@univerjs/core';
19
+ import { DocCanvasPopManagerService } from './doc-popup-manager.service';
20
+ export interface IDocMobileElementTarget extends IMobileDocElementMenuProps {
21
+ unitId: string;
22
+ rect: IBoundRectNoAngle;
23
+ onTap?: (offset: {
24
+ offsetX: number;
25
+ offsetY: number;
26
+ }) => void;
27
+ onDrag?: (event: IPointerEvent | IMouseEvent) => void;
28
+ }
29
+ /** Element hit testing stays in its plugin; the document owns tap-versus-scroll recognition. */
30
+ export declare class DocMobileElementMenuService extends Disposable {
31
+ private readonly _popupService;
32
+ private _pending;
33
+ private _editingBounds;
34
+ private _popup;
35
+ private _unitId;
36
+ constructor(_popupService: DocCanvasPopManagerService, instanceService: IUniverInstanceService);
37
+ capture(target: IDocMobileElementTarget): boolean;
38
+ takeTarget(unitId: string): IDocMobileElementTarget | null;
39
+ setEditingBounds(unitId: string, rect: IBoundRectNoAngle): void;
40
+ getEditingBounds(unitId: string): IBoundRectNoAngle | null;
41
+ show(target: IDocMobileElementTarget): void;
42
+ close(): void;
43
+ dispose(): void;
44
+ }
@@ -20,6 +20,9 @@ import { DocViewScaleService } from './doc-view-scale';
20
20
  export declare class DocPageLayoutService extends Disposable implements IRenderModule {
21
21
  private _context;
22
22
  private readonly _docViewScaleService;
23
+ private _bottomReserve;
23
24
  constructor(_context: IRenderContext<DocumentDataModel>, _docViewScaleService: DocViewScaleService);
25
+ setBottomReserve(height: number): void;
26
+ resolveSceneHeight(contentHeight: number): number;
24
27
  calculatePagePosition(): this | undefined;
25
28
  }
@@ -16,7 +16,7 @@
16
16
  import type { DocumentDataModel, ICustomBlock, ICustomTable, IDocumentBlockRange } from '@univerjs/core';
17
17
  import type { IBoundRectNoAngle, IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
18
  import type { IMutiPageParagraphBound, ITableBound } from './doc-event-manager.service';
19
- import { Disposable, DocumentBlockType, IPermissionService } from '@univerjs/core';
19
+ import { Disposable, DocumentBlockType, IContextService, IPermissionService } from '@univerjs/core';
20
20
  import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
21
21
  import { DocEventManagerService } from './doc-event-manager.service';
22
22
  import { DocLayoutInteractionService } from './doc-layout-interaction.service';
@@ -71,6 +71,7 @@ export declare class DocParagraphMenuService extends Disposable implements IRend
71
71
  private _docSelectionRenderService;
72
72
  private readonly _permissionService;
73
73
  private _docLayoutInteractionService;
74
+ private readonly _contextService;
74
75
  private _paragraphMenu;
75
76
  private readonly _activeTarget$;
76
77
  readonly activeTarget$: import("rxjs").Observable<IDocBlockMenuTarget | null>;
@@ -85,7 +86,7 @@ export declare class DocParagraphMenuService extends Disposable implements IRend
85
86
  get activeTarget(): IDocBlockMenuTarget | null;
86
87
  setBlockMenuDragging(isDragging: boolean): void;
87
88
  get isBlockMenuDragging(): boolean;
88
- constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docEventManagerService: DocEventManagerService, _docPopupManagerService: DocCanvasPopManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _floatMenuService: DocFloatMenuService, _docSelectionRenderService: DocSelectionRenderService, _permissionService: IPermissionService, _docLayoutInteractionService: DocLayoutInteractionService);
89
+ constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docEventManagerService: DocEventManagerService, _docPopupManagerService: DocCanvasPopManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _floatMenuService: DocFloatMenuService, _docSelectionRenderService: DocSelectionRenderService, _permissionService: IPermissionService, _docLayoutInteractionService: DocLayoutInteractionService, _contextService: IContextService);
89
90
  private _isCursorInActiveParagraph;
90
91
  private _getExpandedSelectionState;
91
92
  private _hasExpandedSelectionRanges;
@@ -50,6 +50,7 @@ export declare class DocCanvasPopManagerService extends Disposable {
50
50
  dispose(): void;
51
51
  private _beginPopupActivity;
52
52
  private _publishPopupUnits;
53
+ getRangeBounds(range: ITextRangeParam, unitId: string): IBoundRectNoAngle[] | undefined;
53
54
  private _shouldUpdateForCommand;
54
55
  private _createRectPositionObserver;
55
56
  private _createObjectPositionObserver;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 } from '@univerjs/core';
17
+ import type { IDocStateChangeParams } from '@univerjs/docs';
18
+ import { ICommandService, IUndoRedoService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
19
+ import { DocStateEmitService } from '@univerjs/docs';
20
+ import { IRenderManagerService } from '@univerjs/engine-render';
21
+ interface IStateCache {
22
+ history: IDocStateChangeParams[];
23
+ collaboration: IDocStateChangeParams[];
24
+ }
25
+ export declare class DocStateChangeManagerService extends RxDisposable {
26
+ private _undoRedoService;
27
+ private readonly _commandService;
28
+ private readonly _univerInstanceService;
29
+ private readonly _docStateEmitService;
30
+ private readonly _renderManagerService;
31
+ private readonly _docStateChange$;
32
+ readonly docStateChange$: import("rxjs").Observable<Nullable<IDocStateChangeParams>>;
33
+ private _historyStateCache;
34
+ private _changeStateCache;
35
+ private _historyTimer;
36
+ private _changeStateCacheTimer;
37
+ constructor(_undoRedoService: IUndoRedoService, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _docStateEmitService: DocStateEmitService, _renderManagerService: IRenderManagerService);
38
+ getStateCache(unitId: string): {
39
+ history: IDocStateChangeParams[];
40
+ collaboration: IDocStateChangeParams[];
41
+ };
42
+ setStateCache(unitId: string, cache: IStateCache): void;
43
+ private _setChangeState;
44
+ private _initialize;
45
+ private _listenDocStateChange;
46
+ private _cacheChangeState;
47
+ private _pushHistory;
48
+ private _emitChangeState;
49
+ }
50
+ export {};
@@ -40,7 +40,7 @@ export declare function calcDocFitToWidthScale(params: ICalcDocFitToWidthScalePa
40
40
  export declare function resolveDocFitBaseWidth(params: IResolveDocFitBaseWidthParams): number;
41
41
  export declare function resolveDocViewScale(userZoomRatio: number, fitToWidthScale: number): number;
42
42
  export declare class DocViewScaleService extends Disposable implements IRenderModule {
43
- private readonly _context;
43
+ protected readonly _context: IRenderContext<DocumentDataModel>;
44
44
  private readonly _configService;
45
45
  constructor(_context: IRenderContext<DocumentDataModel>, _configService: IConfigService);
46
46
  getPluginConfig(): Partial<IUniverDocsUIConfig>;
@@ -26,6 +26,7 @@ export interface IEditorRenderConfig {
26
26
  preserveHostFocus?: boolean;
27
27
  scrollBar?: boolean;
28
28
  backScrollOffset?: number;
29
+ disableBackScroll?: boolean;
29
30
  }
30
31
  export interface IEditorSetValueParam {
31
32
  editorUnitId: string;
@@ -60,6 +61,7 @@ export declare class EditorService extends Disposable implements IEditorService,
60
61
  private _editors;
61
62
  private _editorRenderConfigs;
62
63
  private _focusEditorUnitId;
64
+ private _preservedHostUnitId;
63
65
  private readonly _blur$;
64
66
  readonly blur$: Observable<unknown>;
65
67
  private readonly _focus$;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { DocumentDataModel, IDisposable } from '@univerjs/core';
17
+ import type { IDocumentLayoutPresentation } from '@univerjs/engine-render';
18
+ export interface IEditorRuntimeConfig {
19
+ layout?: IDocumentLayoutPresentation;
20
+ inheritParagraphStartStyle?: boolean;
21
+ disableSelectionAutoScroll?: boolean;
22
+ }
23
+ export declare function registerEditorRuntimeConfig(model: DocumentDataModel, config: IEditorRuntimeConfig): IDisposable;
24
+ export declare function getEditorRuntimeConfig(model: DocumentDataModel): IEditorRuntimeConfig | undefined;
@@ -18,6 +18,7 @@ import type { DocSelectionManagerService } from '@univerjs/docs';
18
18
  import type { IDocSelectionInnerParam, IRender, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
19
19
  import type { Observable } from 'rxjs';
20
20
  import type { IEditorInputConfig } from '../selection/doc-selection-render.service';
21
+ import type { IEditorRuntimeConfig } from './editor-runtime-config';
21
22
  import { Disposable } from '@univerjs/core';
22
23
  import { DocSelectionRenderService } from '../selection/doc-selection-render.service';
23
24
  interface IEditorEvent {
@@ -54,14 +55,21 @@ export interface IEditorCanvasStyle {
54
55
  backgroundColor?: string;
55
56
  }
56
57
  export interface IEditorConfigParams {
58
+ /** Instance-only layout and interaction settings, never persisted in the document. */
59
+ renderConfig?: IEditorRuntimeConfig;
57
60
  initialSnapshot: IDocumentData;
58
61
  /** Keep the globally focused unit on the editor's host while this editor receives input focus. */
59
62
  preserveHostFocus?: boolean;
60
63
  cancelDefaultResizeListener?: boolean;
64
+ /** Use a fixed canvas backing-store ratio for an editor managed by an external layout host. */
65
+ pixelRatio?: number;
66
+ /** Publish transient drag ranges to an external editor host. Defaults to false. */
67
+ emitSelectionWhileDragging?: boolean;
61
68
  canvasStyle?: IEditorCanvasStyle;
62
69
  autofocus?: boolean;
63
70
  readonly?: boolean;
64
71
  backScrollOffset?: number;
72
+ disableBackScroll?: boolean;
65
73
  editorUnitId?: string;
66
74
  scrollBar?: boolean;
67
75
  }
@@ -88,6 +96,7 @@ export declare class Editor extends Disposable implements IEditor {
88
96
  blur$: Observable<IEditorInputConfig>;
89
97
  private readonly _selectionChange$;
90
98
  selectionChange$: Observable<IDocSelectionInnerParam>;
99
+ private _movingSelectionRanges?;
91
100
  constructor(_param: IEditorOptions, _univerInstanceService: IUniverInstanceService, _docSelectionManagerService: DocSelectionManagerService, _commandService: ICommandService, _undoRedoService: IUndoRedoService, _injector: Injector);
92
101
  get docSelectionRenderService(): DocSelectionRenderService;
93
102
  private _listenSelection;
@@ -13,10 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { DocumentDataModel, IDisposable, Nullable } from '@univerjs/core';
16
+ import type { DocumentDataModel, IDisposable, ITextRangeParam, Nullable } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
18
  import { Disposable, IContextService, IPermissionService, IUniverInstanceService } from '@univerjs/core';
19
19
  import { DocSelectionManagerService } from '@univerjs/docs';
20
+ import { IContextMenuService } from '@univerjs/ui';
20
21
  import { IDocEmbedRuntimeFocusCoordinator } from './doc-embed-integration.service';
21
22
  import { DocLayoutInteractionService } from './doc-layout-interaction.service';
22
23
  import { DocCanvasPopManagerService } from './doc-popup-manager.service';
@@ -24,18 +25,24 @@ import { DocSelectionRenderService } from './selection/doc-selection-render.serv
24
25
  export declare class DocFloatMenuService extends Disposable implements IRenderModule {
25
26
  private _context;
26
27
  private readonly _docSelectionManagerService;
27
- private readonly _docCanvasPopManagerService;
28
+ protected readonly _docCanvasPopManagerService: DocCanvasPopManagerService;
28
29
  private readonly _univerInstanceService;
29
30
  private readonly _docSelectionRenderService;
30
31
  private readonly _contextService;
32
+ protected readonly _contextMenuService: IContextMenuService;
31
33
  private readonly _permissionService;
32
34
  private readonly _docLayoutInteractionService;
33
35
  private readonly _embedRuntimeFocusCoordinator?;
34
- private _floatMenu;
36
+ protected _floatMenu: Nullable<{
37
+ disposable: IDisposable;
38
+ start: number;
39
+ end: number;
40
+ segmentId: string;
41
+ }>;
35
42
  private _suppressed;
36
43
  private _embedSuppressed;
37
44
  private _invalidatedSelection;
38
- constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docCanvasPopManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _docSelectionRenderService: DocSelectionRenderService, _contextService: IContextService, _permissionService: IPermissionService, _docLayoutInteractionService: DocLayoutInteractionService, _embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator | undefined);
45
+ constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docCanvasPopManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _docSelectionRenderService: DocSelectionRenderService, _contextService: IContextService, _contextMenuService: IContextMenuService, _permissionService: IPermissionService, _docLayoutInteractionService: DocLayoutInteractionService, _embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator | undefined);
39
46
  get floatMenu(): Nullable<{
40
47
  disposable: IDisposable;
41
48
  start: number;
@@ -51,4 +58,5 @@ export declare class DocFloatMenuService extends Disposable implements IRenderMo
51
58
  private _getSelectionKey;
52
59
  private _hideFloatMenu;
53
60
  private _showFloatMenu;
61
+ protected _openSelectionMenu(unitId: string, range: ITextRangeParam): IDisposable | undefined;
54
62
  }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { DocumentDataModel } from '@univerjs/core';
17
+ import type { IRenderContext } from '@univerjs/engine-render';
18
+ import { IContextService, ILogService, IUniverInstanceService } from '@univerjs/core';
19
+ import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
20
+ import { ILayoutService } from '@univerjs/ui';
21
+ import { IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator } from '../doc-embed-integration.service';
22
+ import { DocSelectionRenderService } from '../selection/doc-selection-render.service';
23
+ export declare class MobileDocSelectionRenderService extends DocSelectionRenderService {
24
+ private readonly _mobileDocSkeletonManagerService;
25
+ private readonly _handleDragDisposables;
26
+ private readonly _selectionVisuals;
27
+ private readonly _keyboardState$;
28
+ private readonly _editMode$;
29
+ private _viewportBaselineHeight;
30
+ private _viewportBaselineBottom;
31
+ private _viewportBaselineWidth;
32
+ private _pendingBlurEvent;
33
+ readonly mobileKeyboardState$: import("rxjs").Observable<{
34
+ visible: boolean;
35
+ inset: number;
36
+ }>;
37
+ readonly mobileKeyboardVisible$: import("rxjs").Observable<boolean>;
38
+ readonly mobileEditMode$: import("rxjs").Observable<boolean>;
39
+ get isMobileEditMode(): boolean;
40
+ constructor(context: IRenderContext<DocumentDataModel>, layoutService: ILayoutService, logService: ILogService, contextService: IContextService, univerInstanceService: IUniverInstanceService, _mobileDocSkeletonManagerService: DocSkeletonManagerService, docSelectionManagerService: DocSelectionManagerService, embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService, embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator);
41
+ cancelPointerSelection(): void;
42
+ enterMobileEditMode(shouldFocusInput?: boolean): boolean;
43
+ suspendMobileEditingInput(): void;
44
+ exitMobileEditMode(): void;
45
+ refreshRanges(): void;
46
+ protected _positionInput(_x: number, _y: number): void;
47
+ private _syncMobileSelectionVisuals;
48
+ private _initMobileKeyboardViewport;
49
+ protected _updateInputPosition({ forceFocus, preserveFocus }?: {
50
+ forceFocus?: boolean | undefined;
51
+ preserveFocus?: boolean | undefined;
52
+ }): void;
53
+ protected _handleInputBlur(event: Event): void;
54
+ protected _handleInputFocus(event: Event): void;
55
+ protected _setEditing(isEditing: boolean): void;
56
+ private _startSelectionHandleDrag;
57
+ private _updateMobileKeyboardState;
58
+ private _setMobileKeyboardState;
59
+ dispose(): void;
60
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { DocViewScaleService } from '../doc-view-scale';
17
+ export declare class MobileDocViewScaleService extends DocViewScaleService {
18
+ getFitToWidthScale(): number;
19
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { ITextRangeParam } from '@univerjs/core';
17
+ import { DocFloatMenuService } from '../float-menu.service';
18
+ export declare class MobileDocFloatMenuService extends DocFloatMenuService {
19
+ protected _openSelectionMenu(unitId: string, range: ITextRangeParam): undefined;
20
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
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 { Documents, DocumentSkeleton, IMouseEvent, IPointerEvent, Scene } from '@univerjs/engine-render';
17
+ import type { TextRange } from '../selection/text-range';
18
+ export type MobileTextRangeHandleType = 'start' | 'end';
19
+ export declare class MobileTextSelectionVisuals {
20
+ private readonly _scene;
21
+ private _startHandleShape;
22
+ private _endHandleShape;
23
+ private _startHandleStemShape;
24
+ private _endHandleStemShape;
25
+ private _onPointerDown;
26
+ constructor(_scene: Scene);
27
+ show(range: TextRange, document: Documents, docSkeleton: DocumentSkeleton, color: string, onPointerDown: (handle: MobileTextRangeHandleType, event: IPointerEvent | IMouseEvent) => void): void;
28
+ hide(): void;
29
+ dispose(): void;
30
+ private _createShapes;
31
+ private _getNodeCaretBounding;
32
+ }
@@ -15,6 +15,10 @@
15
15
  */
16
16
  import type { IPosition, ITextRange, Nullable } from '@univerjs/core';
17
17
  import type { DocumentSkeleton, IDocumentOffsetConfig, INodePosition, IPoint } from '@univerjs/engine-render';
18
+ export declare function findDocRangeNodePositions(skeleton: DocumentSkeleton, startIndex: number, endIndex: number, segmentId?: string, pageIndex?: number): {
19
+ startPosition: INodePosition;
20
+ endPosition: INodePosition;
21
+ } | undefined;
18
22
  export declare enum NodePositionStateType {
19
23
  NORMAL = 0,
20
24
  START = 1,
@@ -59,6 +63,7 @@ export declare class NodePositionConvertToCursor {
59
63
  private _docSkeleton;
60
64
  private _liquid;
61
65
  private _horizontalClip;
66
+ private _verticalCellOrigin;
62
67
  private _currentStartState;
63
68
  private _currentEndState;
64
69
  constructor(_documentOffsetConfig: IDocumentOffsetConfig, _docSkeleton: DocumentSkeleton);
@@ -67,6 +72,7 @@ export declare class NodePositionConvertToCursor {
67
72
  contentBoxPointGroup: IPoint[][];
68
73
  cursorList: ITextRange[];
69
74
  };
75
+ private _toPhysicalPosition;
70
76
  private _getCaretGlyph;
71
77
  private _findTextLikeGlyph;
72
78
  private _isNonInlineDrawingGlyph;
@@ -76,4 +82,5 @@ export declare class NodePositionConvertToCursor {
76
82
  private _checkPreviousNodePositionState;
77
83
  private _getSelectionRuler;
78
84
  private _selectionIterator;
85
+ private _translateToCellPage;
79
86
  }