@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,51 @@
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 { ICommandService, IContextService } from '@univerjs/core';
17
+ import type { DocSelectionManagerService } from '@univerjs/docs';
18
+ import type { Engine, Scene, Viewport } from '@univerjs/engine-render';
19
+ import type { DocViewScaleService } from '../../../services/doc-view-scale';
20
+ import { Disposable } from '@univerjs/core';
21
+ export declare function resolveMobileDocPinchZoomRatio(initialZoomRatio: number, initialDistance: number, currentDistance: number): number;
22
+ interface IMobileDocPinchZoomGestureOptions {
23
+ canvasElement: HTMLCanvasElement;
24
+ commandService: ICommandService;
25
+ contextService: IContextService;
26
+ docViewScaleService: DocViewScaleService;
27
+ engine: Engine;
28
+ scene: Scene;
29
+ textSelectionManagerService: DocSelectionManagerService;
30
+ unitId: string;
31
+ viewport: Viewport;
32
+ }
33
+ export declare class MobileDocPinchZoomGesture extends Disposable {
34
+ private readonly _options;
35
+ private readonly _zoomIndicator;
36
+ private _gestureOwned;
37
+ private _pinchZooming;
38
+ private _initialDistance;
39
+ private _initialZoomRatio;
40
+ private _anchor;
41
+ constructor(_options: IMobileDocPinchZoomGestureOptions);
42
+ private readonly _handleTouchStart;
43
+ private readonly _handleTouchMove;
44
+ private readonly _handleTouchEnd;
45
+ private readonly _handleTouchCancel;
46
+ private _getTouchPoint;
47
+ private _getPinchCenter;
48
+ private _getTouchDistance;
49
+ private _finishPinch;
50
+ }
51
+ export {};
@@ -0,0 +1,73 @@
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, IRenderModule } from '@univerjs/engine-render';
18
+ import type { MobileDocSelectionRenderService } from '../../../services/mobile/doc-selection-render.service';
19
+ import { Disposable, ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
20
+ import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
21
+ import { IContextMenuService } from '@univerjs/ui';
22
+ import { IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator } from '../../../services/doc-embed-integration.service';
23
+ import { DocMobileElementMenuService } from '../../../services/doc-mobile-element-menu.service';
24
+ import { IEditorService } from '../../../services/editor/editor-manager.service';
25
+ export declare class MobileDocSelectionRenderController extends Disposable implements IRenderModule {
26
+ private readonly _context;
27
+ private readonly _commandService;
28
+ private readonly _editorService;
29
+ private readonly _instanceSrv;
30
+ private readonly _docSelectionRenderService;
31
+ private readonly _docSkeletonManagerService;
32
+ private readonly _docSelectionManagerService;
33
+ private readonly _contextService;
34
+ private readonly _contextMenuService;
35
+ private readonly _mobileElementMenuService;
36
+ private readonly _embedRuntimeFocusCoordinator?;
37
+ private _loadedMap;
38
+ private _deferredEditorFocusTimer;
39
+ private _gestureTimer;
40
+ private _gestureDisposables;
41
+ private _lastTap;
42
+ private _inertiaAnimationId;
43
+ private _inertiaLastFrameTime;
44
+ private _inertiaVelocity;
45
+ private _initialSelectionReady;
46
+ constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _editorService: IEditorService, _instanceSrv: IUniverInstanceService, _docSelectionRenderService: MobileDocSelectionRenderService, _docSkeletonManagerService: DocSkeletonManagerService, _docSelectionManagerService: DocSelectionManagerService, _contextService: IContextService, _contextMenuService: IContextMenuService, _mobileElementMenuService: DocMobileElementMenuService, _embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService, _embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator | undefined);
47
+ private _initialize;
48
+ private _init;
49
+ private _refreshListener;
50
+ private _syncSelection;
51
+ private _initialMain;
52
+ private _initialEditor;
53
+ dispose(): void;
54
+ private _syncEditArea;
55
+ private _startGesture;
56
+ private _handleTap;
57
+ private _selectWord;
58
+ private _scrollDocument;
59
+ private _startInertia;
60
+ private _stopInertia;
61
+ private _enterEditing;
62
+ private _getDocumentOffset;
63
+ private _showCaretMenu;
64
+ private _clearGestureTimer;
65
+ private _clearGesture;
66
+ private _getTransformCoordForDocumentOffset;
67
+ private _isEditorReadOnly;
68
+ private _setEditorFocus;
69
+ private _isEmbedInteractionEvent;
70
+ private _isEmbedChildInteractionActive;
71
+ private _commandExecutedListener;
72
+ private _skeletonListener;
73
+ }
@@ -0,0 +1,36 @@
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 { DocumentSkeleton, IRenderContext } from '@univerjs/engine-render';
18
+ import type { IDocLayoutScheduleOptions } from '../doc.render-controller';
19
+ import { ICommandService, ILogService, IUniverInstanceService, ThemeService } from '@univerjs/core';
20
+ import { DocLayoutExecutorService, DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
21
+ import { IRenderManagerService } from '@univerjs/engine-render';
22
+ import { DocLayoutInteractionService } from '../../../services/doc-layout-interaction.service';
23
+ import { DocPageLayoutService } from '../../../services/doc-page-layout.service';
24
+ import { DocViewScaleService } from '../../../services/doc-view-scale';
25
+ import { IEditorService } from '../../../services/editor/editor-manager.service';
26
+ import { DocSelectionRenderService } from '../../../services/selection/doc-selection-render.service';
27
+ import { DocRenderController } from '../doc.render-controller';
28
+ export declare class MobileDocRenderController extends DocRenderController {
29
+ private _mobileModernPageWidth;
30
+ constructor(context: IRenderContext<DocumentDataModel>, commandService: ICommandService, docSelectionRenderService: DocSelectionRenderService, docSkeletonManagerService: DocSkeletonManagerService, editorService: IEditorService, renderManagerService: IRenderManagerService, univerInstanceService: IUniverInstanceService, docPageLayoutService: DocPageLayoutService, textSelectionManagerService: DocSelectionManagerService, docViewScaleService: DocViewScaleService, themeService: ThemeService, docLayoutExecutorService: DocLayoutExecutorService, docLayoutInteractionService: DocLayoutInteractionService, logService: ILogService);
31
+ protected _scheduleLayout(unitId: string, skeleton: DocumentSkeleton, options: IDocLayoutScheduleOptions, refreshMainSelection?: boolean, preserveInactiveViewportAnchor?: boolean): void;
32
+ protected _shouldEnableHorizontalScrollBar(): boolean;
33
+ private _getMobileModernLayoutOptions;
34
+ private _initResponsiveLayout;
35
+ protected _getHorizontalPageMargin(): number;
36
+ }
@@ -0,0 +1,30 @@
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 { ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
19
+ import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
20
+ import { IRenderManagerService } from '@univerjs/engine-render';
21
+ import { IDocEmbedInteractionBoundaryService } from '../../../services/doc-embed-integration.service';
22
+ import { DocPageLayoutService } from '../../../services/doc-page-layout.service';
23
+ import { DocViewScaleService } from '../../../services/doc-view-scale';
24
+ import { IEditorService } from '../../../services/editor/editor-manager.service';
25
+ import { DocZoomRenderController } from '../zoom.render-controller';
26
+ export declare class MobileDocZoomRenderController extends DocZoomRenderController {
27
+ constructor(context: IRenderContext<DocumentDataModel>, contextService: IContextService, docSkeletonManagerService: DocSkeletonManagerService, univerInstanceService: IUniverInstanceService, commandService: ICommandService, textSelectionManagerService: DocSelectionManagerService, editorService: IEditorService, docPageLayoutService: DocPageLayoutService, renderManagerService: IRenderManagerService, docViewScaleService: DocViewScaleService, embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService);
28
+ protected _initCommandExecutedListener(): void;
29
+ private _initGestureZoom;
30
+ }
@@ -24,24 +24,26 @@ import { DocViewScaleService } from '../../services/doc-view-scale';
24
24
  import { IEditorService } from '../../services/editor/editor-manager.service';
25
25
  export declare function shouldHandleDocWheelZoom(event: Pick<IWheelEvent, 'ctrlKey' | 'metaKey'>, focusingDoc: boolean, _documentFlavor?: DocumentFlavor): boolean;
26
26
  export declare class DocZoomRenderController extends Disposable implements IRenderModule {
27
- private readonly _context;
28
- private readonly _contextService;
27
+ protected readonly _context: IRenderContext<DocumentDataModel>;
28
+ protected readonly _contextService: IContextService;
29
29
  private readonly _docSkeletonManagerService;
30
30
  private readonly _univerInstanceService;
31
- private readonly _commandService;
32
- private readonly _textSelectionManagerService;
31
+ protected readonly _commandService: ICommandService;
32
+ protected readonly _textSelectionManagerService: DocSelectionManagerService;
33
33
  private readonly _editorService;
34
34
  private readonly _docPageLayoutService;
35
35
  private readonly _renderManagerService;
36
- private readonly _docViewScaleService;
36
+ protected readonly _docViewScaleService: DocViewScaleService;
37
37
  private readonly _embedInteractionBoundaryService?;
38
38
  private _isSheetEditor;
39
39
  private _initTimer;
40
40
  private _updateTimer;
41
+ private _fitToWidthAvailableWidth;
41
42
  constructor(_context: IRenderContext<DocumentDataModel>, _contextService: IContextService, _docSkeletonManagerService: DocSkeletonManagerService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _textSelectionManagerService: DocSelectionManagerService, _editorService: IEditorService, _docPageLayoutService: DocPageLayoutService, _renderManagerService: IRenderManagerService, _docViewScaleService: DocViewScaleService, _embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService | undefined);
42
43
  dispose(): void;
43
44
  private _initSkeletonListener;
44
- private _initCommandExecutedListener;
45
+ protected _initCommandExecutedListener(): void;
46
+ private _initFitToWidthResizeListener;
45
47
  updateViewZoom(zoomRatio: number, needRefreshSelection?: boolean): void;
46
48
  private _initZoomEventListener;
47
49
  }
@@ -0,0 +1,52 @@
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 { IDocumentData } from '@univerjs/core';
17
+ import { FUniver } from '@univerjs/core/facade';
18
+ import { FDocument } from './f-document';
19
+ /**
20
+ * @ignore
21
+ */
22
+ export interface IFUniverDocsUIMixin {
23
+ /**
24
+ * Create a new document and get the API handler of that document.
25
+ *
26
+ * @param {Partial<IDocumentData>} data The snapshot of the document.
27
+ * @returns {FDocument} FDocument API instance.
28
+ */
29
+ createUniverDoc(data: Partial<IDocumentData>): FDocument;
30
+ /**
31
+ * Get the document API handler by the document id.
32
+ *
33
+ * @param {string} id The document id.
34
+ * @returns {FDocument | null} The document API instance.
35
+ */
36
+ getUniverDoc(id: string): FDocument | null;
37
+ /**
38
+ * Get the currently focused Univer document.
39
+ *
40
+ * @returns {FDocument | null} The currently focused Univer document.
41
+ */
42
+ getActiveDocument(): FDocument | null;
43
+ }
44
+ export declare class FUniverDocsUIMixin extends FUniver implements IFUniverDocsUIMixin {
45
+ createUniverDoc(data: Partial<IDocumentData>): FDocument;
46
+ getActiveDocument(): FDocument | null;
47
+ getUniverDoc(id: string): FDocument | null;
48
+ }
49
+ declare module '@univerjs/core/facade' {
50
+ interface FUniver extends IFUniverDocsUIMixin {
51
+ }
52
+ }
@@ -37,6 +37,7 @@ export type { IDeleteCurrentParagraphCommandParams, IDeleteCustomBlockParams, }
37
37
  export { getCursorWhenDelete } from './commands/commands/doc-delete.command';
38
38
  export { HorizontalLineCommand } from './commands/commands/doc-horizontal-line.command';
39
39
  export { DocSelectAllCommand } from './commands/commands/doc-select-all.command';
40
+ export { captureTextFormat } from './commands/commands/format-painter.command';
40
41
  export { IMEInputCommand } from './commands/commands/ime-input.command';
41
42
  export type { IIMEInputCommandParams } from './commands/commands/ime-input.command';
42
43
  export { getStyleInTextRange, ResetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatTextFillCommand, SetInlineFormatUnderlineCommand, } from './commands/commands/inline-format.command';
@@ -80,9 +81,10 @@ export { scrollDocsTableLikeCustomBlockLive } from './embed-docs-custom-block-sc
80
81
  export type { IDocsTableLikeCustomBlockScrollOptions } from './embed-docs-custom-block-scroll';
81
82
  export { resolveDocsCustomBlockRenderViewport } from './embed-host-anchor';
82
83
  export type { IDocsCustomBlockLayoutViewport, IDocsCustomBlockRenderViewportParams } from './embed-host-anchor';
83
- export { AlignMenuItemFactory, BackgroundColorSelectorMenuItemFactory, BoldMenuItemFactory, disableMenuWhenHeaderFooterEditing, FLOAT_TEXT_STYLE_MENU_ID, FLOAT_TOOLBAR_MENU_POSITION, FloatTextStyleMenuItemFactory, FontFamilySelectorMenuItemFactory, FontSizeSelectorMenuItemFactory, hideMenuWhenSelectionInBlockRange, isTextRangeInAnyBlockRange, ItalicMenuItemFactory, StrikeThroughMenuItemFactory, TextColorSelectorMenuItemFactory, UnderlineMenuItemFactory, } from './menu/menu';
84
+ export { AlignMenuItemFactory, BackgroundColorSelectorMenuItemFactory, BoldMenuItemFactory, disableMenuWhenHeaderFooterEditing, disableMenuWithoutDocumentUnitPermission, FLOAT_TEXT_STYLE_MENU_ID, FLOAT_TOOLBAR_MENU_POSITION, FloatTextStyleMenuItemFactory, FontFamilySelectorMenuItemFactory, FontSizeSelectorMenuItemFactory, hideMenuWhenSelectionInBlockRange, isTextRangeInAnyBlockRange, ItalicMenuItemFactory, StrikeThroughMenuItemFactory, TextColorSelectorMenuItemFactory, UnderlineMenuItemFactory, } from './menu/menu';
84
85
  export { DOC_CONTENT_INSERT_MENU_ID, DOC_PARAGRAPH_T_ALIGN_MENU_ID, DOC_PARAGRAPH_T_COLORS_MENU_ID, DOC_PARAGRAPH_T_DIVIDER_MENU_ID, DOC_PARAGRAPH_T_EDIT_MENU_ID, DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID, DOC_PARAGRAPH_T_INSERT_MENU_ID, DOC_TABLE_BLOCK_MENU_ID, EMPTY_PARAGRAPH_MENU_ID, getDocBlockRangeMenuId, INSERT_BELLOW_MENU_ID, ParagraphMenuInsertBelowSubmenuItemFactory, } from './menu/paragraph-menu';
85
86
  export { menuSchema as DocsUIMenuSchema } from './menu/schema';
87
+ export { UniverDocsMobileUIPlugin } from './mobile-plugin';
86
88
  export { UniverDocsUIPlugin } from './plugin';
87
89
  export * from './services';
88
90
  export { convertClipboardHtmlToDocumentData, IDocClipboardService, removeClipboardHtmlImages, } from './services/clipboard/clipboard.service';
@@ -94,6 +96,7 @@ export { convertBodyToHtml } from './services/clipboard/udm-to-html/convertor';
94
96
  export { DocHtmlExportService } from './services/clipboard/udm-to-html/doc-html-export.service';
95
97
  export type { DocHtmlExportTransformer } from './services/clipboard/udm-to-html/doc-html-export.service';
96
98
  export { DocAutoFormatService } from './services/doc-auto-format.service';
99
+ export { DocContextualRibbonService } from './services/doc-contextual-ribbon.service';
97
100
  export { DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator, } from './services/doc-embed-integration.service';
98
101
  export { DocEventManagerService, getListMarkerFallbackBound, getListParagraphContextMenuHit, } from './services/doc-event-manager.service';
99
102
  export type { IBulletBound, IMutiPageParagraphBound } from './services/doc-event-manager.service';
@@ -101,8 +104,10 @@ export { DocIMEInputManagerService } from './services/doc-ime-input-manager.serv
101
104
  export { DocLayoutInteractionService } from './services/doc-layout-interaction.service';
102
105
  export { SetDocInputStyleCommand } from './services/doc-menu-style.service';
103
106
  export type { ISetDocInputStyleCommandParams } from './services/doc-menu-style.service';
107
+ export { DocMobileElementMenuService } from './services/doc-mobile-element-menu.service';
104
108
  export { DocPageLayoutService } from './services/doc-page-layout.service';
105
109
  export { DocParagraphMenuService } from './services/doc-paragraph-menu.service';
110
+ export type { IDocCanvasPopup } from './services/doc-popup-manager.service';
106
111
  export { calcDocRangePositions, DocCanvasPopManagerService } from './services/doc-popup-manager.service';
107
112
  export type { IDocPrintPreparationContext } from './services/doc-print-interceptor.service';
108
113
  export { DocPrintInterceptorService } from './services/doc-print-interceptor.service';
@@ -110,8 +115,10 @@ export type { IDocPrintComponentContext, IDocPrintContext } from './services/doc
110
115
  export { DocsRenderService } from './services/docs-render.service';
111
116
  export { Editor } from './services/editor/editor';
112
117
  export { EditorService, IEditorService } from './services/editor/editor-manager.service';
118
+ export type { IEditorRuntimeConfig } from './services/editor/editor-runtime-config';
113
119
  export { DocFloatMenuService } from './services/float-menu.service';
114
120
  export { isInSameTableCell, isValidRectRange, NodePositionConvertToRectRange, } from './services/selection/convert-rect-range';
121
+ export { findDocRangeNodePositions } from './services/selection/convert-text-range';
115
122
  export { NodePositionConvertToCursor } from './services/selection/convert-text-range';
116
123
  export { getOneTextSelectionRange } from './services/selection/convert-text-range';
117
124
  export type { IEditorInputConfig } from './services/selection/doc-selection-render.service';
@@ -123,6 +130,8 @@ export { getAnchorBounding, getLineBounding, TEXT_RANGE_LAYER_INDEX, TextRange }
123
130
  export { whenDocAndEditorFocused } from './shortcuts/utils';
124
131
  export { DOC_VERTICAL_PADDING } from './types/const/padding';
125
132
  export { BulletListTypePicker, OrderListTypePicker } from './views/list-type-picker/Picker';
133
+ export { MOBILE_DOC_ELEMENT_MENU, MobileDocElementMenu } from './views/mobile-element-menu/MobileDocElementMenu';
134
+ export { MobileRichTextEditor } from './views/mobile-rich-text-editor/MobileRichTextEditor';
126
135
  export { MobileRichTextToolbar } from './views/mobile-rich-text-toolbar/MobileRichTextToolbar';
127
136
  export type { IMobileRichTextToolbarProps } from './views/mobile-rich-text-toolbar/MobileRichTextToolbar';
128
137
  export { createEditorUndoRedoKeyboardConfig, executeEditorUndoRedoCommand, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, } from './views/rich-text-editor/hooks';
@@ -15,12 +15,38 @@
15
15
  */
16
16
  declare const locale: {
17
17
  'docs-ui': {
18
+ pasteOptions: {
19
+ title: string;
20
+ source: string;
21
+ destination: string;
22
+ text: string;
23
+ useKeyboard: string;
24
+ useSystemPaste: string;
25
+ failed: string;
26
+ };
27
+ outline: {
28
+ title: string;
29
+ };
18
30
  objectPermission: {
19
31
  paragraphPermission: string;
20
32
  title: string;
21
33
  paragraph: string;
22
34
  section: string;
23
35
  };
36
+ mobile: {
37
+ insert: string;
38
+ edit: string;
39
+ done: string;
40
+ more: string;
41
+ back: string;
42
+ close: string;
43
+ format: string;
44
+ layout: string;
45
+ keyboard: string;
46
+ hideKeyboard: string;
47
+ expand: string;
48
+ collapse: string;
49
+ };
24
50
  layout: {
25
51
  progress: string;
26
52
  recovering: string;
@@ -106,6 +132,8 @@ declare const locale: {
106
132
  selection: string;
107
133
  wordCount: string;
108
134
  selectedWords: string;
135
+ currentPage: string;
136
+ currentPageOfTotal: string;
109
137
  pages: string;
110
138
  words: string;
111
139
  charactersWithoutSpaces: string;
@@ -176,6 +204,8 @@ declare const locale: {
176
204
  copy: string;
177
205
  cut: string;
178
206
  paste: string;
207
+ select: string;
208
+ selectAll: string;
179
209
  delete: string;
180
210
  bulletList: string;
181
211
  orderList: string;
@@ -20,6 +20,8 @@ export declare function CopyMenuFactory(accessor: IAccessor): IMenuButtonItem<Lo
20
20
  export declare function ParagraphSettingMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
21
21
  export declare function CutMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
22
22
  export declare function PasteMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
23
+ export declare function SelectWordMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
24
+ export declare function SelectAllMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
23
25
  export declare function DeleteMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
24
26
  export declare const TABLE_INSERT_MENU_ID = "doc.menu.table-insert";
25
27
  export declare function TableInsertMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<LocaleKey>;
@@ -33,3 +35,4 @@ export declare function TableDeleteMenuItemFactory(accessor: IAccessor): IMenuSe
33
35
  export declare function DeleteRowsMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
34
36
  export declare function DeleteColumnsMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
35
37
  export declare function DeleteTableMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
38
+ export declare function PasteSpecialMenuFactory(accessor: IAccessor): IMenuSelectorItem<LocaleKey>;
@@ -0,0 +1,17 @@
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 { MenuSchemaType } from '@univerjs/ui';
17
+ export declare const mobileMenuSchema: MenuSchemaType;
@@ -0,0 +1,36 @@
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 { IUniverDocsUIConfig } from './config/config';
17
+ import { ICommandService, IConfigService, Injector, Plugin } from '@univerjs/core';
18
+ import { IRenderManagerService } from '@univerjs/engine-render';
19
+ export declare class UniverDocsMobileUIPlugin extends Plugin {
20
+ private readonly _config;
21
+ _injector: Injector;
22
+ private readonly _renderManagerSrv;
23
+ private _commandService;
24
+ private readonly _configService;
25
+ static pluginName: string;
26
+ static packageName: string;
27
+ static version: string;
28
+ constructor(_config: Partial<IUniverDocsUIConfig> | undefined, _injector: Injector, _renderManagerSrv: IRenderManagerService, _commandService: ICommandService, _configService: IConfigService);
29
+ onReady(): void;
30
+ onRendered(): void;
31
+ private _initCommand;
32
+ private _initDependencies;
33
+ private _initAutoFocus;
34
+ private _initRenderBasics;
35
+ private _initRenderModules;
36
+ }
@@ -15,9 +15,12 @@
15
15
  */
16
16
  import type { IDisposable, IDocumentBody, IDocumentData } from '@univerjs/core';
17
17
  import type { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
18
- import { Disposable, ErrorService, ICommandService, ILogService, ImageSourceType, IPermissionService, IUniverInstanceService, SliceBodyType } from '@univerjs/core';
19
- import { DocSelectionManagerService } from '@univerjs/docs';
18
+ import type { Observable } from 'rxjs';
19
+ import type { DocPasteMode } from './paste-options';
20
+ import { Disposable, ErrorService, ICommandService, ILogService, ImageSourceType, IPermissionService, IUndoRedoService, IUniverInstanceService, SliceBodyType } from '@univerjs/core';
21
+ import { DocSelectionManagerService, DocStateChangeManagerService } from '@univerjs/docs';
20
22
  import { IClipboardInterfaceService } from '@univerjs/ui';
23
+ import { DocMenuStyleService } from '../doc-menu-style.service';
21
24
  import { DocHtmlExportService } from './udm-to-html/doc-html-export.service';
22
25
  export declare function convertClipboardHtmlToDocumentData(html: string, unitId?: string): Partial<IDocumentData>;
23
26
  export declare function removeClipboardHtmlImages(html: string): string;
@@ -36,6 +39,11 @@ export interface IDocClipboardPasteContext {
36
39
  targetUnitId: string;
37
40
  }
38
41
  export interface IDocClipboardHook {
42
+ /** Supply a rich fragment for selections owned by a plugin rather than native text ranges. */
43
+ onCopySelection?(unitId: string): {
44
+ documentData: IDocumentData;
45
+ plainText: string;
46
+ } | undefined;
39
47
  onCopyDocData?(doc: Partial<IDocumentData>, context: IDocClipboardCopyDocDataContext): Partial<IDocumentData>;
40
48
  onCopyProperty?(start: number, end: number): IClipboardPropertyItem;
41
49
  onCopyContent?(start: number, end: number, context: IDocClipboardCopyContentContext): string;
@@ -45,17 +53,29 @@ export interface IDocClipboardHook {
45
53
  imageSourceType: ImageSourceType;
46
54
  } | null>;
47
55
  }
56
+ export interface IDocClipboardPayload {
57
+ html?: string;
58
+ text?: string;
59
+ internalJson?: string;
60
+ files: File[];
61
+ unitId?: string;
62
+ mode?: DocPasteMode;
63
+ }
64
+ export interface IDocPasteOptionsState {
65
+ unitId: string;
66
+ mode: DocPasteMode;
67
+ range: ITextRangeWithStyle;
68
+ }
48
69
  export interface IDocClipboardService {
49
70
  copy(sliceType?: SliceBodyType, ranges?: ITextRangeWithStyle[]): Promise<boolean>;
50
71
  cut(ranges?: ITextRangeWithStyle[]): Promise<boolean>;
51
- paste(items?: ClipboardItem[]): Promise<boolean>;
52
- legacyPaste(options: {
53
- html?: string;
54
- text?: string;
55
- internalJson?: string;
56
- files: File[];
57
- unitId?: string;
58
- }): Promise<boolean>;
72
+ paste(items?: ClipboardItem[], mode?: DocPasteMode): Promise<boolean>;
73
+ pasteFromClipboard(mode?: DocPasteMode): Promise<boolean>;
74
+ legacyPaste(options: IDocClipboardPayload): Promise<boolean>;
75
+ readonly pasteOptions$: Observable<IDocPasteOptionsState | null>;
76
+ setNextPasteMode(mode: DocPasteMode): void;
77
+ dismissPasteOptions(): void;
78
+ changePasteMode(mode: DocPasteMode): Promise<boolean>;
59
79
  addClipboardHook(hook: IDocClipboardHook): IDisposable;
60
80
  }
61
81
  export declare function getTableClipboardBodySlice(body: IDocumentBody, range: IRectRangeWithStyle): IDocumentBody;
@@ -68,21 +88,34 @@ export declare class DocClipboardService extends Disposable implements IDocClipb
68
88
  private readonly _clipboardInterfaceService;
69
89
  private readonly _errorService;
70
90
  private readonly _docSelectionManagerService;
91
+ private readonly _stateChangeManager;
92
+ private readonly _menuStyleService;
93
+ private readonly _undoRedoService;
94
+ private readonly _pasteOptions$;
95
+ readonly pasteOptions$: Observable<IDocPasteOptionsState | null>;
96
+ private _pasteSession;
97
+ private _applyingPaste;
98
+ private _pasteGeneration;
99
+ private _nextPasteMode;
100
+ private _lastSelectionKey;
71
101
  private _clipboardHooks;
72
102
  private _memoryClipboardData;
73
103
  private _htmlToUDM;
74
104
  private readonly _umdToHtml;
75
- constructor(_univerInstanceService: IUniverInstanceService, _logService: ILogService, _commandService: ICommandService, _permissionService: IPermissionService, _clipboardInterfaceService: IClipboardInterfaceService, _errorService: ErrorService, docHtmlExportService: DocHtmlExportService, _docSelectionManagerService: DocSelectionManagerService);
105
+ constructor(_univerInstanceService: IUniverInstanceService, _logService: ILogService, _commandService: ICommandService, _permissionService: IPermissionService, _clipboardInterfaceService: IClipboardInterfaceService, _errorService: ErrorService, docHtmlExportService: DocHtmlExportService, _docSelectionManagerService: DocSelectionManagerService, _stateChangeManager: DocStateChangeManagerService, _menuStyleService: DocMenuStyleService, _undoRedoService: IUndoRedoService);
76
106
  copy(sliceType?: SliceBodyType, ranges?: ITextRangeWithStyle[]): Promise<boolean>;
77
107
  cut(ranges?: ITextRangeWithStyle[]): Promise<boolean>;
78
- paste(items?: ClipboardItem[]): Promise<boolean>;
79
- legacyPaste(options: {
80
- html?: string;
81
- internalJson?: string;
82
- text?: string;
83
- files: File[];
84
- unitId?: string;
85
- }): Promise<boolean>;
108
+ pasteFromClipboard(mode?: DocPasteMode): Promise<boolean>;
109
+ paste(items?: ClipboardItem[], mode?: DocPasteMode): Promise<boolean>;
110
+ setNextPasteMode(mode: DocPasteMode): void;
111
+ legacyPaste(options: IDocClipboardPayload): Promise<boolean>;
112
+ dismissPasteOptions(): void;
113
+ changePasteMode(mode: DocPasteMode): Promise<boolean>;
114
+ private _preparePaste;
115
+ private _pasteWithOptions;
116
+ private _getPasteStyle;
117
+ private _getPasteSelectionKey;
118
+ private _savePasteSession;
86
119
  private _getCurrentDocumentUnitId;
87
120
  private _canEditTargets;
88
121
  private _cut;
@@ -92,7 +125,7 @@ export declare class DocClipboardService extends Disposable implements IDocClipb
92
125
  addClipboardHook(hook: IDocClipboardHook): IDisposable;
93
126
  private _applyCopyDocDataHooks;
94
127
  private _getDocumentBodyInRanges;
95
- private _genDocDataFromClipboardItems;
128
+ private _readClipboardItems;
96
129
  private _genDocDataFromHtmlAndText;
97
130
  private _uploadBase64ImagesInHtml;
98
131
  private _createImagePasteHtml;
@@ -0,0 +1,33 @@
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 { IDocumentData, IParagraphStyle, ITextStyle } from '@univerjs/core';
17
+ export type DocPasteMode = 'source' | 'destination' | 'text';
18
+ export interface IDocPasteStyle {
19
+ textStyle: ITextStyle;
20
+ paragraphStyle?: IParagraphStyle;
21
+ }
22
+ export declare const DOC_PASTE_OPTIONS: readonly [{
23
+ readonly value: "source";
24
+ readonly label: "docs-ui.pasteOptions.source";
25
+ }, {
26
+ readonly value: "destination";
27
+ readonly label: "docs-ui.pasteOptions.destination";
28
+ }, {
29
+ readonly value: "text";
30
+ readonly label: "docs-ui.pasteOptions.text";
31
+ }];
32
+ export declare function getClipboardPlainText(doc: Partial<IDocumentData>): string;
33
+ export declare function applyDocPasteMode(source: Partial<IDocumentData>, mode: DocPasteMode, style: IDocPasteStyle, text?: string): Partial<IDocumentData>;