@univerjs/docs-ui 1.0.0-rc.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) 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/commands/commands/clipboard.command.d.ts +9 -2
  65. package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -1
  66. package/lib/types/commands/commands/doc-select-all.command.d.ts +1 -0
  67. package/lib/types/commands/commands/format-painter.command.d.ts +33 -0
  68. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +1 -0
  69. package/lib/types/components/doc-page-render-component.d.ts +21 -0
  70. package/lib/types/config/config.d.ts +2 -0
  71. package/lib/types/consts/mobile-context.d.ts +17 -0
  72. package/lib/types/controllers/doc-header-footer.controller.d.ts +3 -6
  73. package/lib/types/controllers/doc-move-cursor.controller.d.ts +1 -0
  74. package/lib/types/controllers/format-painter.controller.d.ts +23 -0
  75. package/lib/types/controllers/mobile/components.controller.d.ts +25 -0
  76. package/lib/types/controllers/mobile/ui.controller.d.ts +29 -0
  77. package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +4 -3
  78. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +4 -3
  79. package/lib/types/controllers/render-controllers/doc-paste-options.render-controller.d.ts +27 -0
  80. package/lib/types/controllers/render-controllers/doc-selection-render.controller.d.ts +2 -0
  81. package/lib/types/controllers/render-controllers/doc-selection-render.util.d.ts +21 -0
  82. package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +19 -5
  83. package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +23 -0
  84. package/lib/types/controllers/render-controllers/mobile/back-scroll.render-controller.d.ts +30 -0
  85. package/lib/types/controllers/render-controllers/mobile/doc-pinch-zoom.d.ts +51 -0
  86. package/lib/types/controllers/render-controllers/mobile/doc-selection-render.controller.d.ts +73 -0
  87. package/lib/types/controllers/render-controllers/mobile/doc.render-controller.d.ts +36 -0
  88. package/lib/types/controllers/render-controllers/mobile/zoom.render-controller.d.ts +30 -0
  89. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +8 -6
  90. package/lib/types/index.d.ts +10 -1
  91. package/lib/types/locale/en-US.d.ts +30 -0
  92. package/lib/types/menu/context-menu.d.ts +3 -0
  93. package/lib/types/menu/mobile-schema.d.ts +17 -0
  94. package/lib/types/mobile-plugin.d.ts +36 -0
  95. package/lib/types/services/clipboard/clipboard.service.d.ts +53 -20
  96. package/lib/types/services/clipboard/paste-options.d.ts +33 -0
  97. package/lib/types/services/doc-contextual-ribbon.service.d.ts +29 -0
  98. package/lib/types/services/doc-event-manager.service.d.ts +3 -0
  99. package/lib/types/services/doc-mobile-element-menu.service.d.ts +44 -0
  100. package/lib/types/services/doc-page-layout.service.d.ts +3 -0
  101. package/lib/types/services/doc-paragraph-menu.service.d.ts +3 -2
  102. package/lib/types/services/doc-popup-manager.service.d.ts +1 -0
  103. package/lib/types/services/doc-view-scale.d.ts +1 -1
  104. package/lib/types/services/editor/editor-manager.service.d.ts +2 -0
  105. package/lib/types/services/editor/editor-runtime-config.d.ts +24 -0
  106. package/lib/types/services/editor/editor.d.ts +9 -0
  107. package/lib/types/services/float-menu.service.d.ts +12 -4
  108. package/lib/types/services/mobile/doc-selection-render.service.d.ts +60 -0
  109. package/lib/types/services/mobile/doc-view-scale.d.ts +19 -0
  110. package/lib/types/services/mobile/float-menu.service.d.ts +20 -0
  111. package/lib/types/services/mobile/mobile-text-selection-visuals.d.ts +32 -0
  112. package/lib/types/services/selection/convert-text-range.d.ts +7 -0
  113. package/lib/types/services/selection/doc-selection-render.service.d.ts +38 -21
  114. package/lib/types/views/DocPasteOptions.d.ts +17 -0
  115. package/lib/types/views/Icon.d.ts +0 -3
  116. package/lib/types/views/PageSettings.d.ts +5 -1
  117. package/lib/types/views/ParagraphMenu.d.ts +1 -2
  118. package/lib/types/views/RichTextEditor.d.ts +20 -1
  119. package/lib/types/views/SideMenu.d.ts +1 -0
  120. package/lib/types/views/doc-statistics/DocPageStatus.d.ts +30 -0
  121. package/lib/types/views/float-toolbar/FloatToolbar.d.ts +1 -0
  122. package/lib/types/views/header-footer/content-cover.d.ts +30 -0
  123. package/lib/types/views/header-footer/panel/DocHeaderFooterOptions.d.ts +4 -0
  124. package/lib/types/views/header-footer/panel/DocHeaderFooterPanel.d.ts +2 -1
  125. package/lib/types/views/header-footer/panel/use-header-footer-options.d.ts +25 -0
  126. package/lib/types/views/mobile/MobileDocCanvasViewport.d.ts +20 -0
  127. package/lib/types/views/mobile/MobileDocPasteOptions.d.ts +21 -0
  128. package/lib/types/views/mobile/MobileDocSettings.d.ts +20 -0
  129. package/lib/types/views/mobile-doc-toolbar/MobileDocToolbar.d.ts +30 -0
  130. package/lib/types/views/mobile-element-menu/MobileDocElementMenu.d.ts +25 -0
  131. package/lib/types/views/mobile-rich-text-editor/MobileRichTextEditor.d.ts +33 -0
  132. package/lib/types/views/paragraph-setting/Setting.d.ts +30 -1
  133. package/lib/types/views/paragraph-setting/hook/utils.d.ts +4 -0
  134. package/lib/types/views/paragraph-setting/index.d.ts +2 -1
  135. package/lib/types/views/rich-text-editor/hooks/use-editor.d.ts +8 -0
  136. package/lib/types/views/rich-text-editor/hooks/use-resize.d.ts +2 -1
  137. package/lib/types/views/section-setting/Setting.d.ts +12 -1
  138. package/lib/types/views/section-setting/index.d.ts +2 -1
  139. package/lib/umd/index.js +19 -18
  140. package/lib/umd/locale/ar-SA.js +1 -1
  141. package/lib/umd/locale/ca-ES.js +1 -1
  142. package/lib/umd/locale/de-DE.js +1 -1
  143. package/lib/umd/locale/en-US.js +1 -1
  144. package/lib/umd/locale/es-ES.js +1 -1
  145. package/lib/umd/locale/fa-IR.js +1 -1
  146. package/lib/umd/locale/fr-FR.js +1 -1
  147. package/lib/umd/locale/id-ID.js +1 -1
  148. package/lib/umd/locale/it-IT.js +1 -1
  149. package/lib/umd/locale/ja-JP.js +1 -1
  150. package/lib/umd/locale/ko-KR.js +1 -1
  151. package/lib/umd/locale/pl-PL.js +1 -1
  152. package/lib/umd/locale/pt-BR.js +1 -1
  153. package/lib/umd/locale/ru-RU.js +1 -1
  154. package/lib/umd/locale/sk-SK.js +1 -1
  155. package/lib/umd/locale/vi-VN.js +1 -1
  156. package/lib/umd/locale/zh-CN.js +1 -1
  157. package/lib/umd/locale/zh-HK.js +1 -1
  158. package/lib/umd/locale/zh-TW.js +1 -1
  159. package/package.json +13 -12
@@ -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>;
@@ -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;
@@ -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
  }