@univerjs/docs-ui 1.0.0-alpha.6 → 1.0.0-alpha.8

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 (108) hide show
  1. package/lib/cjs/index.js +1102 -427
  2. package/lib/cjs/locale/ar-SA.js +39 -26
  3. package/lib/cjs/locale/ca-ES.js +39 -26
  4. package/lib/cjs/locale/de-DE.js +39 -26
  5. package/lib/cjs/locale/en-US.js +14 -1
  6. package/lib/cjs/locale/es-ES.js +39 -26
  7. package/lib/cjs/locale/fa-IR.js +41 -28
  8. package/lib/cjs/locale/fr-FR.js +42 -29
  9. package/lib/cjs/locale/id-ID.js +39 -26
  10. package/lib/cjs/locale/it-IT.js +39 -26
  11. package/lib/cjs/locale/ja-JP.js +39 -26
  12. package/lib/cjs/locale/ko-KR.js +39 -26
  13. package/lib/cjs/locale/pl-PL.js +38 -25
  14. package/lib/cjs/locale/pt-BR.js +39 -26
  15. package/lib/cjs/locale/ru-RU.js +39 -26
  16. package/lib/cjs/locale/sk-SK.js +39 -26
  17. package/lib/cjs/locale/vi-VN.js +60 -47
  18. package/lib/cjs/locale/zh-CN.js +14 -1
  19. package/lib/cjs/locale/zh-HK.js +66 -53
  20. package/lib/cjs/locale/zh-TW.js +48 -35
  21. package/lib/es/index.js +1108 -388
  22. package/lib/es/locale/ar-SA.js +39 -26
  23. package/lib/es/locale/ca-ES.js +39 -26
  24. package/lib/es/locale/de-DE.js +39 -26
  25. package/lib/es/locale/en-US.js +14 -1
  26. package/lib/es/locale/es-ES.js +39 -26
  27. package/lib/es/locale/fa-IR.js +41 -28
  28. package/lib/es/locale/fr-FR.js +42 -29
  29. package/lib/es/locale/id-ID.js +39 -26
  30. package/lib/es/locale/it-IT.js +39 -26
  31. package/lib/es/locale/ja-JP.js +39 -26
  32. package/lib/es/locale/ko-KR.js +39 -26
  33. package/lib/es/locale/pl-PL.js +38 -25
  34. package/lib/es/locale/pt-BR.js +39 -26
  35. package/lib/es/locale/ru-RU.js +39 -26
  36. package/lib/es/locale/sk-SK.js +39 -26
  37. package/lib/es/locale/vi-VN.js +60 -47
  38. package/lib/es/locale/zh-CN.js +14 -1
  39. package/lib/es/locale/zh-HK.js +66 -53
  40. package/lib/es/locale/zh-TW.js +48 -35
  41. package/lib/index.css +4 -8
  42. package/lib/index.js +1108 -388
  43. package/lib/locale/ar-SA.js +39 -26
  44. package/lib/locale/ca-ES.js +39 -26
  45. package/lib/locale/de-DE.js +39 -26
  46. package/lib/locale/en-US.js +14 -1
  47. package/lib/locale/es-ES.js +39 -26
  48. package/lib/locale/fa-IR.js +41 -28
  49. package/lib/locale/fr-FR.js +42 -29
  50. package/lib/locale/id-ID.js +39 -26
  51. package/lib/locale/it-IT.js +39 -26
  52. package/lib/locale/ja-JP.js +39 -26
  53. package/lib/locale/ko-KR.js +39 -26
  54. package/lib/locale/pl-PL.js +38 -25
  55. package/lib/locale/pt-BR.js +39 -26
  56. package/lib/locale/ru-RU.js +39 -26
  57. package/lib/locale/sk-SK.js +39 -26
  58. package/lib/locale/vi-VN.js +60 -47
  59. package/lib/locale/zh-CN.js +14 -1
  60. package/lib/locale/zh-HK.js +66 -53
  61. package/lib/locale/zh-TW.js +48 -35
  62. package/lib/types/basics/component-tools.d.ts +3 -5
  63. package/lib/types/basics/doc-custom-range-chrome.d.ts +31 -0
  64. package/lib/types/basics/paragraph.d.ts +1 -0
  65. package/lib/types/commands/commands/clipboard.inner.command.d.ts +2 -0
  66. package/lib/types/commands/commands/insert-special-character.command.d.ts +19 -0
  67. package/lib/types/commands/commands/replace-content.command.d.ts +10 -14
  68. package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +2 -0
  69. package/lib/types/commands/operations/insert-break.operation.d.ts +21 -0
  70. package/lib/types/controllers/doc-move-cursor.controller.d.ts +0 -1
  71. package/lib/types/controllers/doc-section-setting.controller.d.ts +4 -1
  72. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +11 -2
  73. package/lib/types/index.d.ts +10 -9
  74. package/lib/types/locale/en-US.d.ts +13 -0
  75. package/lib/types/menu/menu.d.ts +17 -0
  76. package/lib/types/services/clipboard/clipboard.service.d.ts +14 -4
  77. package/lib/types/services/clipboard/doc-paste-mutation-adapter.service.d.ts +11 -1
  78. package/lib/types/services/editor/editor-manager.service.d.ts +1 -0
  79. package/lib/types/services/editor/editor.d.ts +7 -26
  80. package/lib/types/services/float-menu.service.d.ts +5 -2
  81. package/lib/types/services/selection/convert-text-range.d.ts +1 -1
  82. package/lib/types/services/selection/doc-selection-render.service.d.ts +2 -3
  83. package/lib/types/views/ParagraphMenu.d.ts +1 -0
  84. package/lib/types/views/float-toolbar/FloatToolbar.d.ts +10 -3
  85. package/lib/types/views/paragraph-setting/hook/utils.d.ts +2 -0
  86. package/lib/types/views/rich-text-editor/hooks/use-keyboard-event.d.ts +2 -1
  87. package/lib/types/views/section-setting/use-section-setting.d.ts +33 -2
  88. package/lib/umd/index.js +10 -9
  89. package/lib/umd/locale/ar-SA.js +1 -1
  90. package/lib/umd/locale/ca-ES.js +1 -1
  91. package/lib/umd/locale/de-DE.js +1 -1
  92. package/lib/umd/locale/en-US.js +1 -1
  93. package/lib/umd/locale/es-ES.js +1 -1
  94. package/lib/umd/locale/fa-IR.js +1 -1
  95. package/lib/umd/locale/fr-FR.js +1 -1
  96. package/lib/umd/locale/id-ID.js +1 -1
  97. package/lib/umd/locale/it-IT.js +1 -1
  98. package/lib/umd/locale/ja-JP.js +1 -1
  99. package/lib/umd/locale/ko-KR.js +1 -1
  100. package/lib/umd/locale/pl-PL.js +1 -1
  101. package/lib/umd/locale/pt-BR.js +1 -1
  102. package/lib/umd/locale/ru-RU.js +1 -1
  103. package/lib/umd/locale/sk-SK.js +1 -1
  104. package/lib/umd/locale/vi-VN.js +1 -1
  105. package/lib/umd/locale/zh-CN.js +1 -1
  106. package/lib/umd/locale/zh-HK.js +1 -1
  107. package/lib/umd/locale/zh-TW.js +1 -1
  108. package/package.json +10 -10
@@ -13,20 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
17
- import type { DocBackground, Documents, Engine, IRenderContext, IRenderManagerService, Scene } from '@univerjs/engine-render';
16
+ import type { DocumentDataModel, Nullable } from '@univerjs/core';
17
+ import type { DocBackground, Documents, Engine, IRender, IRenderContext, IRenderManagerService, Scene } from '@univerjs/engine-render';
18
18
  export interface IDocObjectParam {
19
19
  document: Documents;
20
20
  docBackground: DocBackground;
21
21
  scene: Scene;
22
22
  engine: Engine;
23
23
  }
24
- export declare function neoGetDocObject(renderContext: IRenderContext<DocumentDataModel>): {
24
+ export declare function neoGetDocObject(renderContext: IRender | IRenderContext<DocumentDataModel>): {
25
25
  document: Documents;
26
26
  docBackground: DocBackground;
27
27
  scene: Scene;
28
28
  engine: Engine;
29
29
  };
30
- /** @deprecated After migrating to `RenderUnit`, use `neoGetDocObject` instead. */
31
- export declare function getDocObject(univerInstanceService: IUniverInstanceService, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
32
30
  export declare function getDocObjectById(unitId: string, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
@@ -0,0 +1,31 @@
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 { ThemeService } from '@univerjs/core';
17
+ import type { UniverRenderingContext } from '@univerjs/engine-render';
18
+ export declare const DOC_CUSTOM_RANGE_CHROME_RADIUS = 1;
19
+ export declare const DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA = 0.07;
20
+ export interface IDocCustomRangeChromeRect {
21
+ bottom: number;
22
+ left: number;
23
+ right: number;
24
+ top: number;
25
+ }
26
+ export interface IDocCustomRangeChromeTheme {
27
+ background: string;
28
+ border: string;
29
+ }
30
+ export declare function resolveDocCustomRangeChromeTheme(themeService: ThemeService): IDocCustomRangeChromeTheme;
31
+ export declare function drawDocCustomRangeChrome(ctx: Pick<UniverRenderingContext, 'beginPath' | 'fill' | 'fillStyle' | 'lineWidth' | 'restore' | 'roundRect' | 'save' | 'stroke' | 'strokeStyle'>, rect: IDocCustomRangeChromeRect, theme: IDocCustomRangeChromeTheme): void;
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ICustomDecoration, ICustomRange, ICustomTable, IDocumentBody, IParagraph, ITextRun, ITextStyle, Nullable } from '@univerjs/core';
17
+ export declare function isTopLevelStructuralGap(dataStream: string, offset: number): boolean;
17
18
  export declare function hasParagraphInTable(paragraph: IParagraph, tables: ICustomTable[]): boolean;
18
19
  export declare function getTextRunAtPosition(body: IDocumentBody, position: number, defaultStyle: ITextStyle, cacheStyle: Nullable<ITextStyle>, isCellEditor?: boolean): ITextRun;
19
20
  export declare function getCustomRangeAtPosition(customRanges: ICustomRange[], position: number, extendRange?: boolean): ICustomRange<Record<string, any>> | null | undefined;
@@ -15,10 +15,12 @@
15
15
  */
16
16
  import type { DocumentDataModel, ICommand, IDocumentData, ITextRange, JSONXActions, Nullable } from '@univerjs/core';
17
17
  import type { DocumentViewModel, IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
18
+ import type { IDocClipboardPasteCustomRangeMapping } from '../../services/clipboard/doc-paste-mutation-adapter.service';
18
19
  export interface IInnerPasteCommandParams {
19
20
  segmentId: string;
20
21
  doc: Partial<IDocumentData>;
21
22
  textRanges: ITextRangeWithStyle[];
23
+ customRangeMappings?: IDocClipboardPasteCustomRangeMapping[];
22
24
  }
23
25
  export declare const InnerPasteCommand: ICommand<IInnerPasteCommandParams>;
24
26
  export declare function getCutActionsFromDocRanges(textRanges: Readonly<Nullable<ITextRangeWithStyle[]>>, rectRanges: Readonly<Nullable<IRectRangeWithStyle[]>>, docDataModel: DocumentDataModel, viewModel: DocumentViewModel, segmentId: string): JSONXActions;
@@ -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 type { ICommand } from '@univerjs/core';
17
+ export declare const InsertSpecialCharacterCommand: ICommand<{
18
+ value: string;
19
+ }>;
@@ -26,19 +26,6 @@ export interface IReplaceSnapshotCommandParams {
26
26
  }
27
27
  export declare const ReplaceSnapshotCommand: ICommand<IReplaceSnapshotCommandParams>;
28
28
  export declare function buildReplaceSnapshotActions(previousSnapshot: IDocumentData, snapshot: IDocumentData): JSONXActions | null;
29
- interface IReplaceContentCommandParams {
30
- unitId: string;
31
- body: IDocumentBody;
32
- textRanges: ITextRangeWithStyle[];
33
- segmentId?: string;
34
- options: {
35
- [key: string]: boolean;
36
- };
37
- }
38
- /**
39
- * @deprecated please use ReplaceSnapshotCommand instead.
40
- */
41
- export declare const ReplaceContentCommand: ICommand<IReplaceContentCommandParams>;
42
29
  interface ICoverContentCommandParams {
43
30
  unitId: string;
44
31
  body: IDocumentBody;
@@ -53,5 +40,14 @@ export interface IReplaceSelectionCommandParams {
53
40
  textRanges?: ITextRangeWithStyle[];
54
41
  }
55
42
  export declare const ReplaceSelectionCommand: ICommand<IReplaceSelectionCommandParams>;
56
- export declare const ReplaceTextRunsCommand: ICommand<IReplaceContentCommandParams>;
43
+ interface IReplaceTextRunsCommandParams {
44
+ unitId: string;
45
+ body: IDocumentBody;
46
+ textRanges: ITextRangeWithStyle[];
47
+ segmentId?: string;
48
+ options: {
49
+ [key: string]: boolean;
50
+ };
51
+ }
52
+ export declare const ReplaceTextRunsCommand: ICommand<IReplaceTextRunsCommandParams>;
57
53
  export {};
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ICommand } from '@univerjs/core';
17
+ import type { ITextRangeWithStyle } from '@univerjs/engine-render';
17
18
  export interface IDocTableDeleteRowsCommandParams {
18
19
  }
19
20
  export declare const DocTableDeleteRowsCommand: ICommand<IDocTableDeleteRowsCommandParams>;
@@ -21,5 +22,6 @@ export interface IDocTableDeleteColumnsCommandParams {
21
22
  }
22
23
  export declare const DocTableDeleteColumnsCommand: ICommand<IDocTableDeleteColumnsCommandParams>;
23
24
  export interface IDocTableDeleteTableCommandParams {
25
+ targetRange?: ITextRangeWithStyle;
24
26
  }
25
27
  export declare const DocTableDeleteTableCommand: ICommand<IDocTableDeleteTableCommandParams>;
@@ -0,0 +1,21 @@
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 { ICommand, SectionType } from '@univerjs/core';
17
+ export interface IInsertDocumentSectionBreakOperationParams {
18
+ sectionType: SectionType;
19
+ }
20
+ export declare const InsertDocumentColumnBreakOperation: ICommand;
21
+ export declare const InsertDocumentSectionBreakOperation: ICommand<IInsertDocumentSectionBreakOperationParams>;
@@ -67,5 +67,4 @@ export declare class DocMoveCursorController extends Disposable {
67
67
  private _getDistanceToColumnGroupColumn;
68
68
  private _isColumnGroupContentPage;
69
69
  private _scrollToFocusNodePosition;
70
- private _getDocObject;
71
70
  }
@@ -14,11 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable } from '@univerjs/core';
17
+ import { DocSelectionManagerService } from '@univerjs/docs';
17
18
  import { ISidebarService } from '@univerjs/ui';
18
19
  export declare class DocSectionSettingController extends Disposable {
19
20
  private readonly _sidebarService;
21
+ private readonly _selectionManager;
20
22
  private readonly _panelId;
21
- constructor(_sidebarService: ISidebarService);
23
+ constructor(_sidebarService: ISidebarService, _selectionManager: DocSelectionManagerService);
22
24
  openPanel(): void;
23
25
  closePanel(): void;
26
+ navigateToSectionEnd(unitId: string, sectionStart: number, sectionEnd: number): void;
24
27
  }
@@ -14,11 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { DocumentDataModel, IDocumentBody, Nullable } from '@univerjs/core';
17
- import type { IDocumentSkeletonPage, IRenderContext, IRenderModule } from '@univerjs/engine-render';
17
+ import type { IDocumentSkeletonPage, IRenderContext, IRenderModule, UniverRenderingContext } from '@univerjs/engine-render';
18
18
  import type { IUniverDocsUIConfig } from '../../config/config';
19
19
  import { Disposable, IConfigService, LocaleService } from '@univerjs/core';
20
20
  import { DocSelectionManagerService } from '@univerjs/docs';
21
21
  export interface IParagraphPlaceholderLayout {
22
+ clipBottom?: number;
23
+ clipLeft?: number;
24
+ clipRight?: number;
25
+ clipTop?: number;
22
26
  fontFamily: string;
23
27
  fontSize: number;
24
28
  fontWeight: string;
@@ -36,6 +40,10 @@ interface IParagraphPlaceholderLocale {
36
40
  listItem: string;
37
41
  normalText: string;
38
42
  }
43
+ interface IParagraphPlaceholderLayoutOptions {
44
+ docsLeft?: number;
45
+ unitId?: string;
46
+ }
39
47
  export declare class DocParagraphPlaceholderRenderController extends Disposable implements IRenderModule {
40
48
  private readonly _context;
41
49
  private readonly _localeService;
@@ -47,5 +55,6 @@ export declare class DocParagraphPlaceholderRenderController extends Disposable
47
55
  private _getLocale;
48
56
  }
49
57
  export declare function shouldRenderParagraphPlaceholder(documentModel: DocumentDataModel, unitId: string, config?: Nullable<IUniverDocsUIConfig>): boolean;
50
- export declare function getParagraphPlaceholderLayouts(page: IDocumentSkeletonPage, body: IDocumentBody, locale: IParagraphPlaceholderLocale, pageLeft?: number, pageTop?: number, activeOffset?: number): IParagraphPlaceholderLayout[];
58
+ export declare function getParagraphPlaceholderLayouts(page: IDocumentSkeletonPage, body: IDocumentBody, locale: IParagraphPlaceholderLocale, pageLeft?: number, pageTop?: number, activeOffset?: number, options?: IParagraphPlaceholderLayoutOptions): IParagraphPlaceholderLayout[];
59
+ export declare function drawParagraphPlaceholders(ctx: UniverRenderingContext, placeholders: IParagraphPlaceholderLayout[]): void;
51
60
  export {};
@@ -15,8 +15,10 @@
15
15
  */
16
16
  import './global.css';
17
17
  export type { IDocObjectParam } from './basics/component-tools';
18
- export { getDocObject, getDocObjectById, neoGetDocObject } from './basics/component-tools';
18
+ export { getDocObjectById, neoGetDocObject } from './basics/component-tools';
19
19
  export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory, } from './basics/custom-decoration-factory';
20
+ export { DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA, DOC_CUSTOM_RANGE_CHROME_RADIUS, drawDocCustomRangeChrome, resolveDocCustomRangeChromeTheme, } from './basics/doc-custom-range-chrome';
21
+ export type { IDocCustomRangeChromeRect, IDocCustomRangeChromeTheme, } from './basics/doc-custom-range-chrome';
20
22
  export * from './basics/docs-view-key';
21
23
  export { hasParagraphInTable } from './basics/paragraph';
22
24
  export { AfterSpaceCommand, EnterCommand, TabCommand } from './commands/commands/auto-format.command';
@@ -31,7 +33,7 @@ export { getCutActionsFromDocRanges } from './commands/commands/clipboard.inner.
31
33
  export { buildMoveDocBlockActions, MoveDocBlockCommand } from './commands/commands/doc-block-move.command';
32
34
  export type { IMoveDocBlockCommandParams } from './commands/commands/doc-block-move.command';
33
35
  export { DeleteCurrentParagraphCommand, DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, MergeTwoParagraphCommand, } from './commands/commands/doc-delete.command';
34
- export type { IDeleteCurrentParagraphCommandParams, IDeleteCustomBlockParams } from './commands/commands/doc-delete.command';
36
+ export type { IDeleteCurrentParagraphCommandParams, IDeleteCustomBlockParams, } from './commands/commands/doc-delete.command';
35
37
  export { getCursorWhenDelete } from './commands/commands/doc-delete.command';
36
38
  export { HorizontalLineCommand } from './commands/commands/doc-horizontal-line.command';
37
39
  export { DocSelectAllCommand } from './commands/commands/doc-select-all.command';
@@ -44,7 +46,7 @@ export { BulletListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand
44
46
  export { ChangeListNestingLevelType } from './commands/commands/list.command';
45
47
  export { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand, } from './commands/commands/paragraph-align.command';
46
48
  export { ReplaceTextRunsCommand } from './commands/commands/replace-content.command';
47
- export { CoverContentCommand, ReplaceContentCommand, ReplaceSelectionCommand, ReplaceSnapshotCommand, } from './commands/commands/replace-content.command';
49
+ export { CoverContentCommand, ReplaceSelectionCommand, ReplaceSnapshotCommand, } from './commands/commands/replace-content.command';
48
50
  export type { IReplaceSelectionCommandParams, IReplaceSnapshotCommandParams, } from './commands/commands/replace-content.command';
49
51
  export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
50
52
  export { SetParagraphNamedStyleCommand } from './commands/commands/set-heading.command';
@@ -73,7 +75,7 @@ export { DocRenderController } from './controllers/render-controllers/doc.render
73
75
  export { DocUIController } from './controllers/ui.controller';
74
76
  export { createDefaultDocsTableLikeCustomBlockBleedViewport, resolveDocsTableLikeCustomBlockBleedViewport, resolveDocsTableLikeCustomBlockContentHeight, resolveDocsTableLikeCustomBlockContentWidth, } from './embed-docs-custom-block-bleed';
75
77
  export type { IDocsCustomBlockBleedViewport, IDocsCustomBlockBleedViewportHint } from './embed-docs-custom-block-bleed';
76
- export { collectDocsTableLikeEmbedChildUnitIds, createDocsCustomBlockSizeRefreshScheduler, shouldRefreshDocsCustomBlockSizeForCommand } from './embed-docs-custom-block-refresh';
78
+ export { collectDocsTableLikeEmbedChildUnitIds, createDocsCustomBlockSizeRefreshScheduler, shouldRefreshDocsCustomBlockSizeForCommand, } from './embed-docs-custom-block-refresh';
77
79
  export { scrollDocsTableLikeCustomBlockLive } from './embed-docs-custom-block-scroll';
78
80
  export type { IDocsTableLikeCustomBlockScrollOptions } from './embed-docs-custom-block-scroll';
79
81
  export { resolveDocsCustomBlockRenderViewport } from './embed-host-anchor';
@@ -84,14 +86,14 @@ export { menuSchema as DocsUIMenuSchema } from './menu/schema';
84
86
  export { UniverDocsUIPlugin } from './plugin';
85
87
  export * from './services';
86
88
  export { IDocClipboardService } from './services/clipboard/clipboard.service';
89
+ export type { IDocClipboardCopyContentContext, IDocClipboardHook, IDocClipboardPasteContext, } from './services/clipboard/clipboard.service';
87
90
  export { DocClipboardPasteAdapterService, IDocClipboardPasteAdapterService, } from './services/clipboard/doc-paste-mutation-adapter.service';
88
- export type { IDocClipboardPasteAdapter, IDocClipboardPasteCustomBlockMapping, IDocClipboardPasteMutationInfoParams, IDocClipboardPasteMutationInfos, } from './services/clipboard/doc-paste-mutation-adapter.service';
91
+ export type { IDocClipboardPasteAdapter, IDocClipboardPasteBlockRangeMapping, IDocClipboardPasteCustomBlockMapping, IDocClipboardPasteCustomRangeMapping, IDocClipboardPasteMutationInfoParams, IDocClipboardPasteMutationInfos, } from './services/clipboard/doc-paste-mutation-adapter.service';
89
92
  export { convertBodyToHtml } from './services/clipboard/udm-to-html/convertor';
90
93
  export { DocHtmlExportService } from './services/clipboard/udm-to-html/doc-html-export.service';
91
94
  export type { DocHtmlExportTransformer } from './services/clipboard/udm-to-html/doc-html-export.service';
92
95
  export { DocAutoFormatService } from './services/doc-auto-format.service';
93
- export { DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator } from './services/doc-embed-integration.service';
94
- export type { IDocEmbedInteractionBoundaryService as IDocEmbedInteractionBoundaryServiceType, IDocEmbedRuntimeFocusCoordinator as IDocEmbedRuntimeFocusCoordinatorType } from './services/doc-embed-integration.service';
96
+ export { DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator, } from './services/doc-embed-integration.service';
95
97
  export { DocEventManagerService, getListMarkerFallbackBound, getListParagraphContextMenuHit, } from './services/doc-event-manager.service';
96
98
  export type { IBulletBound, IMutiPageParagraphBound } from './services/doc-event-manager.service';
97
99
  export { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
@@ -111,7 +113,7 @@ export type { IEditorInputConfig } from './services/selection/doc-selection-rend
111
113
  export { DocSelectionRenderService } from './services/selection/doc-selection-render.service';
112
114
  export type { IDocRange } from './services/selection/range-interface';
113
115
  export { convertPositionsToRectRanges, RectRange } from './services/selection/rect-range';
114
- export { getCanvasOffsetByEngine } from './services/selection/selection-utils';
116
+ export { getCanvasOffsetByEngine, getTextRangeFromCharIndex } from './services/selection/selection-utils';
115
117
  export { getAnchorBounding, getLineBounding, TEXT_RANGE_LAYER_INDEX, TextRange } from './services/selection/text-range';
116
118
  export { whenDocAndEditorFocused } from './shortcuts/utils';
117
119
  export { DOC_VERTICAL_PADDING } from './types/const/padding';
@@ -119,5 +121,4 @@ export { createEditorUndoRedoKeyboardConfig, executeEditorUndoRedoCommand, useEd
119
121
  export type { ICreateEditorUndoRedoKeyboardConfigOptions, IExecuteEditorUndoRedoCommandOptions, IKeyboardEventConfig, } from './views/rich-text-editor/hooks';
120
122
  export { RichTextEditor } from './views/RichTextEditor';
121
123
  export type { IRichTextEditorProps } from './views/RichTextEditor';
122
- export { createDocsCustomBlockInsertMutation, createDocsCustomBlockRemoveMutation, createEmbedDocsCustomBlockData, createInsertCustomBlockActions, createRemoveCustomBlockActions, EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY, isSheetLikeDocsCustomBlockChildType, resolveDocsCustomBlockSize } from '@univerjs/docs';
123
124
  export type { IDocsCustomBlockMutationParams, IEmbedDocsCustomBlockData } from '@univerjs/docs';
@@ -50,6 +50,13 @@ declare const locale: {
50
50
  horizontalLine: string;
51
51
  headerFooter: string;
52
52
  pageSetup: string;
53
+ breaks: string;
54
+ columnBreak: string;
55
+ sectionBreakNextPage: string;
56
+ sectionBreakContinuous: string;
57
+ sectionBreakNextColumn: string;
58
+ sectionBreakEvenPage: string;
59
+ sectionBreakOddPage: string;
53
60
  heading: {
54
61
  tooltip: string;
55
62
  normal: string;
@@ -124,6 +131,7 @@ declare const locale: {
124
131
  };
125
132
  sectionSetting: {
126
133
  selectedSections: string;
134
+ multipleValues: string;
127
135
  columnCount: string;
128
136
  columnGap: string;
129
137
  columnSeparator: string;
@@ -132,9 +140,14 @@ declare const locale: {
132
140
  sectionStart: string;
133
141
  unspecified: string;
134
142
  continuous: string;
143
+ nextColumn: string;
135
144
  nextPage: string;
136
145
  evenPage: string;
137
146
  oddPage: string;
147
+ pageSetup: string;
148
+ pageWidth: string;
149
+ pageHeight: string;
150
+ pageNumberStart: string;
138
151
  };
139
152
  };
140
153
  rightClick: {
@@ -21,6 +21,10 @@ import { Observable } from 'rxjs';
21
21
  export declare function shouldSuppressDocMenuStateRefresh(accessor: IAccessor): boolean;
22
22
  export declare function disableMenuWhenHeaderFooterEditing(accessor: IAccessor): Observable<boolean>;
23
23
  export declare function disableMenuWhenNoDocRange(accessor: IAccessor): Observable<boolean>;
24
+ export declare const DOC_INSERT_EMOJI_MENU_ID = "doc.menu.insert-emoji";
25
+ export declare const DOC_INSERT_SYMBOL_MENU_ID = "doc.menu.insert-symbol";
26
+ export declare function EmojiPickerMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string, string, string>;
27
+ export declare function SymbolPickerMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string, string, string>;
24
28
  export declare function isTextRangeInAnyBlockRange(document: Nullable<DocumentDataModel>, range: ITextRangeParam): boolean;
25
29
  export declare function hideMenuWhenSelectionInBlockRange(accessor: IAccessor): Observable<boolean>;
26
30
  export declare function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
@@ -37,6 +41,19 @@ export declare const FLOAT_TOOLBAR_MENU_POSITION = "doc.menu.float-toolbar";
37
41
  export declare function FloatTextStyleMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<LocaleKey, string | number>;
38
42
  export declare function TextColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<LocaleKey, string, string | undefined>;
39
43
  export declare function HeaderFooterMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
44
+ export declare const DOC_BREAKS_MENU_ID = "doc.menu.breaks";
45
+ export declare const DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID = "doc.menu.section-break.next-page";
46
+ export declare const DOC_SECTION_BREAK_CONTINUOUS_MENU_ID = "doc.menu.section-break.continuous";
47
+ export declare const DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID = "doc.menu.section-break.next-column";
48
+ export declare const DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID = "doc.menu.section-break.even-page";
49
+ export declare const DOC_SECTION_BREAK_ODD_PAGE_MENU_ID = "doc.menu.section-break.odd-page";
50
+ export declare function BreaksMenuFactory(accessor: IAccessor): IMenuItem<LocaleKey>;
51
+ export declare function InsertColumnBreakMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
52
+ export declare function InsertNextPageSectionBreakMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
53
+ export declare function InsertContinuousSectionBreakMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
54
+ export declare function InsertNextColumnSectionBreakMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
55
+ export declare function InsertEvenPageSectionBreakMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
56
+ export declare function InsertOddPageSectionBreakMenuFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
40
57
  export declare const TableIcon = "GridIcon";
41
58
  export declare const TABLE_MENU_ID = "doc.menu.table";
42
59
  export declare function TableMenuFactory(accessor: IAccessor): IMenuItem<LocaleKey>;
@@ -24,11 +24,20 @@ export interface IClipboardPropertyItem {
24
24
  export interface IDocClipboardCopyDocDataContext {
25
25
  sourceDocuments: IDocumentData[];
26
26
  }
27
+ export interface IDocClipboardCopyContentContext {
28
+ body: IDocumentBody;
29
+ segmentId?: string;
30
+ unitId: string;
31
+ }
32
+ export interface IDocClipboardPasteContext {
33
+ documentData: Partial<IDocumentData>;
34
+ targetUnitId: string;
35
+ }
27
36
  export interface IDocClipboardHook {
28
37
  onCopyDocData?(doc: Partial<IDocumentData>, context: IDocClipboardCopyDocDataContext): Partial<IDocumentData>;
29
38
  onCopyProperty?(start: number, end: number): IClipboardPropertyItem;
30
- onCopyContent?(start: number, end: number): string;
31
- onBeforePaste?: (body: IDocumentBody) => IDocumentBody;
39
+ onCopyContent?(start: number, end: number, context: IDocClipboardCopyContentContext): string;
40
+ onBeforePaste?: (body: IDocumentBody, context: IDocClipboardPasteContext) => IDocumentBody;
32
41
  onBeforePasteImage?: (file: File) => Promise<{
33
42
  source: string;
34
43
  imageSourceType: ImageSourceType;
@@ -37,7 +46,7 @@ export interface IDocClipboardHook {
37
46
  export interface IDocClipboardService {
38
47
  copy(sliceType?: SliceBodyType, ranges?: ITextRangeWithStyle[]): Promise<boolean>;
39
48
  cut(ranges?: ITextRangeWithStyle[]): Promise<boolean>;
40
- paste(items: ClipboardItem[]): Promise<boolean>;
49
+ paste(items?: ClipboardItem[]): Promise<boolean>;
41
50
  legacyPaste(options: {
42
51
  html?: string;
43
52
  text?: string;
@@ -55,12 +64,13 @@ export declare class DocClipboardService extends Disposable implements IDocClipb
55
64
  private readonly _clipboardInterfaceService;
56
65
  private readonly _docSelectionManagerService;
57
66
  private _clipboardHooks;
67
+ private _memoryClipboardData;
58
68
  private _htmlToUDM;
59
69
  private readonly _umdToHtml;
60
70
  constructor(_univerInstanceService: IUniverInstanceService, _logService: ILogService, _commandService: ICommandService, _clipboardInterfaceService: IClipboardInterfaceService, docHtmlExportService: DocHtmlExportService, _docSelectionManagerService: DocSelectionManagerService);
61
71
  copy(sliceType?: SliceBodyType, ranges?: ITextRangeWithStyle[]): Promise<boolean>;
62
72
  cut(ranges?: ITextRangeWithStyle[]): Promise<boolean>;
63
- paste(items: ClipboardItem[]): Promise<boolean>;
73
+ paste(items?: ClipboardItem[]): Promise<boolean>;
64
74
  legacyPaste(options: {
65
75
  html?: string;
66
76
  internalJson?: string;
@@ -13,19 +13,29 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDisposable, IDocumentBody, IDocumentData, IDrawingParam, IMutationInfo } from '@univerjs/core';
16
+ import type { ICustomRange, IDisposable, IDocumentBlockRange, IDocumentBody, IDocumentData, IDrawingParam, IMutationInfo } from '@univerjs/core';
17
17
  export interface IDocClipboardPasteCustomBlockMapping {
18
18
  sourceBlockId: string;
19
19
  targetBlockId: string;
20
20
  sourceDrawing: IDrawingParam;
21
21
  targetDrawing: IDrawingParam;
22
22
  }
23
+ export interface IDocClipboardPasteBlockRangeMapping {
24
+ sourceBlockRange: IDocumentBlockRange;
25
+ targetBlockRange: IDocumentBlockRange;
26
+ }
27
+ export interface IDocClipboardPasteCustomRangeMapping {
28
+ sourceRange: ICustomRange;
29
+ targetRange: ICustomRange;
30
+ }
23
31
  export interface IDocClipboardPasteMutationInfoParams {
24
32
  unitId: string;
25
33
  segmentId: string;
26
34
  doc: Partial<IDocumentData>;
27
35
  sourceBody: IDocumentBody;
28
36
  targetBody: IDocumentBody;
37
+ blockRangeMappings: IDocClipboardPasteBlockRangeMapping[];
38
+ customRangeMappings?: IDocClipboardPasteCustomRangeMapping[];
29
39
  customBlockMappings: IDocClipboardPasteCustomBlockMapping[];
30
40
  }
31
41
  export interface IDocClipboardPasteMutationInfos {
@@ -24,6 +24,7 @@ import { Editor } from './editor';
24
24
  export interface IEditorRenderConfig {
25
25
  canvasStyle: IEditorCanvasStyle;
26
26
  scrollBar?: boolean;
27
+ backScrollOffset?: number;
27
28
  }
28
29
  export interface IEditorSetValueParam {
29
30
  editorUnitId: string;
@@ -91,11 +91,11 @@ export declare class Editor extends Disposable implements IEditor {
91
91
  private _listenSelection;
92
92
  isFocus(): boolean;
93
93
  /**
94
- * @deprecated use `IEditorService.focus` as instead. this is for internal usage.
94
+ * Focus the input element directly. This is for internal usage.
95
95
  */
96
96
  focus(): void;
97
97
  /**
98
- * @deprecated use `IEditorService.blur` as instead. this is for internal usage.
98
+ * Blur the input element directly. This is for internal usage.
99
99
  */
100
100
  blur(): void;
101
101
  select(): void;
@@ -109,15 +109,12 @@ export declare class Editor extends Disposable implements IEditor {
109
109
  replaceText(text: string, resetCursor?: boolean | ITextRangeWithStyle[]): void;
110
110
  clearUndoRedoHistory(): void;
111
111
  dispose(): void;
112
- /**
113
- * @deprecated use getEditorId.
114
- */
115
- get editorUnitId(): string | undefined;
116
- /**
117
- * @deprecated @TODO: @JOCS remove this in the future.
118
- */
119
- get params(): IEditorOptions;
120
112
  get cancelDefaultResizeListener(): boolean | undefined;
113
+ getRenderConfig(): {
114
+ backScrollOffset?: number | undefined;
115
+ canvasStyle: IEditorCanvasStyle;
116
+ scrollBar: boolean | undefined;
117
+ };
121
118
  get render(): IRender;
122
119
  isReadOnly(): boolean;
123
120
  getBoundingClientRect(): DOMRect;
@@ -125,22 +122,6 @@ export declare class Editor extends Disposable implements IEditor {
125
122
  isVisible(): boolean | undefined;
126
123
  getSkeleton(): import("@univerjs/engine-render").DocumentSkeleton | undefined;
127
124
  isSheetEditor(): boolean;
128
- /**
129
- * @deprecated use getDocumentData.
130
- */
131
- getValue(): string;
132
- /**
133
- * @deprecated use getDocumentData.
134
- */
135
- getBody(): import("@univerjs/core").IDocumentBody | undefined;
136
- /**
137
- * @deprecated.
138
- */
139
- update(param: Partial<IEditorOptions>): void;
140
- /**
141
- * @deprecated.
142
- */
143
- updateCanvasStyle(): void;
144
125
  private _getDocDataModel;
145
126
  private _getEditorId;
146
127
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { DocumentDataModel, IDisposable, Nullable } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
- import { Disposable, IUniverInstanceService } from '@univerjs/core';
18
+ import { Disposable, IContextService, IUniverInstanceService } from '@univerjs/core';
19
19
  import { DocSelectionManagerService } from '@univerjs/docs';
20
20
  import { DocCanvasPopManagerService } from './doc-popup-manager.service';
21
21
  import { DocSelectionRenderService } from './selection/doc-selection-render.service';
@@ -25,14 +25,17 @@ export declare class DocFloatMenuService extends Disposable implements IRenderMo
25
25
  private readonly _docCanvasPopManagerService;
26
26
  private readonly _univerInstanceService;
27
27
  private readonly _docSelectionRenderService;
28
+ private readonly _contextService;
28
29
  private _floatMenu;
29
- constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docCanvasPopManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _docSelectionRenderService: DocSelectionRenderService);
30
+ private _suppressed;
31
+ constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docCanvasPopManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _docSelectionRenderService: DocSelectionRenderService, _contextService: IContextService);
30
32
  get floatMenu(): Nullable<{
31
33
  disposable: IDisposable;
32
34
  start: number;
33
35
  end: number;
34
36
  }>;
35
37
  hideFloatMenu(): void;
38
+ setSuppressed(suppressed: boolean): void;
36
39
  private _initSelectionChange;
37
40
  private _hideFloatMenu;
38
41
  private _showFloatMenu;
@@ -69,7 +69,7 @@ export declare class NodePositionConvertToCursor {
69
69
  };
70
70
  private _getCaretGlyph;
71
71
  private _findTextLikeGlyph;
72
- private _isNonInlineEmbedCustomBlockGlyph;
72
+ private _isNonInlineDrawingGlyph;
73
73
  private _isValidPosition;
74
74
  private _resetCurrentNodePositionState;
75
75
  private _setNodePositionState;
@@ -100,13 +100,12 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
100
100
  }): void;
101
101
  setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
102
102
  sync(): void;
103
+ setInputPosition(x: number, y: number): void;
103
104
  activate(x: number, y: number, force?: boolean): void;
105
+ private _positionInput;
104
106
  hasFocus(): boolean;
105
107
  focus(): void;
106
108
  blur(): void;
107
- /**
108
- * @deprecated
109
- */
110
109
  deactivate(): void;
111
110
  __handleDblClick(evt: IPointerEvent | IMouseEvent): void;
112
111
  __handleTripleClick(evt: IPointerEvent | IMouseEvent): void;
@@ -70,6 +70,7 @@ export declare function buildUnwrapBlockRangeActions(previousBody: IDocumentBody
70
70
  export declare function getParagraphFormattingRange(target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null): ITextRangeWithStyle | null;
71
71
  export declare function getParagraphMenuCommandTargetRange(commandId: string | undefined, targetRange?: ITextRangeWithStyle | null, formattingRange?: ITextRangeWithStyle | null): ITextRangeWithStyle | null | undefined;
72
72
  export declare function finishParagraphMenuCommand(docParagraphMenuService: Pick<DocParagraphMenuService, 'hideParagraphMenu'> | null | undefined, layoutService: Pick<ILayoutService, 'focus'>, hideMenu: () => void): void;
73
+ export declare function getBlockRangeClipboardTargetRange(commandId: string, target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null | void): ITextRangeWithStyle | null;
73
74
  export declare const ParagraphMenu: ({ popup }: {
74
75
  popup: IPopup;
75
76
  }) => import("react").JSX.Element;
@@ -15,11 +15,18 @@
15
15
  */
16
16
  import type { IMenuManagerService as IMenuManagerServiceType, IMenuSchema } from '@univerjs/ui';
17
17
  interface IFloatToolbarProps {
18
- avaliableMenus?: string[];
18
+ avaliableMenus?: Array<string | IFloatToolbarMenuConfig>;
19
+ }
20
+ interface IFloatToolbarMenuConfig {
21
+ id: string;
22
+ iconColor?: string;
23
+ }
24
+ interface IFloatToolbarMenuSchema extends IMenuSchema {
25
+ iconColor?: string;
19
26
  }
20
27
  export declare const FLOAT_MENU_COMPONENT_KEY = "univer.doc.float-menu";
21
- export declare function resolveFloatToolbarMenus(menuManagerService: IMenuManagerServiceType, avaliableMenus: string[]): {
22
- menus: IMenuSchema[];
28
+ export declare function resolveFloatToolbarMenus(menuManagerService: IMenuManagerServiceType, avaliableMenus: Array<string | IFloatToolbarMenuConfig>): {
29
+ menus: IFloatToolbarMenuSchema[];
23
30
  extraMenus: IMenuSchema[];
24
31
  };
25
32
  export declare function FloatToolbar(props: IFloatToolbarProps): import("react").JSX.Element;
@@ -19,12 +19,14 @@ export declare function resolveParagraphsForSettingPanel(paragraphs: IParagraph[
19
19
  paragraphStyle: import("@univerjs/core").IParagraphStyle;
20
20
  startIndex: number;
21
21
  paragraphId: string;
22
+ styleId?: string;
22
23
  bullet?: import("@univerjs/core").IBullet;
23
24
  }[];
24
25
  export declare const useCurrentParagraph: () => import("@univerjs/core").IParagraphRange[] | {
25
26
  paragraphStyle: import("@univerjs/core").IParagraphStyle;
26
27
  startIndex: number;
27
28
  paragraphId: string;
29
+ styleId?: string;
28
30
  bullet?: import("@univerjs/core").IBullet;
29
31
  }[];
30
32
  export declare const useFirstParagraphHorizontalAlign: (paragraph: IParagraph[], defaultValue: string) => readonly [string, (v: string) => Promise<boolean>];