@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
package/lib/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { BaselineOffset, BlockType, BooleanNumber, BuildTextUtils, COLORS, ColorKit, ColumnSeparatorType, CommandType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DeleteDirection, DependentOn, Direction, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentBlockType, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR, HorizontalAlign, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterceptorManager, JSONX, LRUMap, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, NAMED_STYLE_MAP, NamedStyleType, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, PresetListType, QuickListTypeMap, RANGE_DIRECTION, Rectangle, RedoCommand, RxDisposable, SHEET_EDITOR_UNITS, SectionType, SliceBodyType, SpacingRule, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextX, TextXActionType, ThemeService, Tools, UndoCommand, UniverInstanceType, UpdateDocsAttributeType, VerticalAlign, checkForSubstrings, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createSectionId, debounce, deepCompare, fromEventSubject, generateRandomId, getBlockRangeInterval, getBodySlice, getBodySliceForTextXAction, getCustomBlockIdsInSelections, getParagraphContentStartOffset, getParagraphContentStartOffsets, getPlainText, getRichTextEditPath, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isCommentEditorID, isInternalEditorID, isSafeUrl, merge, mergeOverrideWithDependencies, normalizeBody, remove, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, sequenceExecuteAsync, skipParseTagNames, toDisposable, touchDependencies } from "@univerjs/core";
2
- import { CreateHeaderFooterCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, DocStateEmitService, EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY, HeaderFooterType, IDocStateChangeInterceptorService, InsertTextCommand, RichTextEditingMutation, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsPlugin, UpdateDocumentSectionCommand, UpdateTextCommand, buildDocTransform, consumeContentInsertRange, createDocsCustomBlockInsertMutation, createDocsCustomBlockRemoveMutation, createEmbedDocsCustomBlockData, createInsertCustomBlockActions, createRemoveCustomBlockActions, createSectionColumnProperties, generateParagraphs, getTopLevelSectionBreaks, isSheetLikeDocsCustomBlockChildType, isSheetLikeDocsCustomBlockChildType as isSheetLikeDocsCustomBlockChildType$1, resolveDocsCustomBlockSize, resolveDocsCustomBlockSize as resolveDocsCustomBlockSize$1, shouldUseInlineTextSelectionForDocsCustomBlockDrawing } from "@univerjs/docs";
3
- import { CURSOR_TYPE, DeviceInputEventType, DocBackground, DocumentEditArea, DocumentSkeletonPageType, Documents, GlyphType, IRenderManagerService, Layer, LineType, Liquid, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, PageLayoutType, Path, Rect, RegularPolygon, ScrollBar, ScrollTimer, Shape, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, Viewport, compareDocumentSkeletonNestedPagePathOrder, documentSkeletonLineIterator, documentSkeletonTableIterator, getColor, getDocsTableRenderViewport, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getLastColumn, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getSystemHighlightColor, getTableIdAndSliceIndex, hasListGlyph, isFirstGlyph, isIndentByGlyph, parseDataStreamToTree, pixelToPt, ptToPixel, pxToNum } from "@univerjs/engine-render";
4
- import { BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, ComponentManager, ContextMenuGroup, ContextMenuPanel, ContextMenuPosition, CopyCommand, CutCommand, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, ILayoutService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MenuManagerPosition, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RectPopup, RibbonInsertGroup, RibbonStartGroup, Slider, ToolbarItem, connectInjector, getMenuHiddenObservable, imageMimeTypeSet, useConfigValue, useDependency, useEvent, useObservable } from "@univerjs/ui";
5
- import { BehaviorSubject, Observable, Subject, animationFrameScheduler, combineLatest, debounceTime, distinctUntilChanged, filter, first, fromEvent, map, merge as merge$1, startWith, switchMap, take, takeUntil, throttleTime } from "rxjs";
1
+ import { BaselineOffset, BlockType, BooleanNumber, BuildTextUtils, COLORS, ColorKit, ColumnSeparatorType, CommandType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOC_RANGE_TYPE, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, DeleteDirection, DependentOn, Direction, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentBlockType, DocumentFlavor, DrawingTypeEnum, EDITOR_ACTIVATED, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR, HorizontalAlign, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterceptorManager, JSONX, LRUMap, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, NAMED_STYLE_MAP, NamedStyleType, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PAPER_TYPES, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, PresetListType, QuickListTypeMap, RANGE_DIRECTION, Rectangle, RedoCommand, RichTextBuilder, RxDisposable, SHEET_EDITOR_UNITS, SectionType, SliceBodyType, SpacingRule, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextX, TextXActionType, ThemeService, Tools, UndoCommand, UniverInstanceType, UpdateDocsAttributeType, VerticalAlign, checkForSubstrings, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createSectionId, debounce, deepCompare, fromEventSubject, generateRandomId, getBlockRangeInterval, getBodySlice, getBodySliceForTextXAction, getCustomBlockIdsInSelections, getParagraphContentStartOffset, getParagraphContentStartOffsets, getPlainText, getRichTextEditPath, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isCommentEditorID, isInternalEditorID, isSafeUrl, merge, mergeOverrideWithDependencies, normalizeBody, remove, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, sequenceExecuteAsync, skipParseTagNames, toDisposable, touchDependencies } from "@univerjs/core";
2
+ import { CreateHeaderFooterCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, DocStateEmitService, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsPlugin, UpdateDocumentSectionCommand, UpdateTextCommand, buildDocTransform, consumeContentInsertRange, createSectionColumnProperties, generateParagraphs, getTopLevelSectionBreaks, isSheetLikeDocsCustomBlockChildType, resolveDocsCustomBlockSize, shouldUseInlineTextSelectionForDocsCustomBlockDrawing } from "@univerjs/docs";
3
+ import { CURSOR_TYPE, DeviceInputEventType, DocBackground, DocumentEditArea, DocumentSkeletonPageType, Documents, GlyphType, IRenderManagerService, Layer, LineType, Liquid, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, PageLayoutType, Path, Rect, RegularPolygon, ScrollBar, ScrollTimer, Shape, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, Viewport, compareDocumentSkeletonNestedPagePathOrder, documentSkeletonLineIterator, documentSkeletonTableIterator, getColor, getDocsTableRenderViewport, getDocsTableViewportLeft, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getLastColumn, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getSystemHighlightColor, getTableIdAndSliceIndex, hasListGlyph, isFirstGlyph, isIndentByGlyph, parseDataStreamToTree, pixelToPt, ptToPixel, pxToNum } from "@univerjs/engine-render";
4
+ import { BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, ComponentManager, ContextMenuGroup, ContextMenuPanel, ContextMenuPosition, CopyCommand, CutCommand, EMOJI_PICKER_COMPONENT, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, ILayoutService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MenuManagerPosition, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RectPopup, RibbonInsertGroup, RibbonStartGroup, SYMBOL_PICKER_COMPONENT, Slider, ToolbarItem, connectInjector, getMenuHiddenObservable, imageMimeTypeSet, useConfigValue, useDependency, useEvent, useObservable } from "@univerjs/ui";
5
+ import { BehaviorSubject, Observable, Subject, animationFrameScheduler, combineLatest, debounceTime, distinctUntilChanged, filter, first, fromEvent, map, merge as merge$1, shareReplay, startWith, switchMap, take, takeUntil, throttleTime } from "rxjs";
6
6
  import { bufferTime, filter as filter$1, map as map$1 } from "rxjs/operators";
7
- import { Button, Checkbox, InputNumber, Select, Tooltip, borderClassName, clsx, scrollbarClassName } from "@univerjs/design";
7
+ import { Button, Checkbox, InputNumber, Select, Tooltip, borderClassName, clsx, resetButtonClassName, scrollbarClassName } from "@univerjs/design";
8
8
  import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
- import { AddImageIcon, AlignTextBothIcon, BoldIcon, CatalogueIcon, CopyDoubleIcon, CutIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DeleteTableDoubleIcon, DocSettingIcon, FontColorDoubleIcon, GridIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, HeaderFooterIcon, HorizontallyIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, KeyboardIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LineIndentDecreaseIcon, LineIndentIncreaseIcon, MenuIcon, MoreLeftIcon, MoreRightIcon, NoColorDoubleIcon, OrderIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, ReduceDoubleIcon, ReduceIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, ShapeIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TextTypeIcon, TodoListDoubleIcon, UnderlineIcon, UnorderIcon } from "@univerjs/icons";
10
+ import { AddImageIcon, AlignTextBothIcon, BoldIcon, CatalogueIcon, ColumnIcon, CopyDoubleIcon, CutIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DeleteTableDoubleIcon, DocSettingIcon, FontColorDoubleIcon, GridIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, HeaderFooterIcon, HorizontallyIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, KeyboardIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LineIndentDecreaseIcon, LineIndentIncreaseIcon, MenuIcon, MoreLeftIcon, MoreRightIcon, NoColorDoubleIcon, OrderIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, ReduceDoubleIcon, ReduceIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, ShapeIcon, SmileIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, SymbolsIcon, TextTypeIcon, TodoListDoubleIcon, UnderlineIcon, UnorderIcon } from "@univerjs/icons";
11
11
 
12
12
  //#region src/basics/docs-view-key.ts
13
13
  /**
@@ -54,23 +54,8 @@ function neoGetDocObject(renderContext) {
54
54
  engine
55
55
  };
56
56
  }
57
- /** @deprecated After migrating to `RenderUnit`, use `neoGetDocObject` instead. */
58
- function getDocObject(univerInstanceService, renderManagerService) {
59
- const documentModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
60
- if (!documentModel) return null;
61
- const unitId = documentModel.getUnitId();
62
- const currentRender = renderManagerService.getRenderById(unitId);
63
- if (currentRender == null) return;
64
- const { mainComponent, scene, engine, components } = currentRender;
65
- return {
66
- document: mainComponent,
67
- docBackground: components.get("__Document_Render_Background__"),
68
- scene,
69
- engine
70
- };
71
- }
72
57
  function getDocObjectById(unitId, renderManagerService) {
73
- const currentRender = renderManagerService.getRenderById(unitId);
58
+ const currentRender = renderManagerService.getRenderUnitById(unitId);
74
59
  if (currentRender == null) return;
75
60
  const { mainComponent, scene, engine, components } = currentRender;
76
61
  return {
@@ -148,8 +133,36 @@ function deleteCustomDecorationFactory(accessor, params) {
148
133
  return doMutation;
149
134
  }
150
135
 
136
+ //#endregion
137
+ //#region src/basics/doc-custom-range-chrome.ts
138
+ const DOC_CUSTOM_RANGE_CHROME_RADIUS = 1;
139
+ const DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA = .07;
140
+ function resolveDocCustomRangeChromeTheme(themeService) {
141
+ const primary = themeService.getColorFromTheme("primary.600");
142
+ return {
143
+ background: new ColorKit(primary).setAlpha(DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA).toRgbString(),
144
+ border: primary
145
+ };
146
+ }
147
+ function drawDocCustomRangeChrome(ctx, rect, theme) {
148
+ ctx.save();
149
+ ctx.fillStyle = theme.background;
150
+ ctx.strokeStyle = theme.border;
151
+ ctx.lineWidth = 1;
152
+ ctx.beginPath();
153
+ ctx.roundRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 1);
154
+ ctx.fill();
155
+ ctx.stroke();
156
+ ctx.restore();
157
+ }
158
+
151
159
  //#endregion
152
160
  //#region src/basics/paragraph.ts
161
+ function isTopLevelStructuralGap(dataStream, offset) {
162
+ const previousToken = dataStream[offset - 1];
163
+ const nextToken = dataStream[offset];
164
+ return previousToken === DataStreamTreeTokenType.BLOCK_END || previousToken === DataStreamTreeTokenType.TABLE_END || previousToken === DataStreamTreeTokenType.COLUMN_GROUP_END || nextToken === DataStreamTreeTokenType.BLOCK_START || nextToken === DataStreamTreeTokenType.TABLE_START || nextToken === DataStreamTreeTokenType.COLUMN_GROUP_START;
165
+ }
153
166
  function hasParagraphInTable(paragraph, tables) {
154
167
  return tables.some((table) => paragraph.startIndex > table.startIndex && paragraph.startIndex < table.endIndex);
155
168
  }
@@ -200,7 +213,7 @@ function getCustomDecorationAtPosition(customDecorations, position) {
200
213
  }
201
214
 
202
215
  //#endregion
203
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
216
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
204
217
  function _typeof(o) {
205
218
  "@babel/helpers - typeof";
206
219
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -211,7 +224,7 @@ function _typeof(o) {
211
224
  }
212
225
 
213
226
  //#endregion
214
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
227
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
215
228
  function toPrimitive(t, r) {
216
229
  if ("object" != _typeof(t) || !t) return t;
217
230
  var e = t[Symbol.toPrimitive];
@@ -224,14 +237,14 @@ function toPrimitive(t, r) {
224
237
  }
225
238
 
226
239
  //#endregion
227
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
240
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
228
241
  function toPropertyKey(t) {
229
242
  var i = toPrimitive(t, "string");
230
243
  return "symbol" == _typeof(i) ? i : i + "";
231
244
  }
232
245
 
233
246
  //#endregion
234
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
247
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
235
248
  function _defineProperty(e, r, t) {
236
249
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
237
250
  value: t,
@@ -242,7 +255,7 @@ function _defineProperty(e, r, t) {
242
255
  }
243
256
 
244
257
  //#endregion
245
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
258
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
246
259
  function __decorateParam(paramIndex, decorator) {
247
260
  return function(target, key) {
248
261
  decorator(target, key, paramIndex);
@@ -250,7 +263,7 @@ function __decorateParam(paramIndex, decorator) {
250
263
  }
251
264
 
252
265
  //#endregion
253
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
266
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
254
267
  function __decorate(decorators, target, key, desc) {
255
268
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
256
269
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -375,7 +388,7 @@ let DocMenuStyleService = class DocMenuStyleService extends Disposable {
375
388
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
376
389
  if (docDataModel == null) return { ...DEFAULT_TEXT_STYLE };
377
390
  const unitId = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId();
378
- const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService);
391
+ const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService);
379
392
  const docViewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
380
393
  if (docViewModel == null) return { ...DEFAULT_TEXT_STYLE };
381
394
  if (docViewModel.getEditArea() === DocumentEditArea.BODY) return { ...DEFAULT_TEXT_STYLE };
@@ -523,11 +536,6 @@ const BreakLineCommand = {
523
536
  return Boolean(result);
524
537
  }
525
538
  };
526
- function isTopLevelStructuralGap(dataStream, offset) {
527
- const previousToken = dataStream[offset - 1];
528
- const nextToken = dataStream[offset];
529
- return previousToken === DataStreamTreeTokenType.BLOCK_END || previousToken === DataStreamTreeTokenType.TABLE_END || previousToken === DataStreamTreeTokenType.COLUMN_GROUP_END || nextToken === DataStreamTreeTokenType.BLOCK_START || nextToken === DataStreamTreeTokenType.TABLE_START || nextToken === DataStreamTreeTokenType.COLUMN_GROUP_START;
530
- }
531
539
 
532
540
  //#endregion
533
541
  //#region src/services/clipboard/doc-paste-mutation-adapter.service.ts
@@ -568,7 +576,7 @@ var DocClipboardPasteAdapterService = class {
568
576
  */
569
577
  function getCommandSkeleton(accessor, unitId) {
570
578
  var _renderManagerService;
571
- return (_renderManagerService = accessor.get(IRenderManagerService).getRenderById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService);
579
+ return (_renderManagerService = accessor.get(IRenderManagerService).getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService);
572
580
  }
573
581
 
574
582
  //#endregion
@@ -1081,8 +1089,8 @@ const InnerPasteCommand = {
1081
1089
  id: "doc.command.inner-paste",
1082
1090
  type: CommandType.COMMAND,
1083
1091
  handler: async (accessor, params) => {
1084
- var _docDataModel$getSelf, _body$tables, _body$customBlocks;
1085
- const { segmentId, textRanges, doc } = params;
1092
+ var _docDataModel$getSelf, _body$tables, _body$customBlocks, _body$blockRanges;
1093
+ const { customRangeMappings = [], segmentId, textRanges, doc } = params;
1086
1094
  const commandService = accessor.get(ICommandService);
1087
1095
  const undoRedoService = accessor.get(IUndoRedoService);
1088
1096
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
@@ -1115,6 +1123,7 @@ const InnerPasteCommand = {
1115
1123
  const resourceMutationGroups = [];
1116
1124
  const hasTable = !!((_body$tables = body.tables) === null || _body$tables === void 0 ? void 0 : _body$tables.length);
1117
1125
  const hasCustomBlock = !!((_body$customBlocks = body.customBlocks) === null || _body$customBlocks === void 0 ? void 0 : _body$customBlocks.length);
1126
+ const hasBlockRange = !!((_body$blockRanges = body.blockRanges) === null || _body$blockRanges === void 0 ? void 0 : _body$blockRanges.length);
1118
1127
  if (hasTable && segmentId) return false;
1119
1128
  if (hasTable && hasRangeInTable(selections)) return false;
1120
1129
  if (selections.length && (rectRanges === null || rectRanges === void 0 ? void 0 : rectRanges.length)) return false;
@@ -1124,6 +1133,21 @@ const InnerPasteCommand = {
1124
1133
  const { startOffset, endOffset, collapsed } = selection;
1125
1134
  const len = startOffset - memoryCursor.cursor;
1126
1135
  const cloneBody = Tools.deepClone(body);
1136
+ const blockRangeMappings = [];
1137
+ const customBlockMappings = [];
1138
+ const selectionCustomRangeMappings = customRangeMappings.map(({ sourceRange }) => ({
1139
+ sourceRange,
1140
+ targetRange: BuildTextUtils.customRange.copyCustomRange(sourceRange)
1141
+ }));
1142
+ if (selectionCustomRangeMappings.length > 0) cloneBody.customRanges = selectionCustomRangeMappings.map(({ targetRange }) => targetRange);
1143
+ if (hasBlockRange) cloneBody.blockRanges.forEach((targetBlockRange, index) => {
1144
+ const sourceBlockRange = body.blockRanges[index];
1145
+ targetBlockRange.blockId = generateRandomId(6);
1146
+ blockRangeMappings.push({
1147
+ sourceBlockRange,
1148
+ targetBlockRange
1149
+ });
1150
+ });
1127
1151
  if (hasTable) for (const t of cloneBody.tables) {
1128
1152
  const { tableId: oldTableId } = t;
1129
1153
  const tableId = generateRandomId(6);
@@ -1136,7 +1160,6 @@ const InnerPasteCommand = {
1136
1160
  if (hasCustomBlock && drawings) {
1137
1161
  var _docDataModel$getSnap, _docDataModel$getSnap2;
1138
1162
  const drawingLen = (_docDataModel$getSnap = (_docDataModel$getSnap2 = docDataModel.getSnapshot().drawingsOrder) === null || _docDataModel$getSnap2 === void 0 ? void 0 : _docDataModel$getSnap2.length) !== null && _docDataModel$getSnap !== void 0 ? _docDataModel$getSnap : 0;
1139
- const customBlockMappings = [];
1140
1163
  for (const block of cloneBody.customBlocks) {
1141
1164
  const { blockId } = block;
1142
1165
  const drawingId = generateRandomId(6);
@@ -1151,21 +1174,6 @@ const InnerPasteCommand = {
1151
1174
  targetDrawing: drawing
1152
1175
  });
1153
1176
  }
1154
- if (customBlockMappings.length > 0 && pasteAdapterService) {
1155
- const mutationInfos = pasteAdapterService.getPasteMutationInfos({
1156
- unitId,
1157
- segmentId,
1158
- doc,
1159
- sourceBody: body,
1160
- targetBody: cloneBody,
1161
- customBlockMappings
1162
- });
1163
- if (mutationInfos.redoMutations.length > 0 || mutationInfos.undoMutations.length > 0) {
1164
- resourceRedoMutations.push(...mutationInfos.redoMutations);
1165
- resourceUndoMutations.push(...mutationInfos.undoMutations);
1166
- resourceMutationGroups.push(mutationInfos);
1167
- }
1168
- }
1169
1177
  customBlockMappings.forEach(({ targetBlockId, targetDrawing }) => {
1170
1178
  const action = jsonX.insertOp(["drawings", targetBlockId], targetDrawing);
1171
1179
  const orderAction = jsonX.insertOp(["drawingsOrder", drawingLen], targetBlockId);
@@ -1173,6 +1181,23 @@ const InnerPasteCommand = {
1173
1181
  rawActions.push(orderAction);
1174
1182
  });
1175
1183
  }
1184
+ if ((blockRangeMappings.length > 0 || customBlockMappings.length > 0 || selectionCustomRangeMappings.length > 0) && pasteAdapterService) {
1185
+ const mutationInfos = pasteAdapterService.getPasteMutationInfos({
1186
+ unitId,
1187
+ segmentId,
1188
+ doc,
1189
+ sourceBody: body,
1190
+ targetBody: cloneBody,
1191
+ blockRangeMappings,
1192
+ customRangeMappings: selectionCustomRangeMappings,
1193
+ customBlockMappings
1194
+ });
1195
+ if (mutationInfos.redoMutations.length > 0 || mutationInfos.undoMutations.length > 0) {
1196
+ resourceRedoMutations.push(...mutationInfos.redoMutations);
1197
+ resourceUndoMutations.push(...mutationInfos.undoMutations);
1198
+ resourceMutationGroups.push(mutationInfos);
1199
+ }
1200
+ }
1176
1201
  const customRange = getCustomRangeAtPosition((_originBody$customRan = originBody.customRanges) !== null && _originBody$customRan !== void 0 ? _originBody$customRan : [], endOffset, UNITS.includes(unitId));
1177
1202
  const customDecorations = getCustomDecorationAtPosition((_originBody$customDec = originBody.customDecorations) !== null && _originBody$customDec !== void 0 ? _originBody$customDec : [], endOffset);
1178
1203
  if (customRange) cloneBody.customRanges = [{
@@ -3728,18 +3753,19 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3728
3753
  this._clipboardInterfaceService = _clipboardInterfaceService;
3729
3754
  this._docSelectionManagerService = _docSelectionManagerService;
3730
3755
  _defineProperty(this, "_clipboardHooks", []);
3756
+ _defineProperty(this, "_memoryClipboardData", null);
3731
3757
  _defineProperty(this, "_htmlToUDM", new HtmlToUDMService());
3732
3758
  _defineProperty(this, "_umdToHtml", void 0);
3733
3759
  this._umdToHtml = new UDMToHtmlService(docHtmlExportService);
3734
3760
  }
3735
3761
  async copy(sliceType = SliceBodyType.copy, ranges) {
3736
3762
  var _this$_getDocumentBod;
3737
- const { newSnapshotList = [], needCache = false, snapshot, ranges: allRanges } = (_this$_getDocumentBod = this._getDocumentBodyInRanges(sliceType, ranges)) !== null && _this$_getDocumentBod !== void 0 ? _this$_getDocumentBod : {};
3763
+ const { newSnapshotList = [], needCache = false, plainTextList, snapshot, ranges: allRanges } = (_this$_getDocumentBod = this._getDocumentBodyInRanges(sliceType, ranges)) !== null && _this$_getDocumentBod !== void 0 ? _this$_getDocumentBod : {};
3738
3764
  if (newSnapshotList.length === 0 || snapshot == null) return false;
3739
3765
  try {
3740
3766
  var _allRanges$;
3741
3767
  const isCopyInHeaderFooter = !!(allRanges === null || allRanges === void 0 || (_allRanges$ = allRanges[0]) === null || _allRanges$ === void 0 ? void 0 : _allRanges$.segmentId);
3742
- this._setClipboardData(newSnapshotList, !isCopyInHeaderFooter && needCache);
3768
+ await this._setClipboardData(newSnapshotList, !isCopyInHeaderFooter && needCache, plainTextList);
3743
3769
  } catch (e) {
3744
3770
  this._logService.error("[DocClipboardService] copy failed", e);
3745
3771
  return false;
@@ -3750,6 +3776,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3750
3776
  return this._cut(ranges);
3751
3777
  }
3752
3778
  async paste(items) {
3779
+ if (!(items === null || items === void 0 ? void 0 : items.length)) return this._memoryClipboardData ? this._paste(Tools.deepClone(this._memoryClipboardData)) : false;
3753
3780
  const partDocData = await this._genDocDataFromClipboardItems(items);
3754
3781
  return this._paste(partDocData);
3755
3782
  }
@@ -3807,15 +3834,25 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3807
3834
  }
3808
3835
  }
3809
3836
  async _paste(docData) {
3810
- var _this$_univerInstance, _body$customRanges, _body$paragraphs;
3837
+ var _body$customRanges$ma, _body$customRanges, _body$paragraphs, _currentDocument$getS;
3811
3838
  const { body: _body } = docData;
3812
3839
  if (_body == null) return false;
3813
3840
  let body = normalizeBody(_body);
3814
- if (!((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId())) return false;
3841
+ const currentDocument = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3842
+ if (!currentDocument) return false;
3815
3843
  this._clipboardHooks.forEach((hook) => {
3816
- if (hook.onBeforePaste) body = hook.onBeforePaste(body);
3844
+ if (hook.onBeforePaste) body = hook.onBeforePaste(body, {
3845
+ documentData: docData,
3846
+ targetUnitId: currentDocument.getUnitId()
3847
+ });
3817
3848
  });
3818
- body.customRanges = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.map(BuildTextUtils.customRange.copyCustomRange);
3849
+ const customRangeMappings = (_body$customRanges$ma = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.map((sourceRange) => {
3850
+ return {
3851
+ sourceRange,
3852
+ targetRange: BuildTextUtils.customRange.copyCustomRange(sourceRange)
3853
+ };
3854
+ })) !== null && _body$customRanges$ma !== void 0 ? _body$customRanges$ma : [];
3855
+ body.customRanges = customRangeMappings.map(({ targetRange }) => targetRange);
3819
3856
  (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 || _body$paragraphs.forEach((copy) => {
3820
3857
  var _copy$paragraphStyle;
3821
3858
  if ((_copy$paragraphStyle = copy.paragraphStyle) === null || _copy$paragraphStyle === void 0 ? void 0 : _copy$paragraphStyle.headingId) copy.paragraphStyle.headingId = generateRandomId(6);
@@ -3824,6 +3861,8 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3824
3861
  const ranges = this._docSelectionManagerService.getTextRanges();
3825
3862
  if (segmentId == null) this._logService.error("[DocClipboardController] segmentId does not exist!");
3826
3863
  if (activeEndOffset == null || ranges == null) return false;
3864
+ const originBody = segmentId == null ? null : (_currentDocument$getS = currentDocument.getSelfOrHeaderFooterModel(segmentId)) === null || _currentDocument$getS === void 0 ? void 0 : _currentDocument$getS.getBody();
3865
+ if (originBody) ensureParagraphAtStructuralGap(body, originBody, ranges);
3827
3866
  try {
3828
3867
  let cursor = activeEndOffset;
3829
3868
  for (const range of ranges) {
@@ -3841,6 +3880,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3841
3880
  ...docData,
3842
3881
  body
3843
3882
  },
3883
+ customRangeMappings,
3844
3884
  segmentId,
3845
3885
  textRanges
3846
3886
  });
@@ -3849,10 +3889,10 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3849
3889
  return false;
3850
3890
  }
3851
3891
  }
3852
- async _setClipboardData(documentList, needCache = true) {
3892
+ async _setClipboardData(documentList, needCache = true, plainTextList) {
3853
3893
  var _documentList$0$body;
3854
3894
  const copyId = generateRandomId(6);
3855
- const text = (documentList.length > 1 ? documentList.map((doc) => {
3895
+ const text = (plainTextList ? plainTextList.join("\n") : documentList.length > 1 ? documentList.map((doc) => {
3856
3896
  var _doc$body;
3857
3897
  return ((_doc$body = doc.body) === null || _doc$body === void 0 ? void 0 : _doc$body.dataStream) || "";
3858
3898
  }).join("\n") : ((_documentList$0$body = documentList[0].body) === null || _documentList$0$body === void 0 ? void 0 : _documentList$0$body.dataStream) || "").replaceAll(DataStreamTreeTokenType.TABLE_START, "").replaceAll(DataStreamTreeTokenType.TABLE_END, "").replaceAll(DataStreamTreeTokenType.TABLE_ROW_START, "").replaceAll(DataStreamTreeTokenType.TABLE_ROW_END, "").replaceAll(DataStreamTreeTokenType.TABLE_CELL_START, "").replaceAll(DataStreamTreeTokenType.TABLE_CELL_END, "").replaceAll(DataStreamTreeTokenType.BLOCK_START, "").replaceAll(DataStreamTreeTokenType.BLOCK_END, "").replaceAll("\r\n", " ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "");
@@ -3872,7 +3912,8 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3872
3912
  html = embedInternalClipboardFragment(html, internalJson);
3873
3913
  }
3874
3914
  html = wrapClipboardHtml(html);
3875
- return this._clipboardInterfaceService.write(text, html, internalJson ? { [DOC_INTERNAL_FRAGMENT_MIME]: internalJson } : void 0);
3915
+ await this._clipboardInterfaceService.write(text, html, internalJson ? { [DOC_INTERNAL_FRAGMENT_MIME]: internalJson } : void 0);
3916
+ this._memoryClipboardData = Tools.deepClone(internalDocData);
3876
3917
  }
3877
3918
  addClipboardHook(hook) {
3878
3919
  this._clipboardHooks.push(hook);
@@ -3888,10 +3929,12 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3888
3929
  }, doc);
3889
3930
  }
3890
3931
  _getDocumentBodyInRanges(sliceType, ranges) {
3891
- var _docDataModel$getSelf;
3932
+ var _this$_clipboardHooks, _docDataModel$getSelf;
3892
3933
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3893
3934
  const allRanges = ranges !== null && ranges !== void 0 ? ranges : this._docSelectionManagerService.getDocRanges();
3894
3935
  const results = [];
3936
+ const plainTextResults = [];
3937
+ const copyContentHook = (_this$_clipboardHooks = this._clipboardHooks.find((hook) => hook.onCopyContent)) === null || _this$_clipboardHooks === void 0 ? void 0 : _this$_clipboardHooks.onCopyContent;
3895
3938
  let needCache = true;
3896
3939
  if (docDataModel == null || allRanges.length === 0) return;
3897
3940
  const segmentId = allRanges[0].segmentId;
@@ -3899,13 +3942,14 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3899
3942
  const snapshot = docDataModel.getSnapshot();
3900
3943
  if (body == null) return;
3901
3944
  for (const range of allRanges) {
3902
- var _docDataModel$getSelf2;
3945
+ var _docDataModel$getSelf2, _copyContentHook;
3903
3946
  const { startOffset, endOffset, collapsed, rangeType } = range;
3904
3947
  if (collapsed || startOffset == null || endOffset == null) continue;
3905
3948
  if (rangeType === DOC_RANGE_TYPE.RECT) {
3906
3949
  needCache = false;
3907
3950
  const bodySlice = getTableClipboardBodySlice(body, range);
3908
3951
  results.push(bodySlice);
3952
+ plainTextResults.push(bodySlice.dataStream);
3909
3953
  continue;
3910
3954
  }
3911
3955
  const deleteRange = {
@@ -3916,6 +3960,11 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3916
3960
  const docBody = (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.sliceBody(deleteRange.startOffset, deleteRange.endOffset, sliceType);
3917
3961
  if (docBody == null) continue;
3918
3962
  results.push(docBody);
3963
+ plainTextResults.push((_copyContentHook = copyContentHook === null || copyContentHook === void 0 ? void 0 : copyContentHook(deleteRange.startOffset, deleteRange.endOffset, {
3964
+ body,
3965
+ segmentId,
3966
+ unitId: docDataModel.getUnitId()
3967
+ })) !== null && _copyContentHook !== void 0 ? _copyContentHook : docBody.dataStream);
3919
3968
  }
3920
3969
  return {
3921
3970
  newSnapshotList: results.map((e) => ({
@@ -3923,6 +3972,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3923
3972
  body: e
3924
3973
  })),
3925
3974
  needCache,
3975
+ plainTextList: plainTextResults,
3926
3976
  snapshot,
3927
3977
  ranges: allRanges
3928
3978
  };
@@ -3981,16 +4031,17 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3981
4031
  return doc;
3982
4032
  }
3983
4033
  async _uploadBase64ImagesInHtml(html) {
3984
- var _this$_clipboardHooks;
4034
+ var _this$_clipboardHooks2;
3985
4035
  if (!html || !html.includes("data:image/")) return html;
3986
- const onBeforePasteImage = (_this$_clipboardHooks = this._clipboardHooks.find((e) => e.onBeforePasteImage)) === null || _this$_clipboardHooks === void 0 ? void 0 : _this$_clipboardHooks.onBeforePasteImage;
4036
+ const onBeforePasteImage = (_this$_clipboardHooks2 = this._clipboardHooks.find((e) => e.onBeforePasteImage)) === null || _this$_clipboardHooks2 === void 0 ? void 0 : _this$_clipboardHooks2.onBeforePasteImage;
3987
4037
  if (!onBeforePasteImage) return html;
3988
4038
  const doc = new DOMParser().parseFromString(html, "text/html");
3989
4039
  const images = Array.from(doc.querySelectorAll("img[src^=\"data:image/\"]"));
3990
4040
  if (images.length === 0) return html;
3991
4041
  await Promise.all(images.map(async (image, index) => {
3992
4042
  if (image.dataset.imageSourceType && image.dataset.imageSourceType !== ImageSourceType.BASE64) return;
3993
- const uploaded = await onBeforePasteImage(dataUrlToFile(image.getAttribute("src") || image.src, `pasted_image_${index}`));
4043
+ const file = dataUrlToFile(image.getAttribute("src") || image.src, `pasted_image_${index}`);
4044
+ const uploaded = await onBeforePasteImage(file);
3994
4045
  if (!uploaded) return;
3995
4046
  image.dataset.imageSourceType = uploaded.imageSourceType;
3996
4047
  if (uploaded.imageSourceType === ImageSourceType.UUID) {
@@ -4004,7 +4055,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
4004
4055
  return doc.documentElement.outerHTML;
4005
4056
  }
4006
4057
  async _createImagePasteHtml(files) {
4007
- var _this$_clipboardHooks2, _this$_clipboardHooks3;
4058
+ var _this$_clipboardHooks3, _this$_clipboardHooks4;
4008
4059
  const doc = {
4009
4060
  id: "",
4010
4061
  documentStyle: {},
@@ -4040,7 +4091,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
4040
4091
  };
4041
4092
  });
4042
4093
  };
4043
- const onBeforePasteImage = (_this$_clipboardHooks2 = (_this$_clipboardHooks3 = this._clipboardHooks.find((e) => e.onBeforePasteImage)) === null || _this$_clipboardHooks3 === void 0 ? void 0 : _this$_clipboardHooks3.onBeforePasteImage) !== null && _this$_clipboardHooks2 !== void 0 ? _this$_clipboardHooks2 : fileToBase64;
4094
+ const onBeforePasteImage = (_this$_clipboardHooks3 = (_this$_clipboardHooks4 = this._clipboardHooks.find((e) => e.onBeforePasteImage)) === null || _this$_clipboardHooks4 === void 0 ? void 0 : _this$_clipboardHooks4.onBeforePasteImage) !== null && _this$_clipboardHooks3 !== void 0 ? _this$_clipboardHooks3 : fileToBase64;
4044
4095
  await Promise.all(files.map(async (file, index) => {
4045
4096
  var _body$customBlocks;
4046
4097
  const image = await onBeforePasteImage(file);
@@ -4097,6 +4148,21 @@ DocClipboardService = __decorate([
4097
4148
  __decorateParam(4, Inject(DocHtmlExportService)),
4098
4149
  __decorateParam(5, Inject(DocSelectionManagerService))
4099
4150
  ], DocClipboardService);
4151
+ function endsAtDocumentBoundary(dataStream) {
4152
+ const lastToken = dataStream[dataStream.length - 1];
4153
+ return lastToken === DataStreamTreeTokenType.PARAGRAPH || lastToken === DataStreamTreeTokenType.SECTION_BREAK || lastToken === DataStreamTreeTokenType.BLOCK_END || lastToken === DataStreamTreeTokenType.TABLE_END || lastToken === DataStreamTreeTokenType.COLUMN_GROUP_END;
4154
+ }
4155
+ function ensureParagraphAtStructuralGap(body, originBody, ranges) {
4156
+ var _body$paragraphs$map, _body$paragraphs2, _body$paragraphs3;
4157
+ if (endsAtDocumentBoundary(body.dataStream) || !ranges.every((range) => range.collapsed && isTopLevelStructuralGap(originBody.dataStream, range.startOffset))) return;
4158
+ const paragraphIndex = body.dataStream.length;
4159
+ const paragraphIds = new Set((_body$paragraphs$map = (_body$paragraphs2 = body.paragraphs) === null || _body$paragraphs2 === void 0 ? void 0 : _body$paragraphs2.map((paragraph) => paragraph.paragraphId)) !== null && _body$paragraphs$map !== void 0 ? _body$paragraphs$map : []);
4160
+ body.dataStream += DataStreamTreeTokenType.PARAGRAPH;
4161
+ body.paragraphs = [...(_body$paragraphs3 = body.paragraphs) !== null && _body$paragraphs3 !== void 0 ? _body$paragraphs3 : [], {
4162
+ startIndex: paragraphIndex,
4163
+ paragraphId: createParagraphId(paragraphIds)
4164
+ }];
4165
+ }
4100
4166
  function dataUrlToFile(dataUrl, fallbackName) {
4101
4167
  const match = /^data:([^;,]+)(;base64)?,(.*)$/i.exec(dataUrl);
4102
4168
  if (!match) throw new Error("[DocClipboardService] invalid image data url.");
@@ -4172,8 +4238,8 @@ const DocPasteCommand = {
4172
4238
  preconditions: whenDocOrEditor,
4173
4239
  handler: async (accessor) => {
4174
4240
  const docClipboardService = accessor.get(IDocClipboardService);
4175
- const clipboardItems = await accessor.get(IClipboardInterfaceService).read();
4176
- if (clipboardItems.length === 0) return false;
4241
+ const clipboardInterfaceService = accessor.get(IClipboardInterfaceService);
4242
+ const clipboardItems = clipboardInterfaceService.supportClipboard ? await clipboardInterfaceService.read() : [];
4177
4243
  return docClipboardService.paste(clipboardItems);
4178
4244
  }
4179
4245
  };
@@ -4769,7 +4835,7 @@ const IMEInputCommand = {
4769
4835
  const renderManagerService = accessor.get(IRenderManagerService);
4770
4836
  const univerInstanceService = accessor.get(IUniverInstanceService);
4771
4837
  const docMenuStyleService = accessor.get(DocMenuStyleService);
4772
- const imeInputManagerService = (_renderManagerService = renderManagerService.getRenderById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocIMEInputManagerService);
4838
+ const imeInputManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocIMEInputManagerService);
4773
4839
  const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
4774
4840
  if (docDataModel == null || imeInputManagerService == null) return false;
4775
4841
  const previousActiveRange = imeInputManagerService.getActiveRange();
@@ -4862,7 +4928,8 @@ const SetInlineFormatBoldCommand = {
4862
4928
  id: SetInlineFormatBoldCommandId,
4863
4929
  type: CommandType.COMMAND,
4864
4930
  handler: async (accessor, params) => {
4865
- return handleInlineFormat(SetInlineFormatBoldCommandId, params, accessor.get(ICommandService));
4931
+ const commandService = accessor.get(ICommandService);
4932
+ return handleInlineFormat(SetInlineFormatBoldCommandId, params, commandService);
4866
4933
  }
4867
4934
  };
4868
4935
  const SetInlineFormatItalicCommandId = "doc.command.set-inline-format-italic";
@@ -4870,7 +4937,8 @@ const SetInlineFormatItalicCommand = {
4870
4937
  id: SetInlineFormatItalicCommandId,
4871
4938
  type: CommandType.COMMAND,
4872
4939
  handler: async (accessor, params) => {
4873
- return handleInlineFormat(SetInlineFormatItalicCommandId, params, accessor.get(ICommandService));
4940
+ const commandService = accessor.get(ICommandService);
4941
+ return handleInlineFormat(SetInlineFormatItalicCommandId, params, commandService);
4874
4942
  }
4875
4943
  };
4876
4944
  const SetInlineFormatUnderlineCommandId = "doc.command.set-inline-format-underline";
@@ -4878,7 +4946,8 @@ const SetInlineFormatUnderlineCommand = {
4878
4946
  id: SetInlineFormatUnderlineCommandId,
4879
4947
  type: CommandType.COMMAND,
4880
4948
  handler: async (accessor, params) => {
4881
- return handleInlineFormat(SetInlineFormatUnderlineCommandId, params, accessor.get(ICommandService));
4949
+ const commandService = accessor.get(ICommandService);
4950
+ return handleInlineFormat(SetInlineFormatUnderlineCommandId, params, commandService);
4882
4951
  }
4883
4952
  };
4884
4953
  const SetInlineFormatStrikethroughCommandId = "doc.command.set-inline-format-strikethrough";
@@ -4886,7 +4955,8 @@ const SetInlineFormatStrikethroughCommand = {
4886
4955
  id: SetInlineFormatStrikethroughCommandId,
4887
4956
  type: CommandType.COMMAND,
4888
4957
  handler: async (accessor, params) => {
4889
- return handleInlineFormat(SetInlineFormatStrikethroughCommandId, params, accessor.get(ICommandService));
4958
+ const commandService = accessor.get(ICommandService);
4959
+ return handleInlineFormat(SetInlineFormatStrikethroughCommandId, params, commandService);
4890
4960
  }
4891
4961
  };
4892
4962
  const SetInlineFormatSubscriptCommandId = "doc.command.set-inline-format-subscript";
@@ -4894,7 +4964,8 @@ const SetInlineFormatSubscriptCommand = {
4894
4964
  id: SetInlineFormatSubscriptCommandId,
4895
4965
  type: CommandType.COMMAND,
4896
4966
  handler: async (accessor, params) => {
4897
- return handleInlineFormat(SetInlineFormatSubscriptCommandId, params, accessor.get(ICommandService));
4967
+ const commandService = accessor.get(ICommandService);
4968
+ return handleInlineFormat(SetInlineFormatSubscriptCommandId, params, commandService);
4898
4969
  }
4899
4970
  };
4900
4971
  const SetInlineFormatSuperscriptCommandId = "doc.command.set-inline-format-superscript";
@@ -4902,7 +4973,8 @@ const SetInlineFormatSuperscriptCommand = {
4902
4973
  id: SetInlineFormatSuperscriptCommandId,
4903
4974
  type: CommandType.COMMAND,
4904
4975
  handler: async (accessor, params) => {
4905
- return handleInlineFormat(SetInlineFormatSuperscriptCommandId, params, accessor.get(ICommandService));
4976
+ const commandService = accessor.get(ICommandService);
4977
+ return handleInlineFormat(SetInlineFormatSuperscriptCommandId, params, commandService);
4906
4978
  }
4907
4979
  };
4908
4980
  const SetInlineFormatFontSizeCommandId = "doc.command.set-inline-format-fontsize";
@@ -4910,7 +4982,8 @@ const SetInlineFormatFontSizeCommand = {
4910
4982
  id: SetInlineFormatFontSizeCommandId,
4911
4983
  type: CommandType.COMMAND,
4912
4984
  handler: async (accessor, params) => {
4913
- return handleInlineFormat(SetInlineFormatFontSizeCommandId, params, accessor.get(ICommandService));
4985
+ const commandService = accessor.get(ICommandService);
4986
+ return handleInlineFormat(SetInlineFormatFontSizeCommandId, params, commandService);
4914
4987
  }
4915
4988
  };
4916
4989
  const SetInlineFormatFontFamilyCommandId = "doc.command.set-inline-format-font-family";
@@ -4918,7 +4991,8 @@ const SetInlineFormatFontFamilyCommand = {
4918
4991
  id: SetInlineFormatFontFamilyCommandId,
4919
4992
  type: CommandType.COMMAND,
4920
4993
  handler: async (accessor, params) => {
4921
- return handleInlineFormat(SetInlineFormatFontFamilyCommandId, params, accessor.get(ICommandService));
4994
+ const commandService = accessor.get(ICommandService);
4995
+ return handleInlineFormat(SetInlineFormatFontFamilyCommandId, params, commandService);
4922
4996
  }
4923
4997
  };
4924
4998
  const SetInlineFormatTextColorCommandId = "doc.command.set-inline-format-text-color";
@@ -4926,7 +5000,8 @@ const SetInlineFormatTextColorCommand = {
4926
5000
  id: SetInlineFormatTextColorCommandId,
4927
5001
  type: CommandType.COMMAND,
4928
5002
  handler: async (accessor, params) => {
4929
- return handleInlineFormat(SetInlineFormatTextColorCommandId, params, accessor.get(ICommandService));
5003
+ const commandService = accessor.get(ICommandService);
5004
+ return handleInlineFormat(SetInlineFormatTextColorCommandId, params, commandService);
4930
5005
  }
4931
5006
  };
4932
5007
  const ResetInlineFormatTextColorCommandId = "doc.command.reset-inline-format-text-color";
@@ -4934,7 +5009,8 @@ const ResetInlineFormatTextColorCommand = {
4934
5009
  id: ResetInlineFormatTextColorCommandId,
4935
5010
  type: CommandType.COMMAND,
4936
5011
  handler: async (accessor, params) => {
4937
- return handleInlineFormat(ResetInlineFormatTextColorCommandId, params, accessor.get(ICommandService));
5012
+ const commandService = accessor.get(ICommandService);
5013
+ return handleInlineFormat(ResetInlineFormatTextColorCommandId, params, commandService);
4938
5014
  }
4939
5015
  };
4940
5016
  const SetInlineFormatTextFillCommandId = "doc.command.set-inline-format-text-fill";
@@ -4942,7 +5018,8 @@ const SetInlineFormatTextFillCommand = {
4942
5018
  id: SetInlineFormatTextFillCommandId,
4943
5019
  type: CommandType.COMMAND,
4944
5020
  handler: async (accessor, params) => {
4945
- return handleInlineFormat(SetInlineFormatTextFillCommandId, params, accessor.get(ICommandService));
5021
+ const commandService = accessor.get(ICommandService);
5022
+ return handleInlineFormat(SetInlineFormatTextFillCommandId, params, commandService);
4946
5023
  }
4947
5024
  };
4948
5025
  const SetInlineFormatTextBackgroundColorCommandId = "doc.command.set-inline-format-text-background-color";
@@ -4950,7 +5027,8 @@ const SetInlineFormatTextBackgroundColorCommand = {
4950
5027
  id: SetInlineFormatTextBackgroundColorCommandId,
4951
5028
  type: CommandType.COMMAND,
4952
5029
  handler: async (accessor, params) => {
4953
- return handleInlineFormat(SetInlineFormatTextBackgroundColorCommandId, params, accessor.get(ICommandService));
5030
+ const commandService = accessor.get(ICommandService);
5031
+ return handleInlineFormat(SetInlineFormatTextBackgroundColorCommandId, params, commandService);
4954
5032
  }
4955
5033
  };
4956
5034
  const ResetInlineFormatTextBackgroundColorCommandId = "doc.command.reset-inline-format-text-background-color";
@@ -4958,7 +5036,8 @@ const ResetInlineFormatTextBackgroundColorCommand = {
4958
5036
  id: ResetInlineFormatTextBackgroundColorCommandId,
4959
5037
  type: CommandType.COMMAND,
4960
5038
  handler: async (accessor, params) => {
4961
- return handleInlineFormat(ResetInlineFormatTextBackgroundColorCommandId, params, accessor.get(ICommandService));
5039
+ const commandService = accessor.get(ICommandService);
5040
+ return handleInlineFormat(ResetInlineFormatTextBackgroundColorCommandId, params, commandService);
4962
5041
  }
4963
5042
  };
4964
5043
  const COMMAND_ID_TO_FORMAT_KEY_MAP = {
@@ -5256,35 +5335,6 @@ function collectTopLevelReplaceAction(jsonX, rawActions, path, previousValue, va
5256
5335
  const action = jsonX.replaceOp(path, previousValue, value);
5257
5336
  if (action != null) rawActions.push(action);
5258
5337
  }
5259
- /**
5260
- * @deprecated please use ReplaceSnapshotCommand instead.
5261
- */
5262
- const ReplaceContentCommand = {
5263
- id: "doc.command-replace-content",
5264
- type: CommandType.COMMAND,
5265
- handler: async (accessor, params) => {
5266
- var _docDataModel$getSelf2;
5267
- const { unitId, body, textRanges, segmentId = "", options } = params;
5268
- const univerInstanceService = accessor.get(IUniverInstanceService);
5269
- const commandService = accessor.get(ICommandService);
5270
- const docSelectionManagerService = accessor.get(DocSelectionManagerService);
5271
- const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
5272
- const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.getBody();
5273
- if (docDataModel == null || prevBody == null) return false;
5274
- const doMutation = getMutationParams(unitId, segmentId, docDataModel, prevBody, body);
5275
- doMutation.params.textRanges = textRanges;
5276
- if (options) doMutation.params.options = options;
5277
- if (doMutation.params.actions == null && textRanges) {
5278
- docSelectionManagerService.replaceDocRanges(textRanges, {
5279
- unitId,
5280
- subUnitId: unitId
5281
- }, false);
5282
- return true;
5283
- }
5284
- const result = commandService.syncExecuteCommand(doMutation.id, doMutation.params);
5285
- return Boolean(result);
5286
- }
5287
- };
5288
5338
  const CoverContentCommand = {
5289
5339
  id: "doc.command-cover-content",
5290
5340
  type: CommandType.COMMAND,
@@ -5368,13 +5418,13 @@ const ReplaceTextRunsCommand = {
5368
5418
  id: "doc.command.replace-text-runs",
5369
5419
  type: CommandType.COMMAND,
5370
5420
  handler: (accessor, params) => {
5371
- var _docDataModel$getSelf3;
5421
+ var _docDataModel$getSelf2;
5372
5422
  const { unitId, body, textRanges, segmentId = "", options } = params;
5373
5423
  const univerInstanceService = accessor.get(IUniverInstanceService);
5374
5424
  const commandService = accessor.get(ICommandService);
5375
5425
  const themeService = accessor.get(ThemeService);
5376
5426
  const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
5377
- const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf3 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf3 === void 0 ? void 0 : _docDataModel$getSelf3.getBody();
5427
+ const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.getBody();
5378
5428
  if (docDataModel == null || prevBody == null) return false;
5379
5429
  const textX = BuildTextUtils.selection.replaceTextRuns({
5380
5430
  doc: docDataModel,
@@ -6050,10 +6100,10 @@ function insertNamedStyleParagraph(accessor, doc, namedStyleType, startOffset, e
6050
6100
  segmentId,
6051
6101
  unitId: doc.getUnitId()
6052
6102
  }));
6053
- if (success) accessor.get(DocSelectionManagerService).replaceTextRanges([{
6103
+ if (success) accessor.get(DocSelectionManagerService).replaceDocRanges([{
6054
6104
  startOffset,
6055
6105
  endOffset: startOffset
6056
- }], false);
6106
+ }], void 0, false);
6057
6107
  return success;
6058
6108
  }
6059
6109
  const QuickHeadingCommand = {
@@ -6415,7 +6465,7 @@ var NodePositionConvertToCursor = class {
6415
6465
  const rawAnchorGlyph = isStartBack ? preGlyph !== null && preGlyph !== void 0 ? preGlyph : firstGlyph : firstGlyph;
6416
6466
  const anchorGlyph = this._getCaretGlyph(rawAnchorGlyph, glyphGroup, start_sp);
6417
6467
  const selectedGlyphs = glyphGroup.slice(start_sp, end_sp + 1);
6418
- const isSelectionOnlyNonInlineEmbedBlock = !collapsed && selectedGlyphs.length > 0 && selectedGlyphs.every((glyph) => this._isNonInlineEmbedCustomBlockGlyph(glyph));
6468
+ const isSelectionOnlyNonInlineDrawing = !collapsed && selectedGlyphs.length > 0 && selectedGlyphs.every((glyph) => this._isNonInlineDrawingGlyph(glyph));
6419
6469
  const borderBoxStartY = startY;
6420
6470
  const borderBoxEndY = contentHeight == null ? startY + lineHeight - marginTop - marginBottom : startY + paddingTop + contentHeight + paddingBottom;
6421
6471
  if (start_sp === 0 && end_sp === glyphGroup.length - 1) {
@@ -6448,8 +6498,8 @@ var NodePositionConvertToCursor = class {
6448
6498
  }
6449
6499
  const clippedBorderBoxPosition = clipPositionToHorizontalRange(borderBoxPosition, this._horizontalClip);
6450
6500
  const clippedContentBoxPosition = clipPositionToHorizontalRange(contentBoxPosition, this._horizontalClip);
6451
- if (clippedBorderBoxPosition && !isSelectionOnlyNonInlineEmbedBlock) borderBoxPointGroup.push(pushToPoints(clippedBorderBoxPosition));
6452
- if (clippedContentBoxPosition && !isSelectionOnlyNonInlineEmbedBlock) contentBoxPointGroup.push(pushToPoints(clippedContentBoxPosition));
6501
+ if (clippedBorderBoxPosition && !isSelectionOnlyNonInlineDrawing) borderBoxPointGroup.push(pushToPoints(clippedBorderBoxPosition));
6502
+ if (clippedContentBoxPosition && !isSelectionOnlyNonInlineDrawing) contentBoxPointGroup.push(pushToPoints(clippedContentBoxPosition));
6453
6503
  cursorList.push({
6454
6504
  startOffset: isStartBack ? startOffset : startOffset + firstGlyph.count,
6455
6505
  endOffset: isEndBack ? endOffset : endOffset + lastGlyph.count,
@@ -6464,7 +6514,7 @@ var NodePositionConvertToCursor = class {
6464
6514
  }
6465
6515
  _getCaretGlyph(glyph, glyphGroup, glyphIndex) {
6466
6516
  var _this$_findTextLikeGl;
6467
- if (!glyph || !this._isNonInlineEmbedCustomBlockGlyph(glyph)) return glyph;
6517
+ if (!glyph || !this._isNonInlineDrawingGlyph(glyph)) return glyph;
6468
6518
  const neighbor = (_this$_findTextLikeGl = this._findTextLikeGlyph(glyphGroup, glyphIndex - 1, -1)) !== null && _this$_findTextLikeGl !== void 0 ? _this$_findTextLikeGl : this._findTextLikeGlyph(glyphGroup, glyphIndex + 1, 1);
6469
6519
  return neighbor !== null && neighbor !== void 0 ? neighbor : {
6470
6520
  ...glyph,
@@ -6474,13 +6524,14 @@ var NodePositionConvertToCursor = class {
6474
6524
  _findTextLikeGlyph(glyphGroup, startIndex, step) {
6475
6525
  for (let index = startIndex; index >= 0 && index < glyphGroup.length; index += step) {
6476
6526
  const glyph = glyphGroup[index];
6477
- if (!this._isNonInlineEmbedCustomBlockGlyph(glyph)) return glyph;
6527
+ if (!this._isNonInlineDrawingGlyph(glyph)) return glyph;
6478
6528
  }
6479
6529
  }
6480
- _isNonInlineEmbedCustomBlockGlyph(glyph) {
6530
+ _isNonInlineDrawingGlyph(glyph) {
6481
6531
  var _this$_docSkeleton$ge, _this$_docSkeleton, _this$_docSkeleton$ge2, _this$_docSkeleton$ge3, _this$_docSkeleton$ge4, _this$_docSkeleton$ge5;
6482
6532
  if (!(glyph === null || glyph === void 0 ? void 0 : glyph.drawingId) || glyph.streamType !== DataStreamTreeTokenType.CUSTOM_BLOCK) return false;
6483
- return !shouldUseInlineTextSelectionForDocsCustomBlockDrawing((_this$_docSkeleton$ge = (_this$_docSkeleton = this._docSkeleton).getViewModel) === null || _this$_docSkeleton$ge === void 0 || (_this$_docSkeleton$ge3 = (_this$_docSkeleton$ge2 = _this$_docSkeleton$ge.call(_this$_docSkeleton)).getDataModel) === null || _this$_docSkeleton$ge3 === void 0 || (_this$_docSkeleton$ge5 = (_this$_docSkeleton$ge4 = _this$_docSkeleton$ge3.call(_this$_docSkeleton$ge2)).getSnapshot) === null || _this$_docSkeleton$ge5 === void 0 || (_this$_docSkeleton$ge5 = _this$_docSkeleton$ge5.call(_this$_docSkeleton$ge4).drawings) === null || _this$_docSkeleton$ge5 === void 0 ? void 0 : _this$_docSkeleton$ge5[glyph.drawingId]);
6533
+ const drawing = (_this$_docSkeleton$ge = (_this$_docSkeleton = this._docSkeleton).getViewModel) === null || _this$_docSkeleton$ge === void 0 || (_this$_docSkeleton$ge3 = (_this$_docSkeleton$ge2 = _this$_docSkeleton$ge.call(_this$_docSkeleton)).getDataModel) === null || _this$_docSkeleton$ge3 === void 0 || (_this$_docSkeleton$ge5 = (_this$_docSkeleton$ge4 = _this$_docSkeleton$ge3.call(_this$_docSkeleton$ge2)).getSnapshot) === null || _this$_docSkeleton$ge5 === void 0 || (_this$_docSkeleton$ge5 = _this$_docSkeleton$ge5.call(_this$_docSkeleton$ge4).drawings) === null || _this$_docSkeleton$ge5 === void 0 ? void 0 : _this$_docSkeleton$ge5[glyph.drawingId];
6534
+ return (drawing === null || drawing === void 0 ? void 0 : drawing.layoutType) == null ? !shouldUseInlineTextSelectionForDocsCustomBlockDrawing(drawing) : drawing.layoutType !== PositionedObjectLayoutType.INLINE;
6484
6535
  }
6485
6536
  _isValidPosition(startOrigin, endOrigin) {
6486
6537
  const { segmentPage: startPage, pageType: startPageType } = startOrigin;
@@ -7168,6 +7219,12 @@ const TEXT_ANCHOR_KEY_PREFIX = "__TestSelectionAnchor__";
7168
7219
  const ID_LENGTH$1 = 6;
7169
7220
  const BLINK_ON = 500;
7170
7221
  const TEXT_RANGE_LAYER_INDEX = 3;
7222
+ function cursorConvertToTextRange(scene, range, docSkeleton, document) {
7223
+ const { startOffset, endOffset, style = NORMAL_TEXT_SELECTION_PLUGIN_STYLE, segmentId = "", segmentPage } = range;
7224
+ const anchorNodePosition = docSkeleton.findNodePositionByCharIndex(startOffset, true, segmentId, segmentPage);
7225
+ const focusNodePosition = startOffset !== endOffset ? docSkeleton.findNodePositionByCharIndex(endOffset, true, segmentId, segmentPage) : null;
7226
+ return new TextRange(scene, document, docSkeleton, anchorNodePosition, focusNodePosition, style, segmentId, segmentPage);
7227
+ }
7171
7228
  function getAnchorBounding(pointsGroup) {
7172
7229
  const points = pointsGroup[0];
7173
7230
  const startPoint = points[0];
@@ -7922,7 +7979,7 @@ function getParagraphInfoByGlyph(node) {
7922
7979
  };
7923
7980
  }
7924
7981
  function serializeTextRange(textRange) {
7925
- const { startOffset, endOffset, collapsed, rangeType, startNodePosition, endNodePosition, direction, segmentId, segmentPage } = textRange;
7982
+ const { startOffset, endOffset, collapsed, rangeType, startNodePosition, endNodePosition, direction, segmentId, segmentPage, style } = textRange;
7926
7983
  return {
7927
7984
  startOffset,
7928
7985
  endOffset,
@@ -7933,6 +7990,7 @@ function serializeTextRange(textRange) {
7933
7990
  direction,
7934
7991
  segmentId,
7935
7992
  segmentPage,
7993
+ style,
7936
7994
  isActive: textRange.isActive()
7937
7995
  };
7938
7996
  }
@@ -8122,27 +8180,37 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8122
8180
  const { scene, mainComponent } = this._context;
8123
8181
  const document = mainComponent;
8124
8182
  const docSkeleton = this._docSkeletonManagerService.getSkeleton();
8125
- const generalAddRange = (startOffset, endOffset) => {
8126
- const rangeList = getRangeListFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, style, segmentId, segmentPage);
8183
+ const generalAddRange = (startOffset, endOffset, rangeStyle) => {
8184
+ const rangeList = getRangeListFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
8127
8185
  if (rangeList == null) return;
8128
8186
  const { textRanges, rectRanges } = rangeList;
8129
8187
  for (const textRange of textRanges) this._addTextRange(textRange);
8130
8188
  this._addRectRanges(rectRanges);
8131
8189
  };
8132
8190
  for (const range of ranges) {
8191
+ var _range$style;
8133
8192
  const { startOffset, endOffset, rangeType, startNodePosition, endNodePosition } = range;
8134
- if (rangeType === DOC_RANGE_TYPE.RECT) {
8135
- const rectRange = getRectRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, style, segmentId, segmentPage);
8193
+ const rangeStyle = (_range$style = range.style) !== null && _range$style !== void 0 ? _range$style : style;
8194
+ if (rangeType !== DOC_RANGE_TYPE.RECT && startOffset === endOffset) {
8195
+ const textRange = cursorConvertToTextRange(scene, {
8196
+ ...range,
8197
+ segmentId,
8198
+ segmentPage,
8199
+ style: rangeStyle
8200
+ }, docSkeleton, document);
8201
+ if (textRange) this._addTextRange(textRange);
8202
+ } else if (rangeType === DOC_RANGE_TYPE.RECT) {
8203
+ const rectRange = getRectRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
8136
8204
  if (rectRange) this._addRectRanges([rectRange]);
8137
8205
  } else if (rangeType === DOC_RANGE_TYPE.TEXT) try {
8138
8206
  let textRange = null;
8139
- if (startNodePosition && endNodePosition) textRange = getTextRangeFromCharIndex(startNodePosition.isBack ? startOffset : startOffset - 1, endNodePosition.isBack ? endOffset : endOffset - 1, scene, document, docSkeleton, style, segmentId, segmentPage, startNodePosition.isBack, endNodePosition.isBack);
8140
- else textRange = getTextRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, style, segmentId, segmentPage);
8207
+ if (startNodePosition && endNodePosition) textRange = getTextRangeFromCharIndex(startNodePosition.isBack ? startOffset : startOffset - 1, endNodePosition.isBack ? endOffset : endOffset - 1, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage, startNodePosition.isBack, endNodePosition.isBack);
8208
+ else textRange = getTextRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
8141
8209
  if (textRange) this._addTextRange(textRange);
8142
8210
  } catch (_e) {
8143
- generalAddRange(startOffset, endOffset);
8211
+ generalAddRange(startOffset, endOffset, rangeStyle);
8144
8212
  }
8145
- else generalAddRange(startOffset, endOffset);
8213
+ else generalAddRange(startOffset, endOffset, rangeStyle);
8146
8214
  }
8147
8215
  this._textSelectionInner$.next({
8148
8216
  textRanges: this._getAllTextRanges(),
@@ -8181,8 +8249,16 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8181
8249
  sync() {
8182
8250
  this._updateInputPosition();
8183
8251
  }
8252
+ setInputPosition(x, y) {
8253
+ this._positionInput(x, y);
8254
+ }
8184
8255
  activate(x, y, force = false) {
8256
+ this._positionInput(x, y);
8257
+ if (force && !this._shouldPreserveExternalFocus() || !force && this.canFocusing) this.focus();
8258
+ }
8259
+ _positionInput(x, y) {
8185
8260
  this._ensureHostContainer();
8261
+ this._container.style.position = "fixed";
8186
8262
  let left = x;
8187
8263
  let top = y;
8188
8264
  const fixedContainer = this._container.offsetParent;
@@ -8194,7 +8270,6 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8194
8270
  this._container.style.left = `${left}px`;
8195
8271
  this._container.style.top = `${top}px`;
8196
8272
  this._container.style.zIndex = "1000";
8197
- if (force && !this._shouldPreserveExternalFocus() || !force && this.canFocusing) this.focus();
8198
8273
  }
8199
8274
  hasFocus() {
8200
8275
  return this._getOwnerDocument().activeElement === this._input;
@@ -8206,9 +8281,6 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8206
8281
  blur() {
8207
8282
  this._input.blur();
8208
8283
  }
8209
- /**
8210
- * @deprecated
8211
- */
8212
8284
  deactivate() {
8213
8285
  this._container.style.left = "0px";
8214
8286
  this._container.style.top = "0px";
@@ -8665,7 +8737,7 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8665
8737
  const scrollStop = viewport.onScrollEnd$.subscribeEvent((param) => {
8666
8738
  const viewport = param.viewport;
8667
8739
  if (!viewport) return;
8668
- const bounds = viewport.getBounding();
8740
+ const bounds = viewport.calcViewportInfo();
8669
8741
  const activeRangeInstance = this._getActiveRangeInstance();
8670
8742
  const anchor = activeRangeInstance === null || activeRangeInstance === void 0 ? void 0 : activeRangeInstance.getAnchor();
8671
8743
  if (!anchor || anchor && !anchor.visible) return;
@@ -8876,8 +8948,8 @@ const SwitchDocModeCommand = {
8876
8948
  const docDataModel = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
8877
8949
  if (docDataModel == null) return false;
8878
8950
  const unitId = docDataModel.getUnitId();
8879
- const skeleton = (_renderManagerService = renderManagerService.getRenderById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService).getSkeleton();
8880
- const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
8951
+ const skeleton = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService).getSkeleton();
8952
+ const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
8881
8953
  if (skeleton == null || docSelectionRenderService == null) return false;
8882
8954
  const segmentId = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegment();
8883
8955
  const segmentPage = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegmentPage();
@@ -9239,13 +9311,14 @@ const DocTableDeleteColumnsCommand = {
9239
9311
  const DocTableDeleteTableCommand = {
9240
9312
  id: "doc.table.delete-table",
9241
9313
  type: CommandType.COMMAND,
9242
- handler: async (accessor) => {
9243
- var _docDataModel$getSelf3;
9314
+ handler: async (accessor, params) => {
9315
+ var _params$targetRange, _docDataModel$getSelf3;
9244
9316
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
9245
9317
  const univerInstanceService = accessor.get(IUniverInstanceService);
9246
9318
  const commandService = accessor.get(ICommandService);
9247
9319
  const activeRectRanges = docSelectionManagerService.getRectRanges();
9248
- const rangeInfo = getRangeInfoFromRanges(docSelectionManagerService.getActiveTextRange(), activeRectRanges);
9320
+ const activeTextRange = docSelectionManagerService.getActiveTextRange();
9321
+ const rangeInfo = getRangeInfoFromRanges((_params$targetRange = params === null || params === void 0 ? void 0 : params.targetRange) !== null && _params$targetRange !== void 0 ? _params$targetRange : activeTextRange, (params === null || params === void 0 ? void 0 : params.targetRange) ? [] : activeRectRanges);
9249
9322
  if (rangeInfo == null) return false;
9250
9323
  const { segmentId } = rangeInfo;
9251
9324
  const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
@@ -9738,7 +9811,7 @@ var Editor = class extends Disposable {
9738
9811
  return docSelectionRenderService.isFocusing && Boolean(docSelectionRenderService.getActiveTextRange());
9739
9812
  }
9740
9813
  /**
9741
- * @deprecated use `IEditorService.focus` as instead. this is for internal usage.
9814
+ * Focus the input element directly. This is for internal usage.
9742
9815
  */
9743
9816
  focus() {
9744
9817
  const curDoc = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
@@ -9747,7 +9820,7 @@ var Editor = class extends Disposable {
9747
9820
  this._param.render.with(DocSelectionRenderService).focus();
9748
9821
  }
9749
9822
  /**
9750
- * @deprecated use `IEditorService.blur` as instead. this is for internal usage.
9823
+ * Blur the input element directly. This is for internal usage.
9751
9824
  */
9752
9825
  blur() {
9753
9826
  this._param.render.with(DocSelectionRenderService).blur();
@@ -9827,21 +9900,17 @@ var Editor = class extends Disposable {
9827
9900
  const docDataModel = this._getDocDataModel();
9828
9901
  docDataModel === null || docDataModel === void 0 || docDataModel.dispose();
9829
9902
  }
9830
- /**
9831
- * @deprecated use getEditorId.
9832
- */
9833
- get editorUnitId() {
9834
- return this._param.editorUnitId;
9835
- }
9836
- /**
9837
- * @deprecated @TODO: @JOCS remove this in the future.
9838
- */
9839
- get params() {
9840
- return this._param;
9841
- }
9842
9903
  get cancelDefaultResizeListener() {
9843
9904
  return this._param.cancelDefaultResizeListener;
9844
9905
  }
9906
+ getRenderConfig() {
9907
+ var _this$_param$canvasSt;
9908
+ return {
9909
+ canvasStyle: (_this$_param$canvasSt = this._param.canvasStyle) !== null && _this$_param$canvasSt !== void 0 ? _this$_param$canvasSt : {},
9910
+ scrollBar: this._param.scrollBar,
9911
+ ...this._param.backScrollOffset === void 0 ? {} : { backScrollOffset: this._param.backScrollOffset }
9912
+ };
9913
+ }
9845
9914
  get render() {
9846
9915
  return this._param.render;
9847
9916
  }
@@ -9859,47 +9928,11 @@ var Editor = class extends Disposable {
9859
9928
  }
9860
9929
  getSkeleton() {
9861
9930
  var _this$_injector$get$g;
9862
- return (_this$_injector$get$g = this._injector.get(IRenderManagerService).getRenderById(this._getEditorId())) === null || _this$_injector$get$g === void 0 ? void 0 : _this$_injector$get$g.with(DocSkeletonManagerService).getSkeleton();
9931
+ return (_this$_injector$get$g = this._injector.get(IRenderManagerService).getRenderUnitById(this._getEditorId())) === null || _this$_injector$get$g === void 0 ? void 0 : _this$_injector$get$g.with(DocSkeletonManagerService).getSkeleton();
9863
9932
  }
9864
9933
  isSheetEditor() {
9865
9934
  return isInternalEditorID(this._getEditorId());
9866
9935
  }
9867
- /**
9868
- * @deprecated use getDocumentData.
9869
- */
9870
- getValue() {
9871
- var _docDataModel$getBody;
9872
- return (((_docDataModel$getBody = this._getDocDataModel().getBody()) === null || _docDataModel$getBody === void 0 ? void 0 : _docDataModel$getBody.dataStream) || "").replace(/\r\n/g, "").replace(/\n/g, "").replace(/\n/g, "");
9873
- }
9874
- /**
9875
- * @deprecated use getDocumentData.
9876
- */
9877
- getBody() {
9878
- return this._getDocDataModel().getBody();
9879
- }
9880
- /**
9881
- * @deprecated.
9882
- */
9883
- update(param) {
9884
- this._param = {
9885
- ...this._param,
9886
- ...param
9887
- };
9888
- }
9889
- /**
9890
- * @deprecated.
9891
- */
9892
- updateCanvasStyle() {
9893
- var _this$_param$canvasSt;
9894
- const docDataModel = this._getDocDataModel();
9895
- if (docDataModel == null) return;
9896
- const documentStyle = {};
9897
- if ((_this$_param$canvasSt = this._param.canvasStyle) === null || _this$_param$canvasSt === void 0 ? void 0 : _this$_param$canvasSt.fontSize) {
9898
- if (documentStyle.textStyle == null) documentStyle.textStyle = {};
9899
- documentStyle.textStyle.fs = this._param.canvasStyle.fontSize;
9900
- }
9901
- docDataModel.updateDocumentStyle(documentStyle);
9902
- }
9903
9936
  _getDocDataModel() {
9904
9937
  const editorUnitId = this._getEditorId();
9905
9938
  return this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC);
@@ -9973,13 +10006,14 @@ let EditorService = class EditorService extends Disposable {
9973
10006
  this._blur$.next(null);
9974
10007
  }
9975
10008
  focus(editorUnitId) {
10009
+ var _editor$getDocumentDa, _editor$getDocumentDa2;
9976
10010
  if (editorUnitId === this._focusEditorUnitId) return;
9977
10011
  if (this._focusEditorUnitId) this.blur();
9978
10012
  if (editorUnitId == null) return;
9979
10013
  const editor = this.getEditor(editorUnitId);
9980
10014
  if (editor == null) return;
9981
10015
  this._univerInstanceService.setCurrentUnitForType(editorUnitId);
9982
- const valueCount = editor.getValue().length;
10016
+ const valueCount = ((_editor$getDocumentDa = (_editor$getDocumentDa2 = editor.getDocumentData().body) === null || _editor$getDocumentDa2 === void 0 ? void 0 : _editor$getDocumentDa2.dataStream) !== null && _editor$getDocumentDa !== void 0 ? _editor$getDocumentDa : "").replace(/\r?\n/g, "").length;
9983
10017
  this._contextService.setContextValue(EDITOR_ACTIVATED, true);
9984
10018
  if (!isInternalEditorID(editorUnitId)) this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, true);
9985
10019
  if (isCommentEditorID(editorUnitId)) this._contextService.setContextValue(FOCUSING_COMMENT_EDITOR, true);
@@ -10002,32 +10036,23 @@ let EditorService = class EditorService extends Disposable {
10002
10036
  return this._editors;
10003
10037
  }
10004
10038
  getEditorRenderConfig(editorUnitId) {
10005
- var _this$_editorRenderCo;
10039
+ var _ref, _this$_editorRenderCo;
10006
10040
  const editor = this._editors.get(editorUnitId);
10007
- if (editor) {
10008
- var _editor$params$canvas;
10009
- return {
10010
- canvasStyle: (_editor$params$canvas = editor.params.canvasStyle) !== null && _editor$params$canvas !== void 0 ? _editor$params$canvas : {},
10011
- scrollBar: editor.params.scrollBar
10012
- };
10013
- }
10014
- return (_this$_editorRenderCo = this._editorRenderConfigs.get(editorUnitId)) !== null && _this$_editorRenderCo !== void 0 ? _this$_editorRenderCo : null;
10041
+ return (_ref = (_this$_editorRenderCo = this._editorRenderConfigs.get(editorUnitId)) !== null && _this$_editorRenderCo !== void 0 ? _this$_editorRenderCo : editor === null || editor === void 0 ? void 0 : editor.getRenderConfig()) !== null && _ref !== void 0 ? _ref : null;
10015
10042
  }
10016
10043
  register(config, container) {
10017
10044
  const { initialSnapshot, canvasStyle = {} } = config;
10018
10045
  const editorUnitId = initialSnapshot.id;
10019
10046
  this._editorRenderConfigs.set(editorUnitId, {
10020
10047
  canvasStyle,
10021
- scrollBar: config.scrollBar
10048
+ scrollBar: config.scrollBar,
10049
+ ...config.backScrollOffset === void 0 ? {} : { backScrollOffset: config.backScrollOffset }
10022
10050
  });
10023
10051
  if (this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC) == null) this._univerInstanceService.createUnit(UniverInstanceType.UNIVER_DOC, initialSnapshot || this._getBlank(editorUnitId), { makeCurrent: false });
10024
- let render = this._renderManagerService.getRenderById(editorUnitId);
10025
- if (render == null) {
10026
- this._renderManagerService.create(editorUnitId);
10027
- render = this._renderManagerService.getRenderById(editorUnitId);
10028
- }
10052
+ let render = this._renderManagerService.getRenderUnitById(editorUnitId);
10053
+ if (render == null) render = this._renderManagerService.createRender(editorUnitId);
10029
10054
  if (render) {
10030
- render.engine.setContainer(container);
10055
+ render.engine.mount(container);
10031
10056
  const editor = new Editor({
10032
10057
  ...config,
10033
10058
  render,
@@ -10137,7 +10162,7 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
10137
10162
  anchorNodePosition && this.scrollToNode(anchorNodePosition);
10138
10163
  }
10139
10164
  scrollToNode(startNodePosition) {
10140
- var _editor$params$backSc;
10165
+ var _editorRenderConfig$b;
10141
10166
  const { unitId, scene, mainComponent } = this._context;
10142
10167
  const skeleton = this._docSkeletonManagerService.getSkeleton();
10143
10168
  if (mainComponent == null || skeleton == null) return;
@@ -10148,12 +10173,12 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
10148
10173
  const left = aLeft + docsLeft;
10149
10174
  const top = aTop + docsTop;
10150
10175
  const viewportMain = scene.getViewport("viewMain");
10151
- const editor = this._editorService.getEditor(unitId);
10152
10176
  if (viewportMain == null) return;
10153
- const { left: boundLeft, top: boundTop, right: boundRight, bottom: boundBottom } = viewportMain.getBounding().viewBound;
10177
+ const { left: boundLeft, top: boundTop, right: boundRight, bottom: boundBottom } = viewportMain.calcViewportInfo().viewBound;
10154
10178
  let offsetY = 0;
10155
10179
  let offsetX = 0;
10156
- const delta = editor ? (_editor$params$backSc = editor.params.backScrollOffset) !== null && _editor$params$backSc !== void 0 ? _editor$params$backSc : 0 : 100;
10180
+ const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
10181
+ const delta = editorRenderConfig ? (_editorRenderConfig$b = editorRenderConfig.backScrollOffset) !== null && _editorRenderConfig$b !== void 0 ? _editorRenderConfig$b : 0 : 100;
10157
10182
  if (top < boundTop) offsetY = top - boundTop - delta;
10158
10183
  else if (top > boundBottom - height) offsetY = top - boundBottom + height + delta;
10159
10184
  if (left < boundLeft) offsetX = left - boundLeft;
@@ -10199,12 +10224,15 @@ let DocParagraphPlaceholderRenderController = class DocParagraphPlaceholderRende
10199
10224
  this.disposeWithMe(documents.pageRender$.subscribe((pageRenderConfig) => this._drawPagePlaceholders(pageRenderConfig)));
10200
10225
  }
10201
10226
  _drawPagePlaceholders({ page, pageLeft, pageTop, ctx }) {
10202
- var _this$_context$unit$g, _activeRange$segmentI, _page$segmentId;
10227
+ var _this$_context$unit$g, _activeRange$segmentI, _page$segmentId, _this$_context$mainCo;
10203
10228
  const body = (_this$_context$unit$g = this._context.unit.getSelfOrHeaderFooterModel(page.segmentId)) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getBody();
10204
10229
  if (!body) return;
10205
10230
  const activeRange = this._docSelectionManagerService.getActiveTextRange();
10206
10231
  if (!activeRange || ((_activeRange$segmentI = activeRange.segmentId) !== null && _activeRange$segmentI !== void 0 ? _activeRange$segmentI : "") !== ((_page$segmentId = page.segmentId) !== null && _page$segmentId !== void 0 ? _page$segmentId : "")) return;
10207
- const placeholders = getParagraphPlaceholderLayouts(page, body, this._getLocale(), pageLeft, pageTop, activeRange.startOffset);
10232
+ const placeholders = getParagraphPlaceholderLayouts(page, body, this._getLocale(), pageLeft, pageTop, activeRange.startOffset, {
10233
+ docsLeft: (_this$_context$mainCo = this._context.mainComponent) === null || _this$_context$mainCo === void 0 ? void 0 : _this$_context$mainCo.getOffsetConfig().docsLeft,
10234
+ unitId: this._context.unitId
10235
+ });
10208
10236
  if (!placeholders.length) return;
10209
10237
  drawParagraphPlaceholders(ctx, placeholders);
10210
10238
  }
@@ -10231,20 +10259,39 @@ function shouldRenderParagraphPlaceholder(documentModel, unitId, config) {
10231
10259
  if (isInternalEditorID(unitId)) return false;
10232
10260
  return ((_documentModel$getSna = documentModel.getSnapshot().documentStyle) === null || _documentModel$getSna === void 0 ? void 0 : _documentModel$getSna.documentFlavor) === DocumentFlavor.MODERN;
10233
10261
  }
10234
- function getParagraphPlaceholderLayouts(page, body, locale, pageLeft = 0, pageTop = 0, activeOffset) {
10262
+ function getParagraphPlaceholderLayouts(page, body, locale, pageLeft = 0, pageTop = 0, activeOffset, options) {
10235
10263
  var _body$paragraphs, _page$skeTables;
10236
10264
  const paragraphs = new Map(((_body$paragraphs = body.paragraphs) !== null && _body$paragraphs !== void 0 ? _body$paragraphs : []).map((paragraph) => [paragraph.startIndex, paragraph]));
10237
10265
  const layouts = [];
10238
- const visitSection = (section, originLeft, originTop) => {
10239
- for (const column of section.columns) visitColumn(column, body, paragraphs, locale, layouts, originLeft + column.left, originTop + section.top, activeOffset);
10266
+ const visitSection = (section, originLeft, originTop, clip) => {
10267
+ for (const column of section.columns) visitColumn(column, body, paragraphs, locale, layouts, originLeft + column.left, originTop + section.top, activeOffset, clip);
10240
10268
  };
10241
10269
  for (const section of page.sections) visitSection(section, pageLeft + page.marginLeft, pageTop + page.marginTop);
10242
- (_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table) => {
10243
- for (const row of table.rows) for (const cell of row.cells) for (const section of cell.sections) visitSection(section, pageLeft + page.marginLeft + table.left + cell.left + cell.marginLeft, pageTop + page.marginTop + table.top + row.top + cell.marginTop);
10270
+ (_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table, tableId) => {
10271
+ var _table$tableId, _options$unitId, _viewport$leadingInse, _viewport$trailingIns, _viewport$leadingInse2;
10272
+ const sourceTableId = getTableIdAndSliceIndex((_table$tableId = table.tableId) !== null && _table$tableId !== void 0 ? _table$tableId : tableId).tableId;
10273
+ const viewport = getDocsTableRenderViewport((_options$unitId = options === null || options === void 0 ? void 0 : options.unitId) !== null && _options$unitId !== void 0 ? _options$unitId : "", sourceTableId);
10274
+ const hasHorizontalViewport = viewport != null && ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0) + viewport.contentWidth + ((_viewport$trailingIns = viewport.trailingInsetRight) !== null && _viewport$trailingIns !== void 0 ? _viewport$trailingIns : 0) > viewport.viewportWidth;
10275
+ const tableLeft = pageLeft + page.marginLeft + table.left;
10276
+ const tableViewportLeft = hasHorizontalViewport ? getDocsTableViewportLeft(viewport, tableLeft - ((_viewport$leadingInse2 = viewport.leadingInsetLeft) !== null && _viewport$leadingInse2 !== void 0 ? _viewport$leadingInse2 : 0), options === null || options === void 0 ? void 0 : options.docsLeft) : tableLeft;
10277
+ const tableViewportRight = tableViewportLeft + (hasHorizontalViewport ? viewport.viewportWidth : table.width);
10278
+ const tableScrollLeft = hasHorizontalViewport ? viewport.scrollLeft : 0;
10279
+ for (const row of table.rows) for (const cell of row.cells) {
10280
+ const cellLeft = tableLeft + cell.left - tableScrollLeft;
10281
+ const cellContentLeft = cellLeft + cell.marginLeft;
10282
+ const cellContentRight = cellLeft + cell.pageWidth - cell.marginRight;
10283
+ const clipLeft = Math.max(cellContentLeft, tableViewportLeft);
10284
+ const clipRight = Math.min(cellContentRight, tableViewportRight);
10285
+ if (clipRight <= clipLeft) continue;
10286
+ for (const section of cell.sections) visitSection(section, cellContentLeft, pageTop + page.marginTop + table.top + row.top + cell.marginTop, {
10287
+ left: clipLeft,
10288
+ right: clipRight
10289
+ });
10290
+ }
10244
10291
  });
10245
10292
  return layouts;
10246
10293
  }
10247
- function visitColumn(column, body, paragraphs, locale, layouts, originLeft, originTop, activeOffset) {
10294
+ function visitColumn(column, body, paragraphs, locale, layouts, originLeft, originTop, activeOffset, clip) {
10248
10295
  for (const line of column.lines) {
10249
10296
  if (!line.paragraphStart) continue;
10250
10297
  const paragraphStart = line.st;
@@ -10254,7 +10301,7 @@ function visitColumn(column, body, paragraphs, locale, layouts, originLeft, orig
10254
10301
  if (!paragraph || !isEmptyParagraph(body.dataStream, line.st, line.paragraphIndex)) continue;
10255
10302
  const text = getPlaceholderText(paragraph, locale);
10256
10303
  if (!text) continue;
10257
- layouts.push(getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop));
10304
+ layouts.push(getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop, clip));
10258
10305
  }
10259
10306
  }
10260
10307
  function isOffsetInParagraph(offset, paragraphStart, paragraphEnd) {
@@ -10272,8 +10319,8 @@ function getPlaceholderText(paragraph, locale) {
10272
10319
  default: return locale.normalText;
10273
10320
  }
10274
10321
  }
10275
- function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop) {
10276
- var _divide$glyphGroup, _paragraph$paragraphS2, _paragraph$paragraphS3, _getLineFontFamily, _divide$left, _divide$paddingLeft, _ref, _divide$width;
10322
+ function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop, clip) {
10323
+ var _divide$glyphGroup, _paragraph$paragraphS2, _paragraph$paragraphS3, _getLineFontFamily, _divide$left, _divide$paddingLeft, _ref, _divide$width, _clip$left, _clip$right;
10277
10324
  const divide = line.divides[0];
10278
10325
  const firstGlyph = ((_divide$glyphGroup = divide === null || divide === void 0 ? void 0 : divide.glyphGroup) !== null && _divide$glyphGroup !== void 0 ? _divide$glyphGroup : [])[0];
10279
10326
  const textStyle = NAMED_STYLE_MAP[(_paragraph$paragraphS2 = (_paragraph$paragraphS3 = paragraph.paragraphStyle) === null || _paragraph$paragraphS3 === void 0 ? void 0 : _paragraph$paragraphS3.namedStyleType) !== null && _paragraph$paragraphS2 !== void 0 ? _paragraph$paragraphS2 : NamedStyleType.NORMAL_TEXT];
@@ -10282,13 +10329,22 @@ function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop)
10282
10329
  const fontWeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.bl) ? "bold" : "normal";
10283
10330
  const lineStartX = originLeft + ((_divide$left = divide === null || divide === void 0 ? void 0 : divide.left) !== null && _divide$left !== void 0 ? _divide$left : 0) + ((_divide$paddingLeft = divide === null || divide === void 0 ? void 0 : divide.paddingLeft) !== null && _divide$paddingLeft !== void 0 ? _divide$paddingLeft : 0);
10284
10331
  const listOffset = paragraph.bullet && firstGlyph ? firstGlyph.left + firstGlyph.width + LIST_PLACEHOLDER_GAP : 0;
10332
+ const x = lineStartX + listOffset;
10333
+ const naturalMaxWidth = Math.max(0, ((_ref = (_divide$width = divide === null || divide === void 0 ? void 0 : divide.width) !== null && _divide$width !== void 0 ? _divide$width : line.width) !== null && _ref !== void 0 ? _ref : 0) - listOffset);
10334
+ const clipLeft = Math.max(x, (_clip$left = clip === null || clip === void 0 ? void 0 : clip.left) !== null && _clip$left !== void 0 ? _clip$left : x);
10335
+ const clipRight = Math.min(x + naturalMaxWidth, (_clip$right = clip === null || clip === void 0 ? void 0 : clip.right) !== null && _clip$right !== void 0 ? _clip$right : x + naturalMaxWidth);
10336
+ const clipTop = originTop + line.top;
10285
10337
  return {
10338
+ clipBottom: clipTop + line.lineHeight,
10339
+ clipLeft,
10340
+ clipRight,
10341
+ clipTop,
10286
10342
  fontFamily,
10287
10343
  fontSize,
10288
10344
  fontWeight,
10289
- maxWidth: Math.max(0, ((_ref = (_divide$width = divide === null || divide === void 0 ? void 0 : divide.width) !== null && _divide$width !== void 0 ? _divide$width : line.width) !== null && _ref !== void 0 ? _ref : 0) - listOffset),
10345
+ maxWidth: Math.max(0, clipRight - clipLeft),
10290
10346
  text,
10291
- x: lineStartX + listOffset,
10347
+ x,
10292
10348
  y: originTop + line.top + line.marginTop + line.paddingTop + line.asc
10293
10349
  };
10294
10350
  }
@@ -10328,8 +10384,20 @@ function drawParagraphPlaceholders(ctx, placeholders) {
10328
10384
  ctx.fillStyle = PLACEHOLDER_COLOR;
10329
10385
  ctx.textBaseline = "alphabetic";
10330
10386
  for (const placeholder of placeholders) {
10387
+ var _placeholder$clipLeft, _placeholder$clipRigh, _placeholder$clipTop, _placeholder$clipBott;
10388
+ const clipLeft = (_placeholder$clipLeft = placeholder.clipLeft) !== null && _placeholder$clipLeft !== void 0 ? _placeholder$clipLeft : placeholder.x;
10389
+ const clipRight = (_placeholder$clipRigh = placeholder.clipRight) !== null && _placeholder$clipRigh !== void 0 ? _placeholder$clipRigh : placeholder.x + placeholder.maxWidth;
10390
+ const clipTop = (_placeholder$clipTop = placeholder.clipTop) !== null && _placeholder$clipTop !== void 0 ? _placeholder$clipTop : placeholder.y - placeholder.fontSize;
10391
+ const clipBottom = (_placeholder$clipBott = placeholder.clipBottom) !== null && _placeholder$clipBott !== void 0 ? _placeholder$clipBott : placeholder.y + placeholder.fontSize;
10392
+ if (clipRight <= clipLeft || clipBottom <= clipTop) continue;
10393
+ ctx.save();
10394
+ ctx.beginPath();
10395
+ ctx.rectByPrecision(clipLeft, clipTop, clipRight - clipLeft, clipBottom - clipTop);
10396
+ ctx.closePath();
10397
+ ctx.clip();
10331
10398
  ctx.font = `${placeholder.fontWeight} ${placeholder.fontSize}px ${placeholder.fontFamily}`;
10332
- ctx.fillText(placeholder.text, placeholder.x, placeholder.y, placeholder.maxWidth || void 0);
10399
+ ctx.fillText(placeholder.text, placeholder.x, placeholder.y);
10400
+ ctx.restore();
10333
10401
  }
10334
10402
  ctx.restore();
10335
10403
  }
@@ -10476,7 +10544,10 @@ let DocPageLayoutService = class DocPageLayoutService extends Disposable {
10476
10544
  }
10477
10545
  if (engineHeight > docsHeight) sceneHeight = (engineHeight - pageMarginTop * 2) / viewScale;
10478
10546
  else sceneHeight = docsHeight + pageMarginTop * 2;
10479
- scene.resize(sceneWidth, sceneHeight);
10547
+ scene.transformByState({
10548
+ width: sceneWidth,
10549
+ height: sceneHeight
10550
+ });
10480
10551
  if (engineWidth <= 1) {
10481
10552
  docsLeft = -1e4;
10482
10553
  docsTop = -1e4;
@@ -10513,7 +10584,7 @@ let DocRenderController = class DocRenderController extends RxDisposable {
10513
10584
  }
10514
10585
  reRender(unitId) {
10515
10586
  var _this$_renderManagerS;
10516
- const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService);
10587
+ const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService);
10517
10588
  const skeleton = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getSkeleton();
10518
10589
  if (!skeleton) return;
10519
10590
  if (!!skeleton.getViewModel().getDataModel().getSnapshot().disabled) return;
@@ -10661,7 +10732,10 @@ let DocRenderController = class DocRenderController extends RxDisposable {
10661
10732
  docsComponent.resize(width, height);
10662
10733
  docBackground.resize(width, height);
10663
10734
  const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
10664
- if (!editorRenderConfig || editorRenderConfig.scrollBar) scene.resize(width, height);
10735
+ if (!editorRenderConfig || editorRenderConfig.scrollBar) scene.transformByState({
10736
+ width,
10737
+ height
10738
+ });
10665
10739
  }
10666
10740
  _syncCanvasBackground(documentFlavor = this._context.unit.getSnapshot().documentStyle.documentFlavor) {
10667
10741
  var _docBackground$setFil;
@@ -10708,10 +10782,7 @@ function getPageSizeInModernMode(page) {
10708
10782
  const { marginLeft, marginRight, marginTop, marginBottom, skeDrawings, skeTables } = page;
10709
10783
  if (pageWidth === Number.POSITIVE_INFINITY) pageWidth = page.width + marginLeft + marginRight;
10710
10784
  if (pageHeight === Number.POSITIVE_INFINITY) pageHeight = page.height + marginTop + marginBottom;
10711
- for (const drawing of skeDrawings.values()) {
10712
- pageWidth = Math.max(pageWidth, drawing.aLeft + drawing.width + marginLeft + marginRight);
10713
- pageHeight = Math.max(pageHeight, drawing.aTop + drawing.height + marginTop + marginBottom);
10714
- }
10785
+ for (const drawing of skeDrawings.values()) pageHeight = Math.max(pageHeight, drawing.aTop + drawing.height + marginTop + marginBottom);
10715
10786
  for (const table of skeTables.values()) pageHeight = Math.max(pageHeight, table.top + table.height + marginTop + marginBottom);
10716
10787
  return {
10717
10788
  pageWidth,
@@ -10852,7 +10923,7 @@ const CloseHeaderFooterCommand = {
10852
10923
  const instanceService = accessor.get(IUniverInstanceService);
10853
10924
  const unitId = (_params$unitId = params === null || params === void 0 ? void 0 : params.unitId) !== null && _params$unitId !== void 0 ? _params$unitId : (_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId();
10854
10925
  if (unitId == null) return false;
10855
- const renderObject = renderManagerService.getRenderById(unitId);
10926
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
10856
10927
  if (renderObject == null) return false;
10857
10928
  const docSkeletonManagerService = renderObject.with(DocSkeletonManagerService);
10858
10929
  const viewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
@@ -10973,9 +11044,10 @@ const DOC_SECTION_SETTING_COMPONENT = "doc_ui_section-setting-panel";
10973
11044
  * limitations under the License.
10974
11045
  */
10975
11046
  let DocSectionSettingController = class DocSectionSettingController extends Disposable {
10976
- constructor(_sidebarService) {
11047
+ constructor(_sidebarService, _selectionManager) {
10977
11048
  super();
10978
11049
  this._sidebarService = _sidebarService;
11050
+ this._selectionManager = _selectionManager;
10979
11051
  _defineProperty(this, "_panelId", "DocSectionSetting");
10980
11052
  }
10981
11053
  openPanel() {
@@ -10989,8 +11061,19 @@ let DocSectionSettingController = class DocSectionSettingController extends Disp
10989
11061
  closePanel() {
10990
11062
  this._sidebarService.close(this._panelId);
10991
11063
  }
11064
+ navigateToSectionEnd(unitId, sectionStart, sectionEnd) {
11065
+ const params = {
11066
+ unitId,
11067
+ subUnitId: unitId
11068
+ };
11069
+ const cursorOffset = Math.max(sectionStart, sectionEnd - 1);
11070
+ this._selectionManager.replaceDocRanges([{
11071
+ startOffset: cursorOffset,
11072
+ endOffset: cursorOffset
11073
+ }], params, true, { shouldFocus: false });
11074
+ }
10992
11075
  };
10993
- DocSectionSettingController = __decorate([__decorateParam(0, Inject(ISidebarService))], DocSectionSettingController);
11076
+ DocSectionSettingController = __decorate([__decorateParam(0, Inject(ISidebarService)), __decorateParam(1, Inject(DocSelectionManagerService))], DocSectionSettingController);
10994
11077
 
10995
11078
  //#endregion
10996
11079
  //#region src/commands/operations/doc-section-setting-panel.operation.ts
@@ -11003,6 +11086,52 @@ const DocSectionSettingPanelOperation = {
11003
11086
  }
11004
11087
  };
11005
11088
 
11089
+ //#endregion
11090
+ //#region src/commands/operations/insert-break.operation.ts
11091
+ function getCollapsedBodyOffset(selectionManager) {
11092
+ const range = selectionManager.getActiveTextRange();
11093
+ if (!(range === null || range === void 0 ? void 0 : range.collapsed) || range.segmentId || !Number.isInteger(range.startOffset)) return null;
11094
+ return range.startOffset;
11095
+ }
11096
+ const InsertDocumentColumnBreakOperation = {
11097
+ id: "docs.operation.insert-column-break",
11098
+ type: CommandType.OPERATION,
11099
+ handler: (accessor) => {
11100
+ const instanceService = accessor.get(IUniverInstanceService);
11101
+ const selectionManager = accessor.get(DocSelectionManagerService);
11102
+ const commandService = accessor.get(ICommandService);
11103
+ const document = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
11104
+ const offset = getCollapsedBodyOffset(selectionManager);
11105
+ if (!document || document.getDocumentStyle().documentFlavor !== DocumentFlavor.TRADITIONAL || offset == null) return false;
11106
+ return commandService.syncExecuteCommand(InsertDocumentColumnBreakCommand.id, {
11107
+ unitId: document.getUnitId(),
11108
+ offset
11109
+ });
11110
+ }
11111
+ };
11112
+ const InsertDocumentSectionBreakOperation = {
11113
+ id: "docs.operation.insert-section-break",
11114
+ type: CommandType.OPERATION,
11115
+ handler: (accessor, params) => {
11116
+ var _body$sectionBreaks;
11117
+ if (!params) return false;
11118
+ const instanceService = accessor.get(IUniverInstanceService);
11119
+ const selectionManager = accessor.get(DocSelectionManagerService);
11120
+ const commandService = accessor.get(ICommandService);
11121
+ const document = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
11122
+ const offset = getCollapsedBodyOffset(selectionManager);
11123
+ const body = document === null || document === void 0 ? void 0 : document.getBody();
11124
+ if (!document || !body || document.getDocumentStyle().documentFlavor !== DocumentFlavor.TRADITIONAL || offset == null) return false;
11125
+ const sectionId = createSectionId(new Set((_body$sectionBreaks = body.sectionBreaks) === null || _body$sectionBreaks === void 0 ? void 0 : _body$sectionBreaks.map((section) => section.sectionId)));
11126
+ return commandService.syncExecuteCommand(InsertDocumentSectionBreakCommand.id, {
11127
+ unitId: document.getUnitId(),
11128
+ offset,
11129
+ sectionId,
11130
+ nextSectionType: params.sectionType
11131
+ });
11132
+ }
11133
+ };
11134
+
11006
11135
  //#endregion
11007
11136
  //#region src/views/PageSettings.tsx
11008
11137
  const MODERN_WIDTH_OPTIONS = [
@@ -11094,7 +11223,7 @@ function PageSettings(props) {
11094
11223
  className: "univer-grid univer-grid-cols-3 univer-gap-2",
11095
11224
  children: MODERN_WIDTH_OPTIONS.map((option) => /* @__PURE__ */ jsxs("button", {
11096
11225
  type: "button",
11097
- className: clsx("univer-flex univer-h-16 univer-cursor-pointer univer-flex-col univer-items-center univer-justify-center univer-gap-1 univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-text-sm univer-font-medium univer-text-gray-700 univer-transition-colors hover:univer-border-primary-500 hover:univer-text-primary-600 dark:!univer-border-gray-600 dark:!univer-bg-gray-900 dark:!univer-text-gray-100", { "!univer-border-primary-500 !univer-bg-primary-50 !univer-text-primary-600 dark:!univer-bg-primary-900": settings.modernWidth === option }),
11226
+ className: clsx(resetButtonClassName, borderClassName, "univer-h-16 univer-flex-col univer-gap-1 univer-rounded-lg univer-bg-white univer-text-sm univer-font-medium univer-text-gray-700 univer-transition-colors hover:univer-border-primary-500 hover:univer-text-primary-600 dark:!univer-bg-gray-900 dark:!univer-text-gray-100", { "!univer-border-primary-500 !univer-bg-primary-50 !univer-text-primary-600 dark:!univer-bg-primary-900": settings.modernWidth === option }),
11098
11227
  onClick: () => handleModernWidthChange(option),
11099
11228
  children: [/* @__PURE__ */ jsx("span", { children: localeService.t(`docs-ui.page-settings.modern-width-${option}`) }), /* @__PURE__ */ jsxs("span", {
11100
11229
  className: "univer-text-xs univer-font-normal univer-text-gray-400",
@@ -11585,6 +11714,54 @@ function DeleteTableMenuItemFactory(accessor) {
11585
11714
  };
11586
11715
  }
11587
11716
 
11717
+ //#endregion
11718
+ //#region src/commands/commands/insert-special-character.command.ts
11719
+ const InsertSpecialCharacterCommand = {
11720
+ id: "doc.command.insert-special-character",
11721
+ type: CommandType.COMMAND,
11722
+ handler: (accessor, params) => {
11723
+ var _docDataModel$getSelf, _originBody$customRan, _originBody$customDec;
11724
+ if (!(params === null || params === void 0 ? void 0 : params.value)) return false;
11725
+ const commandService = accessor.get(ICommandService);
11726
+ const docSelectionManagerService = accessor.get(DocSelectionManagerService);
11727
+ const univerInstanceService = accessor.get(IUniverInstanceService);
11728
+ const docMenuStyleService = accessor.get(DocMenuStyleService);
11729
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
11730
+ const activeRange = docSelectionManagerService.getActiveTextRange();
11731
+ if (!docDataModel || !activeRange) return false;
11732
+ const { segmentId } = activeRange;
11733
+ const originBody = (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getBody();
11734
+ if (!originBody) return false;
11735
+ const { value } = params;
11736
+ const curTextRun = getTextRunAtPosition(originBody, activeRange.endOffset, docMenuStyleService.getDefaultStyle(), docMenuStyleService.getStyleCache());
11737
+ const curCustomRange = getCustomRangeAtPosition((_originBody$customRan = originBody.customRanges) !== null && _originBody$customRan !== void 0 ? _originBody$customRan : [], activeRange.endOffset);
11738
+ const curCustomDecorations = getCustomDecorationAtPosition((_originBody$customDec = originBody.customDecorations) !== null && _originBody$customDec !== void 0 ? _originBody$customDec : [], activeRange.endOffset);
11739
+ return commandService.executeCommand(InsertTextCommand.id, {
11740
+ unitId: docDataModel.getUnitId(),
11741
+ body: {
11742
+ dataStream: value,
11743
+ textRuns: [{
11744
+ ...curTextRun,
11745
+ st: 0,
11746
+ ed: value.length
11747
+ }],
11748
+ customRanges: curCustomRange ? [{
11749
+ ...curCustomRange,
11750
+ startIndex: 0,
11751
+ endIndex: value.length - 1
11752
+ }] : [],
11753
+ customDecorations: curCustomDecorations.map((customDecoration) => ({
11754
+ ...customDecoration,
11755
+ startIndex: 0,
11756
+ endIndex: value.length - 1
11757
+ }))
11758
+ },
11759
+ range: activeRange,
11760
+ segmentId
11761
+ });
11762
+ }
11763
+ };
11764
+
11588
11765
  //#endregion
11589
11766
  //#region src/views/const.ts
11590
11767
  /**
@@ -11625,6 +11802,7 @@ const ListTypePicker = (props) => {
11625
11802
  const { value, onChange, options } = props;
11626
11803
  return /* @__PURE__ */ jsx("div", {
11627
11804
  className: "univer-grid univer-grid-cols-3 univer-gap-2 univer-p-1.5",
11805
+ "data-u-editor-interaction-boundary": "true",
11628
11806
  children: options.map((item) => {
11629
11807
  return /* @__PURE__ */ jsx("a", {
11630
11808
  className: clsx("univer-block univer-h-20 univer-w-[72px] univer-cursor-pointer univer-overflow-hidden univer-rounded univer-transition-all hover:univer-border-primary-500", borderClassName, { "univer-border-primary-500": value === item.value }),
@@ -11749,16 +11927,22 @@ function getInsertTableHiddenObservable(accessor) {
11749
11927
  const univerInstanceService = accessor.get(IUniverInstanceService);
11750
11928
  const renderManagerService = accessor.get(IRenderManagerService);
11751
11929
  return new Observable((subscriber) => {
11930
+ let editAreaSubscription = null;
11752
11931
  const subscription = univerInstanceService.focused$.subscribe((unitId) => {
11932
+ editAreaSubscription === null || editAreaSubscription === void 0 || editAreaSubscription.unsubscribe();
11933
+ editAreaSubscription = null;
11753
11934
  if (unitId == null) return subscriber.next(true);
11754
11935
  if (univerInstanceService.getUnitType(unitId) !== UniverInstanceType.UNIVER_DOC) return subscriber.next(true);
11755
- const currentRender = renderManagerService.getRenderById(unitId);
11936
+ const currentRender = renderManagerService.getRenderUnitById(unitId);
11756
11937
  if (currentRender == null) return subscriber.next(true);
11757
- currentRender.with(DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe((editArea) => {
11938
+ editAreaSubscription = currentRender.with(DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe((editArea) => {
11758
11939
  subscriber.next(editArea === DocumentEditArea.HEADER || editArea === DocumentEditArea.FOOTER);
11759
11940
  });
11760
11941
  });
11761
- return () => subscription.unsubscribe();
11942
+ return () => {
11943
+ editAreaSubscription === null || editAreaSubscription === void 0 || editAreaSubscription.unsubscribe();
11944
+ subscription.unsubscribe();
11945
+ };
11762
11946
  });
11763
11947
  }
11764
11948
  function disableMenuWhenHeaderFooterEditing(accessor) {
@@ -11780,7 +11964,7 @@ function disableMenuWhenHeaderFooterEditing(accessor) {
11780
11964
  emit(true);
11781
11965
  return;
11782
11966
  }
11783
- const currentRender = renderManagerService.getRenderById(unitId);
11967
+ const currentRender = renderManagerService.getRenderUnitById(unitId);
11784
11968
  const skeletonManager = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService);
11785
11969
  const viewModel = skeletonManager === null || skeletonManager === void 0 ? void 0 : skeletonManager.getViewModel();
11786
11970
  if (!viewModel) {
@@ -11801,7 +11985,7 @@ function disableMenuWhenHeaderFooterEditing(accessor) {
11801
11985
  };
11802
11986
  });
11803
11987
  }
11804
- function getHeaderFooterMenuHiddenObservable(accessor) {
11988
+ function getTraditionalDocMenuHiddenObservable(accessor) {
11805
11989
  const univerInstanceService = accessor.get(IUniverInstanceService);
11806
11990
  const commandService = accessor.get(ICommandService);
11807
11991
  return new Observable((subscriber) => {
@@ -11824,9 +12008,8 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
11824
12008
  subscriber.next(documentFlavor !== DocumentFlavor.TRADITIONAL);
11825
12009
  });
11826
12010
  const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
11827
- if (docDataModel == null) return subscriber.next(true);
11828
12011
  const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
11829
- subscriber.next(documentFlavor !== DocumentFlavor.TRADITIONAL);
12012
+ subscriber.next(docDataModel == null || documentFlavor !== DocumentFlavor.TRADITIONAL);
11830
12013
  return () => {
11831
12014
  subscription0.dispose();
11832
12015
  subscription.unsubscribe();
@@ -11903,6 +12086,42 @@ function disableMenuWhenNoDocRange(accessor) {
11903
12086
  return () => subscription.unsubscribe();
11904
12087
  });
11905
12088
  }
12089
+ const DOC_INSERT_EMOJI_MENU_ID = "doc.menu.insert-emoji";
12090
+ const DOC_INSERT_SYMBOL_MENU_ID = "doc.menu.insert-symbol";
12091
+ function EmojiPickerMenuItemFactory(accessor) {
12092
+ return {
12093
+ id: DOC_INSERT_EMOJI_MENU_ID,
12094
+ type: MenuItemType.SELECTOR,
12095
+ icon: "SmileIcon",
12096
+ tooltip: "ui.emojiPicker.emojis",
12097
+ selectionsCommandId: InsertSpecialCharacterCommand.id,
12098
+ selections: [{ label: {
12099
+ name: EMOJI_PICKER_COMPONENT,
12100
+ hoverable: false,
12101
+ selectable: false,
12102
+ props: { embedded: true }
12103
+ } }],
12104
+ disabled$: disableMenuWhenNoDocRange(accessor),
12105
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
12106
+ };
12107
+ }
12108
+ function SymbolPickerMenuItemFactory(accessor) {
12109
+ return {
12110
+ id: DOC_INSERT_SYMBOL_MENU_ID,
12111
+ type: MenuItemType.SELECTOR,
12112
+ icon: "SymbolsIcon",
12113
+ tooltip: "ui.emojiPicker.symbols",
12114
+ selectionsCommandId: InsertSpecialCharacterCommand.id,
12115
+ selections: [{ label: {
12116
+ name: SYMBOL_PICKER_COMPONENT,
12117
+ hoverable: false,
12118
+ selectable: false,
12119
+ props: { embedded: true }
12120
+ } }],
12121
+ disabled$: disableMenuWhenNoDocRange(accessor),
12122
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
12123
+ };
12124
+ }
11906
12125
  function isTextRangeInAnyBlockRange(document, range) {
11907
12126
  var _document$getBody$blo2, _document$getBody2;
11908
12127
  const blockRanges = (_document$getBody$blo2 = document === null || document === void 0 || (_document$getBody2 = document.getBody()) === null || _document$getBody2 === void 0 ? void 0 : _document$getBody2.blockRanges) !== null && _document$getBody$blo2 !== void 0 ? _document$getBody$blo2 : [];
@@ -12374,11 +12593,60 @@ function HeaderFooterMenuItemFactory(accessor) {
12374
12593
  type: MenuItemType.BUTTON,
12375
12594
  icon: "HeaderFooterIcon",
12376
12595
  tooltip: "docs-ui.toolbar.headerFooter",
12377
- hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => {
12596
+ hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getTraditionalDocMenuHiddenObservable(accessor), (one, two) => {
12378
12597
  return one || two;
12379
12598
  })
12380
12599
  };
12381
12600
  }
12601
+ const DOC_BREAKS_MENU_ID = "doc.menu.breaks";
12602
+ const DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID = "doc.menu.section-break.next-page";
12603
+ const DOC_SECTION_BREAK_CONTINUOUS_MENU_ID = "doc.menu.section-break.continuous";
12604
+ const DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID = "doc.menu.section-break.next-column";
12605
+ const DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID = "doc.menu.section-break.even-page";
12606
+ const DOC_SECTION_BREAK_ODD_PAGE_MENU_ID = "doc.menu.section-break.odd-page";
12607
+ function BreaksMenuFactory(accessor) {
12608
+ return {
12609
+ id: DOC_BREAKS_MENU_ID,
12610
+ type: MenuItemType.SUBITEMS,
12611
+ icon: "ColumnIcon",
12612
+ tooltip: "docs-ui.toolbar.breaks",
12613
+ disabled$: disableMenuWhenNoDocRange(accessor),
12614
+ hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getTraditionalDocMenuHiddenObservable(accessor), (hidden, unsupported) => hidden || unsupported)
12615
+ };
12616
+ }
12617
+ function InsertColumnBreakMenuFactory(accessor) {
12618
+ return {
12619
+ id: InsertDocumentColumnBreakOperation.id,
12620
+ type: MenuItemType.BUTTON,
12621
+ title: "docs-ui.toolbar.columnBreak",
12622
+ disabled$: disableMenuWhenNoDocRange(accessor)
12623
+ };
12624
+ }
12625
+ function createSectionBreakMenuItem(accessor, id, title, sectionType) {
12626
+ return {
12627
+ id,
12628
+ commandId: InsertDocumentSectionBreakOperation.id,
12629
+ params: { sectionType },
12630
+ type: MenuItemType.BUTTON,
12631
+ title,
12632
+ disabled$: disableMenuWhenNoDocRange(accessor)
12633
+ };
12634
+ }
12635
+ function InsertNextPageSectionBreakMenuFactory(accessor) {
12636
+ return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID, "docs-ui.toolbar.sectionBreakNextPage", SectionType.NEXT_PAGE);
12637
+ }
12638
+ function InsertContinuousSectionBreakMenuFactory(accessor) {
12639
+ return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_CONTINUOUS_MENU_ID, "docs-ui.toolbar.sectionBreakContinuous", SectionType.CONTINUOUS);
12640
+ }
12641
+ function InsertNextColumnSectionBreakMenuFactory(accessor) {
12642
+ return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID, "docs-ui.toolbar.sectionBreakNextColumn", SectionType.NEXT_COLUMN);
12643
+ }
12644
+ function InsertEvenPageSectionBreakMenuFactory(accessor) {
12645
+ return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID, "docs-ui.toolbar.sectionBreakEvenPage", SectionType.EVEN_PAGE);
12646
+ }
12647
+ function InsertOddPageSectionBreakMenuFactory(accessor) {
12648
+ return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_ODD_PAGE_MENU_ID, "docs-ui.toolbar.sectionBreakOddPage", SectionType.ODD_PAGE);
12649
+ }
12382
12650
  const TableIcon = "GridIcon";
12383
12651
  const TABLE_MENU_ID = "doc.menu.table";
12384
12652
  function TableMenuFactory(accessor) {
@@ -12563,7 +12831,10 @@ function AlignMenuItemFactory(accessor) {
12563
12831
  });
12564
12832
  calc();
12565
12833
  return disposable.dispose;
12566
- });
12834
+ }).pipe(distinctUntilChanged(), shareReplay({
12835
+ bufferSize: 1,
12836
+ refCount: true
12837
+ }));
12567
12838
  return {
12568
12839
  id: AlignOperationCommand.id,
12569
12840
  type: MenuItemType.SELECTOR,
@@ -13409,42 +13680,87 @@ const menuSchema = {
13409
13680
  [RibbonStartGroup.FORMAT]: {
13410
13681
  [SetInlineFormatBoldCommand.id]: {
13411
13682
  order: 0,
13683
+ gridLayout: {
13684
+ row: 2,
13685
+ column: 1
13686
+ },
13412
13687
  menuItemFactory: BoldMenuItemFactory
13413
13688
  },
13414
13689
  [SetInlineFormatItalicCommand.id]: {
13415
13690
  order: 1,
13691
+ gridLayout: {
13692
+ row: 2,
13693
+ column: 2
13694
+ },
13416
13695
  menuItemFactory: ItalicMenuItemFactory
13417
13696
  },
13418
13697
  [SetInlineFormatUnderlineCommand.id]: {
13419
13698
  order: 2,
13699
+ gridLayout: {
13700
+ row: 2,
13701
+ column: 3
13702
+ },
13420
13703
  menuItemFactory: UnderlineMenuItemFactory
13421
13704
  },
13422
13705
  [SetInlineFormatStrikethroughCommand.id]: {
13423
13706
  order: 3,
13707
+ gridLayout: {
13708
+ row: 2,
13709
+ column: 4
13710
+ },
13424
13711
  menuItemFactory: StrikeThroughMenuItemFactory
13425
13712
  },
13426
13713
  [SetInlineFormatSubscriptCommand.id]: {
13427
13714
  order: 4,
13715
+ gridLayout: {
13716
+ row: 2,
13717
+ column: 5
13718
+ },
13428
13719
  menuItemFactory: SubscriptMenuItemFactory
13429
13720
  },
13430
13721
  [SetInlineFormatSuperscriptCommand.id]: {
13431
13722
  order: 5,
13723
+ gridLayout: {
13724
+ row: 2,
13725
+ column: 6
13726
+ },
13432
13727
  menuItemFactory: SuperscriptMenuItemFactory
13433
13728
  },
13434
13729
  [SetParagraphNamedStyleCommand.id]: {
13435
13730
  order: 5.5,
13731
+ gridLayout: {
13732
+ row: 1,
13733
+ column: 1,
13734
+ columnSpan: 2,
13735
+ width: 100
13736
+ },
13436
13737
  menuItemFactory: HeadingSelectorMenuItemFactory
13437
13738
  },
13438
13739
  [SetInlineFormatFontSizeCommand.id]: {
13439
13740
  order: 6,
13741
+ gridLayout: {
13742
+ row: 1,
13743
+ column: 7,
13744
+ width: 64
13745
+ },
13440
13746
  menuItemFactory: FontSizeSelectorMenuItemFactory
13441
13747
  },
13442
13748
  [SetInlineFormatFontFamilyCommand.id]: {
13443
13749
  order: 7,
13750
+ gridLayout: {
13751
+ row: 1,
13752
+ column: 3,
13753
+ columnSpan: 4,
13754
+ width: 160
13755
+ },
13444
13756
  menuItemFactory: FontFamilySelectorMenuItemFactory
13445
13757
  },
13446
13758
  [SetInlineFormatTextColorCommand.id]: {
13447
13759
  order: 8,
13760
+ gridLayout: {
13761
+ row: 2,
13762
+ column: 7
13763
+ },
13448
13764
  menuItemFactory: TextColorSelectorMenuItemFactory,
13449
13765
  [ResetInlineFormatTextColorCommand.id]: {
13450
13766
  order: 0,
@@ -13453,6 +13769,10 @@ const menuSchema = {
13453
13769
  },
13454
13770
  [SetInlineFormatTextBackgroundColorCommand.id]: {
13455
13771
  order: 9,
13772
+ gridLayout: {
13773
+ row: 2,
13774
+ column: 8
13775
+ },
13456
13776
  menuItemFactory: BackgroundColorSelectorMenuItemFactory,
13457
13777
  [ResetInlineFormatTextBackgroundColorCommand.id]: {
13458
13778
  order: 0,
@@ -13463,32 +13783,66 @@ const menuSchema = {
13463
13783
  [RibbonStartGroup.LAYOUT]: {
13464
13784
  [AlignOperationCommand.id]: {
13465
13785
  order: 2,
13786
+ gridLayout: {
13787
+ row: 1,
13788
+ column: 1
13789
+ },
13466
13790
  menuItemFactory: AlignMenuItemFactory
13467
13791
  },
13468
13792
  [OrderListCommand.id]: {
13469
13793
  order: 7,
13794
+ gridLayout: {
13795
+ row: 2,
13796
+ column: 1
13797
+ },
13470
13798
  menuItemFactory: OrderListMenuItemFactory
13471
13799
  },
13472
13800
  [BulletListCommand.id]: {
13473
13801
  order: 8,
13802
+ gridLayout: {
13803
+ row: 1,
13804
+ column: 2
13805
+ },
13474
13806
  menuItemFactory: BulletListMenuItemFactory
13475
13807
  },
13476
13808
  [CheckListCommand.id]: {
13477
13809
  order: 9,
13810
+ gridLayout: {
13811
+ row: 2,
13812
+ column: 2
13813
+ },
13478
13814
  menuItemFactory: CheckListMenuItemFactory
13479
13815
  },
13480
13816
  [OpenHeaderFooterPanelCommand.id]: {
13481
13817
  order: 10,
13818
+ gridLayout: {
13819
+ row: 1,
13820
+ column: 3,
13821
+ rowSpan: 2,
13822
+ showLabel: true
13823
+ },
13482
13824
  menuItemFactory: HeaderFooterMenuItemFactory
13483
13825
  },
13484
13826
  [DocOpenPageSettingCommand.id]: {
13485
13827
  order: 12,
13828
+ gridLayout: {
13829
+ row: 1,
13830
+ column: 4,
13831
+ rowSpan: 2,
13832
+ showLabel: true
13833
+ },
13486
13834
  menuItemFactory: PageSettingMenuItemFactory
13487
13835
  }
13488
13836
  },
13489
13837
  [RibbonInsertGroup.MEDIA]: {
13490
13838
  [TABLE_MENU_ID]: {
13491
13839
  order: 2,
13840
+ gridLayout: {
13841
+ row: 1,
13842
+ column: 1,
13843
+ rowSpan: 2,
13844
+ showLabel: true
13845
+ },
13492
13846
  menuItemFactory: TableMenuFactory,
13493
13847
  [DocCreateTableOperation.id]: {
13494
13848
  order: 0,
@@ -13497,7 +13851,63 @@ const menuSchema = {
13497
13851
  },
13498
13852
  [HorizontalLineCommand.id]: {
13499
13853
  order: 3,
13854
+ gridLayout: {
13855
+ row: 1,
13856
+ column: 2,
13857
+ rowSpan: 2,
13858
+ showLabel: true
13859
+ },
13500
13860
  menuItemFactory: HorizontalLineFactory
13861
+ },
13862
+ [DOC_BREAKS_MENU_ID]: {
13863
+ order: 4,
13864
+ gridLayout: {
13865
+ row: 1,
13866
+ column: 3,
13867
+ rowSpan: 2,
13868
+ showLabel: true
13869
+ },
13870
+ menuItemFactory: BreaksMenuFactory,
13871
+ [InsertDocumentColumnBreakOperation.id]: {
13872
+ order: 0,
13873
+ menuItemFactory: InsertColumnBreakMenuFactory
13874
+ },
13875
+ [DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID]: {
13876
+ order: 1,
13877
+ menuItemFactory: InsertNextPageSectionBreakMenuFactory
13878
+ },
13879
+ [DOC_SECTION_BREAK_CONTINUOUS_MENU_ID]: {
13880
+ order: 2,
13881
+ menuItemFactory: InsertContinuousSectionBreakMenuFactory
13882
+ },
13883
+ [DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID]: {
13884
+ order: 3,
13885
+ menuItemFactory: InsertNextColumnSectionBreakMenuFactory
13886
+ },
13887
+ [DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID]: {
13888
+ order: 4,
13889
+ menuItemFactory: InsertEvenPageSectionBreakMenuFactory
13890
+ },
13891
+ [DOC_SECTION_BREAK_ODD_PAGE_MENU_ID]: {
13892
+ order: 5,
13893
+ menuItemFactory: InsertOddPageSectionBreakMenuFactory
13894
+ }
13895
+ },
13896
+ [DOC_INSERT_EMOJI_MENU_ID]: {
13897
+ order: 5,
13898
+ gridLayout: {
13899
+ row: 1,
13900
+ column: 4
13901
+ },
13902
+ menuItemFactory: EmojiPickerMenuItemFactory
13903
+ },
13904
+ [DOC_INSERT_SYMBOL_MENU_ID]: {
13905
+ order: 6,
13906
+ gridLayout: {
13907
+ row: 2,
13908
+ column: 4
13909
+ },
13910
+ menuItemFactory: SymbolPickerMenuItemFactory
13501
13911
  }
13502
13912
  },
13503
13913
  [ContextMenuPosition.MAIN_AREA]: {
@@ -13855,6 +14265,13 @@ const menuSchema = {
13855
14265
  order: 0,
13856
14266
  menuItemFactory: InsertDefaultTableMenuFactory
13857
14267
  }
14268
+ },
14269
+ format: {
14270
+ order: 3,
14271
+ [DocPasteCommand.id]: {
14272
+ order: 0,
14273
+ menuItemFactory: PasteMenuFactory
14274
+ }
13858
14275
  }
13859
14276
  },
13860
14277
  [DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID]: {
@@ -13984,8 +14401,12 @@ const menuSchema = {
13984
14401
  order: 1,
13985
14402
  menuItemFactory: CopyCurrentParagraphMenuItemFactory
13986
14403
  },
13987
- [DeleteCurrentParagraphCommand.id]: {
14404
+ [DocPasteCommand.id]: {
13988
14405
  order: 2,
14406
+ menuItemFactory: PasteMenuFactory
14407
+ },
14408
+ [DeleteCurrentParagraphCommand.id]: {
14409
+ order: 3,
13989
14410
  menuItemFactory: DeleteCurrentParagraphMenuItemFactory
13990
14411
  }
13991
14412
  },
@@ -14454,7 +14875,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
14454
14875
  };
14455
14876
  }
14456
14877
  attachPopupToRect(rect, popup, unitId) {
14457
- const currentRender = this._renderManagerService.getRenderById(unitId);
14878
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
14458
14879
  if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
14459
14880
  const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
14460
14881
  const { position, position$, disposable } = this._createRectPositionObserver(rect, currentRender);
@@ -14483,7 +14904,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
14483
14904
  * @returns disposable
14484
14905
  */
14485
14906
  attachPopupToObject(targetObject, popup, unitId) {
14486
- const currentRender = this._renderManagerService.getRenderById(unitId);
14907
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
14487
14908
  if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
14488
14909
  const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
14489
14910
  const { position, position$, disposable } = this._createObjectPositionObserver(targetObject, currentRender);
@@ -14515,7 +14936,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
14515
14936
  attachPopupToRange(range, popup, unitId) {
14516
14937
  if (!this._univerInstanceService.getUnit(unitId)) throw new Error(`Document not found, unitId: ${unitId}`);
14517
14938
  const { direction = "top", multipleDirection } = popup;
14518
- const currentRender = this._renderManagerService.getRenderById(unitId);
14939
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
14519
14940
  if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
14520
14941
  const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
14521
14942
  const { positions: bounds, positions$: bounds$, disposable } = this._createRangePositionObserver(range, currentRender);
@@ -14918,12 +15339,13 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
14918
15339
  const customRanges = (_this$_context$unit$g = (_this$_context$unit$g2 = this._context.unit.getSelfOrHeaderFooterModel(segmentId)) === null || _this$_context$unit$g2 === void 0 || (_this$_context$unit$g2 = _this$_context$unit$g2.getBody()) === null || _this$_context$unit$g2 === void 0 ? void 0 : _this$_context$unit$g2.customRanges) !== null && _this$_context$unit$g !== void 0 ? _this$_context$unit$g : [];
14919
15340
  const layouts = [];
14920
15341
  customRanges.forEach((range) => {
14921
- const rects = calcDocRangePositions$1({
15342
+ const textRange = {
14922
15343
  startOffset: range.startIndex,
14923
15344
  endOffset: range.endIndex + 1,
14924
15345
  collapsed: false,
14925
15346
  segmentId
14926
- }, this._documents, this._skeleton, segmentPage);
15347
+ };
15348
+ const rects = calcDocRangePositions$1(textRange, this._documents, this._skeleton, segmentPage);
14927
15349
  if (!rects) return null;
14928
15350
  layouts.push({
14929
15351
  customRange: range,
@@ -15384,7 +15806,7 @@ function DocSideMenuContent() {
15384
15806
  const fullDataStream = (_documentData$body$da = documentData === null || documentData === void 0 || (_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream) !== null && _documentData$body$da !== void 0 ? _documentData$body$da : "";
15385
15807
  const [activeId, setActiveId] = useState(void 0);
15386
15808
  const unitId = (_currentDoc$getUnitId = currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) !== null && _currentDoc$getUnitId !== void 0 ? _currentDoc$getUnitId : "";
15387
- const renderer = renderManagerService.getRenderById(unitId);
15809
+ const renderer = renderManagerService.getRenderUnitById(unitId);
15388
15810
  const title = documentData === null || documentData === void 0 ? void 0 : documentData.title;
15389
15811
  const docEventManagerService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocEventManagerService);
15390
15812
  const paragraphBounds = docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.paragraphBounds;
@@ -15426,7 +15848,8 @@ function DocSideMenuContent() {
15426
15848
  }).filter((item) => item === null || item === void 0 ? void 0 : item.text);
15427
15849
  const handleScroll = useEvent((params) => {
15428
15850
  const scrollTop = params.viewportScrollY;
15429
- const activeId = findActiveHeading(paragraphBounds, paragraphMap, scrollTop, scrollTop + canvasHeight / scaleY);
15851
+ const bottom = scrollTop + canvasHeight / scaleY;
15852
+ const activeId = findActiveHeading(paragraphBounds, paragraphMap, scrollTop, bottom);
15430
15853
  if (activeId) setActiveId(activeId);
15431
15854
  });
15432
15855
  const menus = (paragraphMenus === null || paragraphMenus === void 0 ? void 0 : paragraphMenus.find((p) => p.isTitle)) ? paragraphMenus : [...title ? [{
@@ -15553,7 +15976,7 @@ let DocUIController = class DocUIController extends Disposable {
15553
15976
  _initFocusHandler() {
15554
15977
  this.disposeWithMe(this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_DOC, (unitId) => {
15555
15978
  if (this._shouldPreserveEmbedFocus(unitId)) return;
15556
- this._injector.get(IRenderManagerService).getRenderById(unitId).with(DocSelectionRenderService).focus();
15979
+ this._injector.get(IRenderManagerService).getRenderUnitById(unitId).with(DocSelectionRenderService).focus();
15557
15980
  }));
15558
15981
  }
15559
15982
  _shouldPreserveEmbedFocus(unitId) {
@@ -15691,7 +16114,7 @@ function collectDocsTableLikeEmbedChildUnitIds(drawings, resolveChildUnitId) {
15691
16114
  const data = getDrawingData(drawing);
15692
16115
  const childUnitId = data ? (_resolveChildUnitId = resolveChildUnitId === null || resolveChildUnitId === void 0 ? void 0 : resolveChildUnitId(data)) !== null && _resolveChildUnitId !== void 0 ? _resolveChildUnitId : typeof data.childUnitId === "string" ? data.childUnitId : void 0 : void 0;
15693
16116
  const childType = typeof (data === null || data === void 0 ? void 0 : data.childType) === "number" ? data.childType : void 0;
15694
- if (!childUnitId || !isSheetLikeDocsCustomBlockChildType$1(childType)) return;
16117
+ if (!childUnitId || !isSheetLikeDocsCustomBlockChildType(childType)) return;
15695
16118
  childUnitIds.add(childUnitId);
15696
16119
  });
15697
16120
  return childUnitIds;
@@ -15780,10 +16203,10 @@ function resolveMaxScrollLeft(element, requestedMaxScrollLeft) {
15780
16203
  const MODERN_DOCS_CUSTOM_BLOCK_VIEWPORT_INSET = 10;
15781
16204
  function resolveDocsCustomBlockRenderViewport(params) {
15782
16205
  var _params$fallbackWidth, _params$fallbackHeigh, _params$contentHeight, _params$visibleCanvas, _params$pageMarginLef, _params$pageMarginRig, _params$contentWidth, _params$docsLeft, _params$visibleCanvas2;
15783
- const defaultSize = resolveDocsCustomBlockSize$1(params.childType);
16206
+ const defaultSize = resolveDocsCustomBlockSize(params.childType);
15784
16207
  const fallbackWidth = (_params$fallbackWidth = params.fallbackWidth) !== null && _params$fallbackWidth !== void 0 ? _params$fallbackWidth : defaultSize.width;
15785
16208
  const fallbackHeight = (_params$fallbackHeigh = params.fallbackHeight) !== null && _params$fallbackHeigh !== void 0 ? _params$fallbackHeigh : defaultSize.height;
15786
- const sheetLike = isSheetLikeDocsCustomBlockChildType$1(params.childType);
16209
+ const sheetLike = isSheetLikeDocsCustomBlockChildType(params.childType);
15787
16210
  const contentHeight = Number.isFinite(params.contentHeight) && ((_params$contentHeight = params.contentHeight) !== null && _params$contentHeight !== void 0 ? _params$contentHeight : 0) > 0 ? params.contentHeight : fallbackHeight;
15788
16211
  const visibleCanvasHeight = Number.isFinite(params.visibleCanvasHeight) && ((_params$visibleCanvas = params.visibleCanvasHeight) !== null && _params$visibleCanvas !== void 0 ? _params$visibleCanvas : 0) > 0 ? params.visibleCanvasHeight : void 0;
15789
16212
  const height = sheetLike ? contentHeight : fallbackHeight;
@@ -15809,7 +16232,8 @@ function resolveDocsCustomBlockRenderViewport(params) {
15809
16232
  width: layoutWidth
15810
16233
  };
15811
16234
  }
15812
- const inset = MODERN_DOCS_CUSTOM_BLOCK_VIEWPORT_INSET / (params.scale && params.scale > 0 ? params.scale : 1);
16235
+ const scale = params.scale && params.scale > 0 ? params.scale : 1;
16236
+ const inset = MODERN_DOCS_CUSTOM_BLOCK_VIEWPORT_INSET / scale;
15813
16237
  const docsLeft = (_params$docsLeft = params.docsLeft) !== null && _params$docsLeft !== void 0 ? _params$docsLeft : 0;
15814
16238
  const fallbackViewportLeft = docsLeft + inset;
15815
16239
  const fallbackViewportWidth = Math.max(0, pageWidth - inset * 2);
@@ -15835,7 +16259,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
15835
16259
  //#endregion
15836
16260
  //#region package.json
15837
16261
  var name = "@univerjs/docs-ui";
15838
- var version = "1.0.0-alpha.6";
16262
+ var version = "1.0.0-alpha.8";
15839
16263
 
15840
16264
  //#endregion
15841
16265
  //#region src/commands/commands/doc-paragraph-setting.command.ts
@@ -15913,19 +16337,27 @@ const DEFAULT_AVALIABLE_MENUS = [
15913
16337
  SetInlineFormatSubscriptCommand.id,
15914
16338
  SetInlineFormatSuperscriptCommand.id,
15915
16339
  SetInlineFormatTextColorCommand.id,
15916
- SetInlineFormatTextBackgroundColorCommand.id
16340
+ {
16341
+ id: SetInlineFormatTextBackgroundColorCommand.id,
16342
+ iconColor: "var(--univer-primary-600)"
16343
+ }
15917
16344
  ];
15918
16345
  function resolveFloatToolbarMenus(menuManagerService, avaliableMenus) {
15919
16346
  const floatToolbarMenus = menuManagerService.getMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION);
15920
16347
  const flatMenus = [...menuManagerService.getFlatMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION), ...menuManagerService.getFlatMenuByPositionKey(MenuManagerPosition.RIBBON)];
15921
16348
  const menus = [];
15922
- for (const key of avaliableMenus) {
15923
- const item = flatMenus.find((item) => item.key === key);
15924
- if (item) menus.push(item);
16349
+ const menuIds = avaliableMenus.map((config) => typeof config === "string" ? config : config.id);
16350
+ for (const config of avaliableMenus) {
16351
+ const menuId = typeof config === "string" ? config : config.id;
16352
+ const item = flatMenus.find((item) => item.key === menuId);
16353
+ if (item) menus.push(typeof config === "string" ? item : {
16354
+ ...item,
16355
+ iconColor: config.iconColor
16356
+ });
15925
16357
  }
15926
16358
  return {
15927
16359
  menus,
15928
- extraMenus: floatToolbarMenus.filter((item) => item.item && !avaliableMenus.includes(item.key))
16360
+ extraMenus: floatToolbarMenus.filter((item) => item.item && !menuIds.includes(item.key))
15929
16361
  };
15930
16362
  }
15931
16363
  function FloatToolbar(props) {
@@ -15950,7 +16382,10 @@ function FloatToolbar(props) {
15950
16382
  children: [
15951
16383
  menus.map((groupItem) => groupItem.item && /* @__PURE__ */ jsx("div", {
15952
16384
  className: "univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",
15953
- children: /* @__PURE__ */ jsx(ToolbarItem, { ...groupItem.item }, groupItem.key)
16385
+ children: /* @__PURE__ */ jsx(ToolbarItem, {
16386
+ ...groupItem.item,
16387
+ iconColor: groupItem.iconColor
16388
+ }, groupItem.key)
15954
16389
  }, groupItem.key)),
15955
16390
  extraMenus.length > 0 && /* @__PURE__ */ jsx("div", { className: "univer-my-1 univer-w-px univer-bg-gray-200 dark:univer-bg-gray-700" }),
15956
16391
  extraMenus.map((groupItem) => groupItem.item && /* @__PURE__ */ jsx("div", {
@@ -15996,7 +16431,7 @@ function getSegmentId(documentStyle, editArea, pageIndex, page) {
15996
16431
  }
15997
16432
  const DocHeaderFooterOptions = (props) => {
15998
16433
  var _segmentContext$segme, _segmentContext$segme2;
15999
- const docSelectionRenderService = useDependency(IRenderManagerService).getRenderById(props.unitId).with(DocSelectionRenderService);
16434
+ const docSelectionRenderService = useDependency(IRenderManagerService).getRenderUnitById(props.unitId).with(DocSelectionRenderService);
16000
16435
  const segmentContext = useObservable(docSelectionRenderService.segmentContext$, {
16001
16436
  segmentId: docSelectionRenderService.getSegment(),
16002
16437
  segmentPage: docSelectionRenderService.getSegmentPage()
@@ -16011,12 +16446,12 @@ function DocHeaderFooterOptionsContent(props) {
16011
16446
  const commandService = useDependency(ICommandService);
16012
16447
  const layoutService = useDependency(ILayoutService);
16013
16448
  const { unitId } = props;
16014
- const docSelectionRenderService = renderManagerService.getRenderById(unitId).with(DocSelectionRenderService);
16449
+ const docSelectionRenderService = renderManagerService.getRenderUnitById(unitId).with(DocSelectionRenderService);
16015
16450
  const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
16016
16451
  const getCurrentSectionContext = () => {
16017
16452
  var _renderManagerService, _docSkeletonManagerSe;
16018
16453
  const snapshot = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot();
16019
- const docSkeletonManagerService = (_renderManagerService = renderManagerService.getRenderById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService);
16454
+ const docSkeletonManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService);
16020
16455
  const page = docSkeletonManagerService === null || docSkeletonManagerService === void 0 || (_docSkeletonManagerSe = docSkeletonManagerService.getSkeleton) === null || _docSkeletonManagerSe === void 0 || (_docSkeletonManagerSe = _docSkeletonManagerSe.call(docSkeletonManagerService)) === null || _docSkeletonManagerSe === void 0 || (_docSkeletonManagerSe = _docSkeletonManagerSe.getSkeletonData()) === null || _docSkeletonManagerSe === void 0 ? void 0 : _docSkeletonManagerSe.pages[docSelectionRenderService.getSegmentPage()];
16021
16456
  return snapshot == null ? void 0 : {
16022
16457
  ...getDocPageSectionContext(snapshot, page),
@@ -16034,7 +16469,7 @@ function DocHeaderFooterOptionsContent(props) {
16034
16469
  };
16035
16470
  });
16036
16471
  const sectionContext = getCurrentSectionContext();
16037
- const referenceKey = getSectionHeaderFooterReferenceKey(((_renderManagerService2 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService2 === void 0 || (_renderManagerService2 = _renderManagerService2.with(DocSkeletonManagerService)) === null || _renderManagerService2 === void 0 || (_renderManagerService2 = _renderManagerService2.getViewModel()) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.getEditArea()) === DocumentEditArea.FOOTER ? "footer" : "header", getHeaderFooterVariant((_sectionContext$confi = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config) !== null && _sectionContext$confi !== void 0 ? _sectionContext$confi : {}, docSelectionRenderService.getSegmentPage(), sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.page));
16472
+ const referenceKey = getSectionHeaderFooterReferenceKey(((_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 || (_renderManagerService2 = _renderManagerService2.with(DocSkeletonManagerService)) === null || _renderManagerService2 === void 0 || (_renderManagerService2 = _renderManagerService2.getViewModel()) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.getEditArea()) === DocumentEditArea.FOOTER ? "footer" : "header", getHeaderFooterVariant((_sectionContext$confi = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config) !== null && _sectionContext$confi !== void 0 ? _sectionContext$confi : {}, docSelectionRenderService.getSegmentPage(), sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.page));
16038
16473
  const canLinkToPrevious = ((_sectionContext$secti = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.sectionIndex) !== null && _sectionContext$secti !== void 0 ? _sectionContext$secti : -1) > 0;
16039
16474
  const [linkedToPrevious, setLinkedToPrevious] = useState(canLinkToPrevious && !(sectionContext === null || sectionContext === void 0 || (_sectionContext$secti2 = sectionContext.section) === null || _sectionContext$secti2 === void 0 ? void 0 : _sectionContext$secti2[referenceKey]));
16040
16475
  const handleCheckboxChange = (val, type) => {
@@ -16045,7 +16480,7 @@ function DocHeaderFooterOptionsContent(props) {
16045
16480
  }));
16046
16481
  const sectionContext = getCurrentSectionContext();
16047
16482
  const documentStyle = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config;
16048
- const docSkeletonManagerService = (_renderManagerService3 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService);
16483
+ const docSkeletonManagerService = (_renderManagerService3 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService);
16049
16484
  const viewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
16050
16485
  if (documentStyle == null || viewModel == null) return;
16051
16486
  const editArea = viewModel.getEditArea();
@@ -16110,7 +16545,7 @@ function DocHeaderFooterOptionsContent(props) {
16110
16545
  var _renderManagerService4;
16111
16546
  const context = getCurrentSectionContext();
16112
16547
  if (!(context === null || context === void 0 ? void 0 : context.sectionId) || context.sectionIndex <= 0 || !docDataModel) return;
16113
- const kind = ((_renderManagerService4 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService4 === void 0 || (_renderManagerService4 = _renderManagerService4.with(DocSkeletonManagerService)) === null || _renderManagerService4 === void 0 || (_renderManagerService4 = _renderManagerService4.getViewModel()) === null || _renderManagerService4 === void 0 ? void 0 : _renderManagerService4.getEditArea()) === DocumentEditArea.FOOTER ? "footer" : "header";
16548
+ const kind = ((_renderManagerService4 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService4 === void 0 || (_renderManagerService4 = _renderManagerService4.with(DocSkeletonManagerService)) === null || _renderManagerService4 === void 0 || (_renderManagerService4 = _renderManagerService4.getViewModel()) === null || _renderManagerService4 === void 0 ? void 0 : _renderManagerService4.getEditArea()) === DocumentEditArea.FOOTER ? "footer" : "header";
16114
16549
  const currentVariant = getHeaderFooterVariant(context.config, docSelectionRenderService.getSegmentPage(), context.page);
16115
16550
  const key = getSectionHeaderFooterReferenceKey(kind, currentVariant);
16116
16551
  const segmentId = generateRandomId(6);
@@ -16600,7 +17035,7 @@ const useFirstParagraphLineSpacing = (paragraph) => {
16600
17035
  var _renderManagerService;
16601
17036
  const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
16602
17037
  if (!docDataModel) return;
16603
- return (_renderManagerService = renderManagerService.getRenderById(docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService).getSkeleton();
17038
+ return (_renderManagerService = renderManagerService.getRenderUnitById(docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService).getSkeleton();
16604
17039
  }, []);
16605
17040
  const stateChange$ = useMemo(() => new BehaviorSubject({}), []);
16606
17041
  const [spacingRule, setSpacingRuleInternal] = useState(() => {
@@ -16629,7 +17064,8 @@ const useFirstParagraphLineSpacing = (paragraph) => {
16629
17064
  const divideNode = glyphNode === null || glyphNode === void 0 ? void 0 : glyphNode.parent;
16630
17065
  const metrics = getLineSpacingMetrics(divideNode === null || divideNode === void 0 ? void 0 : divideNode.parent);
16631
17066
  const nextStoredLineSpacing = convertLineSpacingForRuleChange(convertDisplayLineSpacingToStoredValue(lineSpacing, spacingRule), spacingRule, v, metrics);
16632
- setLineSpacingInternal(convertStoredLineSpacingToDisplayValue(nextStoredLineSpacing, v));
17067
+ const nextDisplayLineSpacing = convertStoredLineSpacingToDisplayValue(nextStoredLineSpacing, v);
17068
+ setLineSpacingInternal(nextDisplayLineSpacing);
16633
17069
  setSpacingRuleInternal(v);
16634
17070
  stateChange$.next({
16635
17071
  spacingRule: v,
@@ -16901,14 +17337,16 @@ function isInSameLine(startNodePosition, endNodePosition) {
16901
17337
  }
16902
17338
  const SKIP_SYMBOLS = [DataStreamTreeTokenType.CUSTOM_BLOCK, DataStreamTreeTokenType.PARAGRAPH];
16903
17339
  let DocFloatMenuService = class DocFloatMenuService extends Disposable {
16904
- constructor(_context, _docSelectionManagerService, _docCanvasPopManagerService, _univerInstanceService, _docSelectionRenderService) {
17340
+ constructor(_context, _docSelectionManagerService, _docCanvasPopManagerService, _univerInstanceService, _docSelectionRenderService, _contextService) {
16905
17341
  super();
16906
17342
  this._context = _context;
16907
17343
  this._docSelectionManagerService = _docSelectionManagerService;
16908
17344
  this._docCanvasPopManagerService = _docCanvasPopManagerService;
16909
17345
  this._univerInstanceService = _univerInstanceService;
16910
17346
  this._docSelectionRenderService = _docSelectionRenderService;
17347
+ this._contextService = _contextService;
16911
17348
  _defineProperty(this, "_floatMenu", null);
17349
+ _defineProperty(this, "_suppressed", false);
16912
17350
  if (isInternalEditorID(this._context.unitId)) return;
16913
17351
  this._initSelectionChange();
16914
17352
  this.disposeWithMe(() => {
@@ -16921,6 +17359,11 @@ let DocFloatMenuService = class DocFloatMenuService extends Disposable {
16921
17359
  hideFloatMenu() {
16922
17360
  this._hideFloatMenu();
16923
17361
  }
17362
+ setSuppressed(suppressed) {
17363
+ if (this._suppressed === suppressed) return;
17364
+ this._suppressed = suppressed;
17365
+ if (suppressed) this._hideFloatMenu();
17366
+ }
16924
17367
  _initSelectionChange() {
16925
17368
  this.disposeWithMe(this._docSelectionRenderService.onSelectionStart$.subscribe(() => {
16926
17369
  this._hideFloatMenu();
@@ -16928,6 +17371,10 @@ let DocFloatMenuService = class DocFloatMenuService extends Disposable {
16928
17371
  this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe((selection) => {
16929
17372
  const { unitId, textRanges } = selection;
16930
17373
  if (unitId !== this._context.unitId) return;
17374
+ if (this._suppressed || this._contextService.getContextValue(FOCUSING_COMMON_DRAWINGS)) {
17375
+ this._hideFloatMenu();
17376
+ return;
17377
+ }
16931
17378
  const range = textRanges.length > 0 && textRanges.find((range) => !range.collapsed);
16932
17379
  if (range) {
16933
17380
  var _this$_floatMenu, _this$_floatMenu2;
@@ -16969,7 +17416,8 @@ DocFloatMenuService = __decorate([
16969
17416
  __decorateParam(1, Inject(DocSelectionManagerService)),
16970
17417
  __decorateParam(2, Inject(DocCanvasPopManagerService)),
16971
17418
  __decorateParam(3, Inject(IUniverInstanceService)),
16972
- __decorateParam(4, Inject(DocSelectionRenderService))
17419
+ __decorateParam(4, Inject(DocSelectionRenderService)),
17420
+ __decorateParam(5, IContextService)
16973
17421
  ], DocFloatMenuService);
16974
17422
  function isRangeInCodeBlock(documentDataModel, range) {
16975
17423
  var _documentDataModel$ge3, _documentDataModel$ge4;
@@ -17660,9 +18108,6 @@ const PARAGRAPH_MENU_HOVER_OPEN_DELAY = 800;
17660
18108
  const PARAGRAPH_MENU_HOVER_HIDE_DELAY = 240;
17661
18109
  const PARAGRAPH_MENU_HOVER_BRIDGE_EDGE_OVERLAP = 12;
17662
18110
  const PARAGRAPH_MENU_HOVER_BRIDGE_VERTICAL_PADDING = 8;
17663
- function getParagraphMenuTriggerClassName(visible) {
17664
- return clsx("univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-gray-200 univer-bg-white univer-px-2 univer-py-0 univer-shadow-sm univer-transition-colors hover:univer-bg-gray-50 hover:univer-shadow-md dark:!univer-border-gray-700 dark:!univer-bg-gray-900 dark:hover:!univer-bg-gray-800", { "univer-bg-gray-100 univer-shadow-md dark:!univer-bg-gray-800": visible });
17665
- }
17666
18111
  function shouldExecuteParagraphMenuMove(validatorService, context) {
17667
18112
  return validatorService.canMoveBlock(context);
17668
18113
  }
@@ -17796,6 +18241,7 @@ function getParagraphMenuBlockRangeCommandId(blockType) {
17796
18241
  }
17797
18242
  const PARAGRAPH_MENU_BLOCK_RANGE_COMMAND_IDS = new Set(PARAGRAPH_MENU_BLOCK_RANGE_TYPES.map((blockType) => getParagraphMenuBlockRangeCommandId(blockType)));
17798
18243
  const PARAGRAPH_MENU_SELECTION_COMMAND_IDS = /* @__PURE__ */ new Set([
18244
+ DocPasteCommand.id,
17799
18245
  BulletListCommand.id,
17800
18246
  OrderListCommand.id,
17801
18247
  CheckListCommand.id,
@@ -17889,6 +18335,7 @@ function getParagraphMenuHiddenItemIds(menuType, target, namedStyleType) {
17889
18335
  if (menuType === "doc.menu.paragraph-t.insert") return [];
17890
18336
  const hiddenIds = [...getParagraphMenuHiddenHeadingCommandIds(namedStyleType)];
17891
18337
  const blockType = (target === null || target === void 0 ? void 0 : target.kind) === "blockRange" ? (_target$blockRange2 = target.blockRange) === null || _target$blockRange2 === void 0 ? void 0 : _target$blockRange2.blockType : void 0;
18338
+ if ((target === null || target === void 0 ? void 0 : target.kind) !== "blockRange") hiddenIds.push(DocPasteCommand.id);
17892
18339
  if (blockType === DocumentBlockRangeType.CALLOUT) hiddenIds.push(getParagraphMenuBlockRangeCommandId(DocumentBlockRangeType.CODE), getParagraphMenuBlockRangeCommandId(DocumentBlockRangeType.QUOTE));
17893
18340
  else if (blockType === DocumentBlockRangeType.QUOTE || blockType === DocumentBlockRangeType.CODE) hiddenIds.push(getParagraphMenuBlockRangeCommandId(DocumentBlockRangeType.CALLOUT));
17894
18341
  return hiddenIds;
@@ -18085,6 +18532,7 @@ function getParagraphFormattingRange(target, paragraph) {
18085
18532
  return getTargetSelectionRange(target, paragraph);
18086
18533
  }
18087
18534
  function getParagraphMenuCommandTargetRange(commandId, targetRange, formattingRange) {
18535
+ if (commandId === DocPasteCommand.id) return targetRange;
18088
18536
  if (commandId && PARAGRAPH_MENU_SELECTION_COMMAND_IDS.has(commandId)) return formattingRange !== null && formattingRange !== void 0 ? formattingRange : targetRange;
18089
18537
  return targetRange !== null && targetRange !== void 0 ? targetRange : formattingRange;
18090
18538
  }
@@ -18104,6 +18552,17 @@ function getBlockSelectionRange(target, paragraph) {
18104
18552
  segmentId: paragraph === null || paragraph === void 0 ? void 0 : paragraph.segmentId
18105
18553
  };
18106
18554
  }
18555
+ function getBlockRangeClipboardTargetRange(commandId, target, paragraph) {
18556
+ if ((target === null || target === void 0 ? void 0 : target.kind) !== "blockRange") return null;
18557
+ if (commandId === DocPasteCommand.id) return {
18558
+ startOffset: target.moveRange.endOffset,
18559
+ endOffset: target.moveRange.endOffset,
18560
+ collapsed: true,
18561
+ segmentId: paragraph === null || paragraph === void 0 ? void 0 : paragraph.segmentId
18562
+ };
18563
+ if (commandId === DocCopyCurrentParagraphCommand.id || commandId === DocCutCurrentParagraphCommand.id) return getBlockSelectionRange(target, paragraph !== null && paragraph !== void 0 ? paragraph : void 0);
18564
+ return null;
18565
+ }
18107
18566
  function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18108
18567
  var _ref3, _ref4, _currentActiveTarget$, _doc$getBody$dataStre, _doc$getBody, _currentActiveTarget$2, _paragraphObj$paragra, _currentActiveTarget$3;
18109
18568
  const [visible, setVisible] = useState(false);
@@ -18124,7 +18583,6 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18124
18583
  const docClipboardService = useDependency(IDocClipboardService);
18125
18584
  const docContentInsertService = useDependency(DocContentInsertService);
18126
18585
  const docBlockMoveValidatorService = useDependency(DocBlockMoveValidatorService);
18127
- const clipboardInterfaceService = useDependency(IClipboardInterfaceService);
18128
18586
  const layoutService = useDependency(ILayoutService);
18129
18587
  const iconManager = useDependency(IconManager);
18130
18588
  const anchorRef = useRef(null);
@@ -18133,7 +18591,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18133
18591
  const handledSlashRequestNonceRef = useRef(0);
18134
18592
  const renderManagerService = useDependency(IRenderManagerService);
18135
18593
  const univerInstanceService = useDependency(IUniverInstanceService);
18136
- const renderUnit = renderManagerService.getRenderById(popup.unitId);
18594
+ const renderUnit = renderManagerService.getRenderUnitById(popup.unitId);
18137
18595
  const doc = univerInstanceService.getUnit(popup.unitId, UniverInstanceType.UNIVER_DOC);
18138
18596
  const docParagraphMenuService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocParagraphMenuService);
18139
18597
  const docEventManagerService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocEventManagerService);
@@ -18172,10 +18630,11 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18172
18630
  const boundingRect = (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.getBoundingClientRect();
18173
18631
  const left = ((_boundingRect$left = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.left) !== null && _boundingRect$left !== void 0 ? _boundingRect$left : 0) - 4;
18174
18632
  const right = (_boundingRect$right = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.right) !== null && _boundingRect$right !== void 0 ? _boundingRect$right : 0;
18633
+ const viewportWidth = (_anchorRef$current$ow = (_anchorRef$current2 = anchorRef.current) === null || _anchorRef$current2 === void 0 || (_anchorRef$current2 = _anchorRef$current2.ownerDocument.defaultView) === null || _anchorRef$current2 === void 0 ? void 0 : _anchorRef$current2.innerWidth) !== null && _anchorRef$current$ow !== void 0 ? _anchorRef$current$ow : window.innerWidth;
18175
18634
  setMenuDirection(getParagraphMenuPopupDirection(left, 212, 8, {
18176
18635
  anchorRight: right,
18177
18636
  direction,
18178
- viewportWidth: (_anchorRef$current$ow = (_anchorRef$current2 = anchorRef.current) === null || _anchorRef$current2 === void 0 || (_anchorRef$current2 = _anchorRef$current2.ownerDocument.defaultView) === null || _anchorRef$current2 === void 0 ? void 0 : _anchorRef$current2.innerWidth) !== null && _anchorRef$current$ow !== void 0 ? _anchorRef$current$ow : window.innerWidth
18637
+ viewportWidth
18179
18638
  }));
18180
18639
  const nextAnchorRect = {
18181
18640
  left,
@@ -18209,10 +18668,11 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18209
18668
  clearHideTimer();
18210
18669
  const latestTarget = (_docParagraphMenuServ = docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget) !== null && _docParagraphMenuServ !== void 0 ? _docParagraphMenuServ : activeTarget;
18211
18670
  setParagraphMenuInteractionActive(docParagraphMenuService, true);
18212
- targetRangeRef.current = latestTarget ? {
18671
+ const targetRange = latestTarget ? {
18213
18672
  ...latestTarget.menuRange,
18214
18673
  segmentId: activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.segmentId
18215
18674
  } : getParagraphMenuTargetRange(activeParagraphBound);
18675
+ targetRangeRef.current = targetRange;
18216
18676
  updateAnchorRect();
18217
18677
  setOpenMode(mode);
18218
18678
  setVisible(true);
@@ -18240,7 +18700,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18240
18700
  };
18241
18701
  const replaceSelection = (range) => {
18242
18702
  if (!range) return;
18243
- docSelectionManagerService.replaceTextRanges([range], false);
18703
+ docSelectionManagerService.replaceDocRanges([range], void 0, false);
18244
18704
  };
18245
18705
  const getCurrentTextRangesSnapshot = () => {
18246
18706
  var _docSelectionManagerS;
@@ -18248,7 +18708,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18248
18708
  };
18249
18709
  const restoreTextRanges = (ranges) => {
18250
18710
  if (!ranges) return;
18251
- docSelectionManagerService.replaceTextRanges(ranges, false);
18711
+ docSelectionManagerService.replaceDocRanges(ranges, void 0, false);
18252
18712
  };
18253
18713
  const executeResolvedCommand = (option, targetRange) => {
18254
18714
  const resolved = getParagraphMenuResolvedCommand(option, targetRange);
@@ -18319,7 +18779,19 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18319
18779
  }
18320
18780
  if ((latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.kind) === "blockRange") {
18321
18781
  var _latestTarget$blockRa;
18322
- if (commandId === getParagraphMenuBlockRangeCommandId((_latestTarget$blockRa = latestTarget.blockRange) === null || _latestTarget$blockRa === void 0 ? void 0 : _latestTarget$blockRa.blockType)) {
18782
+ const currentBlockCommandId = getParagraphMenuBlockRangeCommandId((_latestTarget$blockRa = latestTarget.blockRange) === null || _latestTarget$blockRa === void 0 ? void 0 : _latestTarget$blockRa.blockType);
18783
+ const clipboardRange = getBlockRangeClipboardTargetRange(commandId, latestTarget, activeParagraphBound);
18784
+ if (clipboardRange) {
18785
+ if (commandId === DocCopyCurrentParagraphCommand.id) await docClipboardService.copy(SliceBodyType.copy, [clipboardRange]);
18786
+ else if (commandId === DocCutCurrentParagraphCommand.id) await docClipboardService.cut([clipboardRange]);
18787
+ else {
18788
+ replaceSelection(clipboardRange);
18789
+ await executeResolvedCommand(option, clipboardRange);
18790
+ }
18791
+ finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
18792
+ return;
18793
+ }
18794
+ if (commandId === currentBlockCommandId) {
18323
18795
  await unwrapActiveBlockRange();
18324
18796
  finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
18325
18797
  return;
@@ -18395,7 +18867,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18395
18867
  /* @__PURE__ */ jsxs("div", {
18396
18868
  "data-u-comp": "paragraph-menu",
18397
18869
  ref: anchorRef,
18398
- className: getParagraphMenuTriggerClassName(visible),
18870
+ className: clsx("univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-gray-200 univer-bg-white univer-px-2 univer-py-0 univer-shadow-sm univer-transition-colors hover:univer-bg-gray-50 hover:univer-shadow-md dark:!univer-border-gray-700 dark:!univer-bg-gray-900 dark:hover:!univer-bg-gray-800", { "univer-bg-gray-100 univer-shadow-md dark:!univer-bg-gray-800": visible }),
18399
18871
  onMouseEnter: (e) => {
18400
18872
  var _popup$onPointerEnter;
18401
18873
  (_popup$onPointerEnter = popup.onPointerEnter) === null || _popup$onPointerEnter === void 0 || _popup$onPointerEnter.call(popup, e);
@@ -18567,15 +19039,17 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18567
19039
  return;
18568
19040
  }
18569
19041
  if (commandId === DocPasteCommand.id) {
18570
- docSelectionManagerService.replaceTextRanges([afterTableRange], false);
18571
- const clipboardItems = await clipboardInterfaceService.read();
18572
- await docClipboardService.paste(clipboardItems);
19042
+ docSelectionManagerService.replaceDocRanges([afterTableRange], void 0, false);
19043
+ await commandService.executeCommand(DocPasteCommand.id);
18573
19044
  finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
18574
19045
  return;
18575
19046
  }
18576
- if (commandId === DocTableDeleteTableCommand.id) docSelectionManagerService.replaceTextRanges([tableRange], false);
18577
- else if (params.id === "doc.menu.insert-bellow" || commandId !== "doc.menu.insert-bellow") docSelectionManagerService.replaceTextRanges([afterTableRange], false);
18578
- if (commandService && commandId) commandService.executeCommand(commandId, commandParams);
19047
+ if (commandId === DocTableDeleteTableCommand.id) docSelectionManagerService.replaceDocRanges([tableRange], void 0, false);
19048
+ else if (params.id === "doc.menu.insert-bellow" || commandId !== "doc.menu.insert-bellow") docSelectionManagerService.replaceDocRanges([afterTableRange], void 0, false);
19049
+ if (commandService && commandId) commandService.executeCommand(commandId, commandId === DocTableDeleteTableCommand.id ? {
19050
+ ...commandParams,
19051
+ targetRange: tableRange
19052
+ } : commandParams);
18579
19053
  finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
18580
19054
  return;
18581
19055
  }
@@ -18631,7 +19105,7 @@ function getSectionColumnGap(section) {
18631
19105
  var _section$columnProper2, _section$columnProper3;
18632
19106
  return (_section$columnProper2 = (_section$columnProper3 = section.columnProperties) === null || _section$columnProper3 === void 0 || (_section$columnProper3 = _section$columnProper3[0]) === null || _section$columnProper3 === void 0 ? void 0 : _section$columnProper3.paddingEnd) !== null && _section$columnProper2 !== void 0 ? _section$columnProper2 : DEFAULT_SECTION_COLUMN_GAP;
18633
19107
  }
18634
- function getSectionSettingValues(sections) {
19108
+ function getSectionSettingValues(sections, documentStyle) {
18635
19109
  return {
18636
19110
  columnCount: getCommonValue(sections.map(getSectionColumnCount)),
18637
19111
  columnGap: getCommonValue(sections.map(getSectionColumnGap)),
@@ -18642,6 +19116,38 @@ function getSectionSettingValues(sections) {
18642
19116
  sectionType: getCommonValue(sections.map((section) => {
18643
19117
  var _section$sectionType;
18644
19118
  return (_section$sectionType = section.sectionType) !== null && _section$sectionType !== void 0 ? _section$sectionType : SectionType.SECTION_TYPE_UNSPECIFIED;
19119
+ })),
19120
+ pageWidth: getCommonValue(sections.map((section) => {
19121
+ var _section$pageSize$wid, _section$pageSize, _documentStyle$pageSi;
19122
+ return (_section$pageSize$wid = (_section$pageSize = section.pageSize) === null || _section$pageSize === void 0 ? void 0 : _section$pageSize.width) !== null && _section$pageSize$wid !== void 0 ? _section$pageSize$wid : (_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width;
19123
+ })),
19124
+ pageHeight: getCommonValue(sections.map((section) => {
19125
+ var _section$pageSize$hei, _section$pageSize2, _documentStyle$pageSi2;
19126
+ return (_section$pageSize$hei = (_section$pageSize2 = section.pageSize) === null || _section$pageSize2 === void 0 ? void 0 : _section$pageSize2.height) !== null && _section$pageSize$hei !== void 0 ? _section$pageSize$hei : (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.height;
19127
+ })),
19128
+ pageOrient: getCommonValue(sections.map((section) => {
19129
+ var _section$pageOrient;
19130
+ return (_section$pageOrient = section.pageOrient) !== null && _section$pageOrient !== void 0 ? _section$pageOrient : documentStyle.pageOrient;
19131
+ })),
19132
+ marginTop: getCommonValue(sections.map((section) => {
19133
+ var _ref, _section$marginTop;
19134
+ return (_ref = (_section$marginTop = section.marginTop) !== null && _section$marginTop !== void 0 ? _section$marginTop : documentStyle.marginTop) !== null && _ref !== void 0 ? _ref : 0;
19135
+ })),
19136
+ marginBottom: getCommonValue(sections.map((section) => {
19137
+ var _ref2, _section$marginBottom;
19138
+ return (_ref2 = (_section$marginBottom = section.marginBottom) !== null && _section$marginBottom !== void 0 ? _section$marginBottom : documentStyle.marginBottom) !== null && _ref2 !== void 0 ? _ref2 : 0;
19139
+ })),
19140
+ marginLeft: getCommonValue(sections.map((section) => {
19141
+ var _ref3, _section$marginLeft;
19142
+ return (_ref3 = (_section$marginLeft = section.marginLeft) !== null && _section$marginLeft !== void 0 ? _section$marginLeft : documentStyle.marginLeft) !== null && _ref3 !== void 0 ? _ref3 : 0;
19143
+ })),
19144
+ marginRight: getCommonValue(sections.map((section) => {
19145
+ var _ref4, _section$marginRight;
19146
+ return (_ref4 = (_section$marginRight = section.marginRight) !== null && _section$marginRight !== void 0 ? _section$marginRight : documentStyle.marginRight) !== null && _ref4 !== void 0 ? _ref4 : 0;
19147
+ })),
19148
+ pageNumberStart: getCommonValue(sections.map((section) => {
19149
+ var _ref5, _section$pageNumberSt;
19150
+ return (_ref5 = (_section$pageNumberSt = section.pageNumberStart) !== null && _section$pageNumberSt !== void 0 ? _section$pageNumberSt : documentStyle.pageNumberStart) !== null && _ref5 !== void 0 ? _ref5 : 1;
18645
19151
  }))
18646
19152
  };
18647
19153
  }
@@ -18655,6 +19161,23 @@ function createSectionColumnUpdates(sections, documentStyle, change) {
18655
19161
  };
18656
19162
  });
18657
19163
  }
19164
+ function createSectionOrientationUpdates(sections, documentStyle, pageOrient) {
19165
+ return sections.map((section) => {
19166
+ var _ref6, _section$pageOrient2, _section$pageSize3;
19167
+ const currentOrient = (_ref6 = (_section$pageOrient2 = section.pageOrient) !== null && _section$pageOrient2 !== void 0 ? _section$pageOrient2 : documentStyle.pageOrient) !== null && _ref6 !== void 0 ? _ref6 : PageOrientType.PORTRAIT;
19168
+ const currentPageSize = (_section$pageSize3 = section.pageSize) !== null && _section$pageSize3 !== void 0 ? _section$pageSize3 : documentStyle.pageSize;
19169
+ return {
19170
+ sectionId: section.sectionId,
19171
+ config: {
19172
+ pageOrient,
19173
+ ...currentOrient !== pageOrient && (currentPageSize === null || currentPageSize === void 0 ? void 0 : currentPageSize.width) != null && currentPageSize.height != null ? { pageSize: {
19174
+ width: currentPageSize.height,
19175
+ height: currentPageSize.width
19176
+ } } : {}
19177
+ }
19178
+ };
19179
+ });
19180
+ }
18658
19181
  function getSelectedSections(documentDataModel, ranges) {
18659
19182
  const body = documentDataModel.getBody();
18660
19183
  if (!body || ranges.length === 0 || ranges.some((range) => Boolean(range.segmentId))) return [];
@@ -18668,14 +19191,24 @@ function getSelectedSections(documentDataModel, ranges) {
18668
19191
  });
18669
19192
  });
18670
19193
  }
19194
+ function navigateToSection(controller, documentDataModel, sections, sectionId) {
19195
+ const index = sections.findIndex((section) => section.sectionId === sectionId);
19196
+ if (!documentDataModel || index < 0) return;
19197
+ controller.navigateToSectionEnd(documentDataModel.getUnitId(), index === 0 ? 0 : sections[index - 1].startIndex + 1, sections[index].startIndex);
19198
+ }
18671
19199
  function useSectionSetting() {
19200
+ var _documentDataModel$ge;
18672
19201
  const commandService = useDependency(ICommandService);
18673
19202
  const instanceService = useDependency(IUniverInstanceService);
18674
19203
  const selectionManager = useDependency(DocSelectionManagerService);
19204
+ const controller = useDependency(DocSectionSettingController);
18675
19205
  const documentDataModel = useObservable(useMemo(() => instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), [instanceService]));
18676
19206
  const resolveSections = () => (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === DocumentFlavor.TRADITIONAL ? getSelectedSections(documentDataModel, selectionManager.getDocRanges()) : [];
18677
19207
  const sections = useObservable(documentDataModel ? () => combineLatest([selectionManager.textSelection$.pipe(startWith(void 0)), documentDataModel.change$.pipe(startWith(void 0))]).pipe(map(resolveSections)) : null, resolveSections(), false, [documentDataModel, selectionManager]);
18678
- const values = getSectionSettingValues(sections);
19208
+ const documentStyle = (_documentDataModel$ge = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle()) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : {};
19209
+ const values = getSectionSettingValues(sections, documentStyle);
19210
+ const body = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getBody();
19211
+ const allSections = (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === DocumentFlavor.TRADITIONAL && body ? getTopLevelSectionBreaks(body) : [];
18679
19212
  const update = (updates) => {
18680
19213
  if (!documentDataModel || updates.length === 0) return Promise.resolve(false);
18681
19214
  return commandService.executeCommand(UpdateDocumentSectionCommand.id, {
@@ -18690,7 +19223,15 @@ function useSectionSetting() {
18690
19223
  return {
18691
19224
  valid: Boolean(documentDataModel && sections.length > 0),
18692
19225
  selectedCount: sections.length,
19226
+ sectionOptions: allSections.map((section, index) => ({
19227
+ label: `#${index + 1}`,
19228
+ value: section.sectionId
19229
+ })),
19230
+ selectedSectionId: sections.length === 1 ? sections[0].sectionId : void 0,
18693
19231
  ...values,
19232
+ selectSection(sectionId) {
19233
+ navigateToSection(controller, documentDataModel !== null && documentDataModel !== void 0 ? documentDataModel : void 0, allSections, sectionId);
19234
+ },
18694
19235
  setColumnCount(value) {
18695
19236
  const next = Math.max(1, Math.round(value));
18696
19237
  return update(documentDataModel ? createSectionColumnUpdates(sections, documentDataModel.getDocumentStyle(), { columnCount: next }) : []);
@@ -18704,6 +19245,44 @@ function useSectionSetting() {
18704
19245
  },
18705
19246
  setSectionType(value) {
18706
19247
  return updateAll({ sectionType: value });
19248
+ },
19249
+ setPageWidth(value) {
19250
+ return update(sections.map((section) => ({
19251
+ sectionId: section.sectionId,
19252
+ config: { pageSize: {
19253
+ ...documentStyle.pageSize,
19254
+ ...section.pageSize,
19255
+ width: Math.max(1, value)
19256
+ } }
19257
+ })));
19258
+ },
19259
+ setPageHeight(value) {
19260
+ return update(sections.map((section) => ({
19261
+ sectionId: section.sectionId,
19262
+ config: { pageSize: {
19263
+ ...documentStyle.pageSize,
19264
+ ...section.pageSize,
19265
+ height: Math.max(1, value)
19266
+ } }
19267
+ })));
19268
+ },
19269
+ setPageOrient(value) {
19270
+ return update(createSectionOrientationUpdates(sections, documentStyle, value));
19271
+ },
19272
+ setMarginTop(value) {
19273
+ return updateAll({ marginTop: Math.max(0, value) });
19274
+ },
19275
+ setMarginBottom(value) {
19276
+ return updateAll({ marginBottom: Math.max(0, value) });
19277
+ },
19278
+ setMarginLeft(value) {
19279
+ return updateAll({ marginLeft: Math.max(0, value) });
19280
+ },
19281
+ setMarginRight(value) {
19282
+ return updateAll({ marginRight: Math.max(0, value) });
19283
+ },
19284
+ setPageNumberStart(value) {
19285
+ return updateAll({ pageNumberStart: Math.max(1, Math.round(value)) });
18707
19286
  }
18708
19287
  };
18709
19288
  }
@@ -18714,9 +19293,9 @@ function SettingRow(props) {
18714
19293
  return /* @__PURE__ */ jsxs("div", {
18715
19294
  className: "univer-grid univer-min-h-8 univer-items-center univer-gap-3",
18716
19295
  style: { gridTemplateColumns: "minmax(0, 1fr) minmax(140px, 160px)" },
18717
- children: [/* @__PURE__ */ jsx("div", {
19296
+ children: [/* @__PURE__ */ jsxs("div", {
18718
19297
  className: "univer-min-w-0 univer-text-xs univer-leading-5 univer-text-gray-900 dark:!univer-text-gray-100",
18719
- children: props.label
19298
+ children: [props.label, props.unit]
18720
19299
  }), /* @__PURE__ */ jsx("div", {
18721
19300
  className: "univer-w-full univer-min-w-0",
18722
19301
  children: props.children
@@ -18724,27 +19303,11 @@ function SettingRow(props) {
18724
19303
  });
18725
19304
  }
18726
19305
  function SectionSetting() {
19306
+ var _setting$selectedSect;
18727
19307
  const localeService = useDependency(LocaleService);
18728
19308
  const controller = useDependency(DocSectionSettingController);
18729
19309
  const setting = useSectionSetting();
18730
- const labels = useMemo(() => ({
18731
- selectedSections: localeService.t("docs-ui.doc.sectionSetting.selectedSections", String(setting.selectedCount)),
18732
- columnCount: localeService.t("docs-ui.doc.sectionSetting.columnCount"),
18733
- columnGap: `${localeService.t("docs-ui.doc.sectionSetting.columnGap")}(px)`,
18734
- columnSeparator: localeService.t("docs-ui.doc.sectionSetting.columnSeparator"),
18735
- none: localeService.t("docs-ui.doc.sectionSetting.none"),
18736
- betweenColumns: localeService.t("docs-ui.doc.sectionSetting.betweenColumns"),
18737
- sectionStart: localeService.t("docs-ui.doc.sectionSetting.sectionStart"),
18738
- unspecified: localeService.t("docs-ui.doc.sectionSetting.unspecified"),
18739
- continuous: localeService.t("docs-ui.doc.sectionSetting.continuous"),
18740
- nextPage: localeService.t("docs-ui.doc.sectionSetting.nextPage"),
18741
- evenPage: localeService.t("docs-ui.doc.sectionSetting.evenPage"),
18742
- oddPage: localeService.t("docs-ui.doc.sectionSetting.oddPage")
18743
- }), [
18744
- useObservable(localeService.currentLocale$),
18745
- localeService,
18746
- setting.selectedCount
18747
- ]);
19310
+ useObservable(localeService.currentLocale$);
18748
19311
  useEffect(() => {
18749
19312
  if (!setting.valid) controller.closePanel();
18750
19313
  }, [controller, setting.valid]);
@@ -18753,13 +19316,27 @@ function SectionSetting() {
18753
19316
  className: "univer-box-border univer-w-full",
18754
19317
  children: [setting.selectedCount > 1 && /* @__PURE__ */ jsx("div", {
18755
19318
  className: "univer-mb-4 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-300",
18756
- children: labels.selectedSections
19319
+ children: localeService.t("docs-ui.doc.sectionSetting.selectedSections", `${setting.selectedCount}`)
18757
19320
  }), /* @__PURE__ */ jsxs("div", {
18758
19321
  className: "univer-grid univer-gap-3",
18759
19322
  children: [
18760
19323
  /* @__PURE__ */ jsx(SettingRow, {
18761
- label: labels.columnCount,
19324
+ label: localeService.t("docs-ui.doc.slider.sectionSetting"),
19325
+ children: /* @__PURE__ */ jsx(Select, {
19326
+ className: "univer-w-full",
19327
+ value: (_setting$selectedSect = setting.selectedSectionId) !== null && _setting$selectedSect !== void 0 ? _setting$selectedSect : "",
19328
+ options: [...setting.selectedSectionId == null ? [{
19329
+ label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
19330
+ value: "",
19331
+ disabled: true
19332
+ }] : [], ...setting.sectionOptions],
19333
+ onChange: setting.selectSection
19334
+ })
19335
+ }),
19336
+ /* @__PURE__ */ jsx(SettingRow, {
19337
+ label: localeService.t("docs-ui.doc.sectionSetting.columnCount"),
18762
19338
  children: /* @__PURE__ */ jsx(InputNumber, {
19339
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.columnCount"),
18763
19340
  className: "univer-w-full",
18764
19341
  min: 1,
18765
19342
  max: 12,
@@ -18770,8 +19347,10 @@ function SectionSetting() {
18770
19347
  })
18771
19348
  }),
18772
19349
  /* @__PURE__ */ jsx(SettingRow, {
18773
- label: labels.columnGap,
19350
+ label: localeService.t("docs-ui.doc.sectionSetting.columnGap"),
19351
+ unit: " (px)",
18774
19352
  children: /* @__PURE__ */ jsx(InputNumber, {
19353
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.columnGap"),
18775
19354
  className: "univer-w-full",
18776
19355
  min: 0,
18777
19356
  max: 1e3,
@@ -18782,49 +19361,183 @@ function SectionSetting() {
18782
19361
  })
18783
19362
  }),
18784
19363
  /* @__PURE__ */ jsx(SettingRow, {
18785
- label: labels.columnSeparator,
19364
+ label: localeService.t("docs-ui.doc.sectionSetting.columnSeparator"),
18786
19365
  children: /* @__PURE__ */ jsx(Select, {
18787
19366
  className: "univer-w-full",
18788
- value: setting.separatorType == null ? "" : String(setting.separatorType),
18789
- options: [{
18790
- label: labels.none,
18791
- value: String(ColumnSeparatorType.NONE)
18792
- }, {
18793
- label: labels.betweenColumns,
18794
- value: String(ColumnSeparatorType.BETWEEN_EACH_COLUMN)
18795
- }],
19367
+ value: setting.separatorType == null ? "" : `${setting.separatorType}`,
19368
+ options: [
19369
+ ...setting.separatorType == null ? [{
19370
+ label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
19371
+ value: "",
19372
+ disabled: true
19373
+ }] : [],
19374
+ {
19375
+ label: localeService.t("docs-ui.doc.sectionSetting.none"),
19376
+ value: `${ColumnSeparatorType.NONE}`
19377
+ },
19378
+ {
19379
+ label: localeService.t("docs-ui.doc.sectionSetting.betweenColumns"),
19380
+ value: `${ColumnSeparatorType.BETWEEN_EACH_COLUMN}`
19381
+ }
19382
+ ],
18796
19383
  onChange: (value) => setting.setSeparatorType(Number(value))
18797
19384
  })
18798
19385
  }),
18799
19386
  /* @__PURE__ */ jsx(SettingRow, {
18800
- label: labels.sectionStart,
19387
+ label: localeService.t("docs-ui.doc.sectionSetting.sectionStart"),
18801
19388
  children: /* @__PURE__ */ jsx(Select, {
18802
19389
  className: "univer-w-full",
18803
- value: setting.sectionType == null ? "" : String(setting.sectionType),
19390
+ value: setting.sectionType == null ? "" : `${setting.sectionType}`,
18804
19391
  options: [
19392
+ ...setting.sectionType == null ? [{
19393
+ label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
19394
+ value: "",
19395
+ disabled: true
19396
+ }] : [],
18805
19397
  {
18806
- label: labels.unspecified,
18807
- value: String(SectionType.SECTION_TYPE_UNSPECIFIED)
19398
+ label: localeService.t("docs-ui.doc.sectionSetting.unspecified"),
19399
+ value: `${SectionType.SECTION_TYPE_UNSPECIFIED}`
18808
19400
  },
18809
19401
  {
18810
- label: labels.continuous,
18811
- value: String(SectionType.CONTINUOUS)
19402
+ label: localeService.t("docs-ui.doc.sectionSetting.continuous"),
19403
+ value: `${SectionType.CONTINUOUS}`
18812
19404
  },
18813
19405
  {
18814
- label: labels.nextPage,
18815
- value: String(SectionType.NEXT_PAGE)
19406
+ label: localeService.t("docs-ui.doc.sectionSetting.nextColumn"),
19407
+ value: `${SectionType.NEXT_COLUMN}`
18816
19408
  },
18817
19409
  {
18818
- label: labels.evenPage,
18819
- value: String(SectionType.EVEN_PAGE)
19410
+ label: localeService.t("docs-ui.doc.sectionSetting.nextPage"),
19411
+ value: `${SectionType.NEXT_PAGE}`
18820
19412
  },
18821
19413
  {
18822
- label: labels.oddPage,
18823
- value: String(SectionType.ODD_PAGE)
19414
+ label: localeService.t("docs-ui.doc.sectionSetting.evenPage"),
19415
+ value: `${SectionType.EVEN_PAGE}`
19416
+ },
19417
+ {
19418
+ label: localeService.t("docs-ui.doc.sectionSetting.oddPage"),
19419
+ value: `${SectionType.ODD_PAGE}`
18824
19420
  }
18825
19421
  ],
18826
19422
  onChange: (value) => setting.setSectionType(Number(value))
18827
19423
  })
19424
+ }),
19425
+ /* @__PURE__ */ jsx("div", {
19426
+ className: "univer-pt-2 univer-text-sm univer-font-medium",
19427
+ children: localeService.t("docs-ui.doc.sectionSetting.pageSetup")
19428
+ }),
19429
+ /* @__PURE__ */ jsx(SettingRow, {
19430
+ label: localeService.t("docs-ui.doc.sectionSetting.pageWidth"),
19431
+ unit: " (px)",
19432
+ children: /* @__PURE__ */ jsx(InputNumber, {
19433
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.pageWidth"),
19434
+ className: "univer-w-full",
19435
+ min: 1,
19436
+ step: 1,
19437
+ precision: 1,
19438
+ value: setting.pageWidth,
19439
+ onChange: (value) => value != null && setting.setPageWidth(value)
19440
+ })
19441
+ }),
19442
+ /* @__PURE__ */ jsx(SettingRow, {
19443
+ label: localeService.t("docs-ui.doc.sectionSetting.pageHeight"),
19444
+ unit: " (px)",
19445
+ children: /* @__PURE__ */ jsx(InputNumber, {
19446
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.pageHeight"),
19447
+ className: "univer-w-full",
19448
+ min: 1,
19449
+ step: 1,
19450
+ precision: 1,
19451
+ value: setting.pageHeight,
19452
+ onChange: (value) => value != null && setting.setPageHeight(value)
19453
+ })
19454
+ }),
19455
+ /* @__PURE__ */ jsx(SettingRow, {
19456
+ label: localeService.t("docs-ui.page-settings.orientation"),
19457
+ children: /* @__PURE__ */ jsx(Select, {
19458
+ className: "univer-w-full",
19459
+ value: setting.pageOrient == null ? "" : `${setting.pageOrient}`,
19460
+ options: [
19461
+ ...setting.pageOrient == null ? [{
19462
+ label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
19463
+ value: "",
19464
+ disabled: true
19465
+ }] : [],
19466
+ {
19467
+ label: localeService.t("docs-ui.page-settings.portrait"),
19468
+ value: `${PageOrientType.PORTRAIT}`
19469
+ },
19470
+ {
19471
+ label: localeService.t("docs-ui.page-settings.landscape"),
19472
+ value: `${PageOrientType.LANDSCAPE}`
19473
+ }
19474
+ ],
19475
+ onChange: (value) => setting.setPageOrient(Number(value))
19476
+ })
19477
+ }),
19478
+ /* @__PURE__ */ jsx(SettingRow, {
19479
+ label: localeService.t("docs-ui.page-settings.top"),
19480
+ unit: " (px)",
19481
+ children: /* @__PURE__ */ jsx(InputNumber, {
19482
+ "aria-label": localeService.t("docs-ui.page-settings.top"),
19483
+ className: "univer-w-full",
19484
+ min: 0,
19485
+ step: 1,
19486
+ precision: 1,
19487
+ value: setting.marginTop,
19488
+ onChange: (value) => value != null && setting.setMarginTop(value)
19489
+ })
19490
+ }),
19491
+ /* @__PURE__ */ jsx(SettingRow, {
19492
+ label: localeService.t("docs-ui.page-settings.bottom"),
19493
+ unit: " (px)",
19494
+ children: /* @__PURE__ */ jsx(InputNumber, {
19495
+ "aria-label": localeService.t("docs-ui.page-settings.bottom"),
19496
+ className: "univer-w-full",
19497
+ min: 0,
19498
+ step: 1,
19499
+ precision: 1,
19500
+ value: setting.marginBottom,
19501
+ onChange: (value) => value != null && setting.setMarginBottom(value)
19502
+ })
19503
+ }),
19504
+ /* @__PURE__ */ jsx(SettingRow, {
19505
+ label: localeService.t("docs-ui.page-settings.left"),
19506
+ unit: " (px)",
19507
+ children: /* @__PURE__ */ jsx(InputNumber, {
19508
+ "aria-label": localeService.t("docs-ui.page-settings.left"),
19509
+ className: "univer-w-full",
19510
+ min: 0,
19511
+ step: 1,
19512
+ precision: 1,
19513
+ value: setting.marginLeft,
19514
+ onChange: (value) => value != null && setting.setMarginLeft(value)
19515
+ })
19516
+ }),
19517
+ /* @__PURE__ */ jsx(SettingRow, {
19518
+ label: localeService.t("docs-ui.page-settings.right"),
19519
+ unit: " (px)",
19520
+ children: /* @__PURE__ */ jsx(InputNumber, {
19521
+ "aria-label": localeService.t("docs-ui.page-settings.right"),
19522
+ className: "univer-w-full",
19523
+ min: 0,
19524
+ step: 1,
19525
+ precision: 1,
19526
+ value: setting.marginRight,
19527
+ onChange: (value) => value != null && setting.setMarginRight(value)
19528
+ })
19529
+ }),
19530
+ /* @__PURE__ */ jsx(SettingRow, {
19531
+ label: localeService.t("docs-ui.doc.sectionSetting.pageNumberStart"),
19532
+ children: /* @__PURE__ */ jsx(InputNumber, {
19533
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.pageNumberStart"),
19534
+ className: "univer-w-full",
19535
+ min: 1,
19536
+ step: 1,
19537
+ precision: 0,
19538
+ value: setting.pageNumberStart,
19539
+ onChange: (value) => value != null && setting.setPageNumberStart(value)
19540
+ })
18828
19541
  })
18829
19542
  ]
18830
19543
  })]
@@ -18929,6 +19642,7 @@ let ComponentsController = class ComponentsController extends Disposable {
18929
19642
  AddImageIcon,
18930
19643
  BoldIcon,
18931
19644
  CopyDoubleIcon,
19645
+ ColumnIcon,
18932
19646
  CutIcon,
18933
19647
  DeleteColumnDoubleIcon,
18934
19648
  DeleteIcon,
@@ -18964,9 +19678,11 @@ let ComponentsController = class ComponentsController extends Disposable {
18964
19678
  RightInsertColumnDoubleIcon,
18965
19679
  RightJustifyingIcon,
18966
19680
  ShapeIcon,
19681
+ SmileIcon,
18967
19682
  StrikethroughIcon,
18968
19683
  SubscriptIcon,
18969
19684
  SuperscriptIcon,
19685
+ SymbolsIcon,
18970
19686
  TitleTypeIcon,
18971
19687
  SubtitleTypeIcon,
18972
19688
  TodoListDoubleIcon,
@@ -19068,7 +19784,7 @@ let DocAutoFormatController = class DocAutoFormatController extends Disposable {
19068
19784
  match: (context) => {
19069
19785
  const { selection, unit } = context;
19070
19786
  const { startNodePosition, endNodePosition } = selection;
19071
- const renderObject = this._renderManagerService.getRenderById(unit.getUnitId());
19787
+ const renderObject = this._renderManagerService.getRenderUnitById(unit.getUnitId());
19072
19788
  const skeleton = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton();
19073
19789
  if (skeleton == null) return false;
19074
19790
  if (startNodePosition && endNodePosition && isInSameTableCellData(skeleton, startNodePosition, endNodePosition)) return true;
@@ -19206,9 +19922,10 @@ var TextBubbleShape = class TextBubbleShape extends Shape {
19206
19922
  ctx.save();
19207
19923
  ctx.font = "13px Source Han Sans CN";
19208
19924
  const textWidth = ctx.measureText(text).width;
19925
+ const realInfoWidth = Math.min(textWidth + 2 * 6, 200);
19209
19926
  drawBubble(ctx, {
19210
19927
  height: 18,
19211
- width: Math.min(textWidth + 2 * 6, 200),
19928
+ width: realInfoWidth,
19212
19929
  radius: 4,
19213
19930
  fill: color,
19214
19931
  evented: false
@@ -19529,13 +20246,14 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19529
20246
  }));
19530
20247
  }
19531
20248
  _handleShiftMoveSelection(direction, granularity = "character") {
19532
- var _this$_renderManagerS, _docDataModel$getSelf, _body$dataStream$leng, _docDataModel$getCust;
20249
+ var _docDataModel$getSelf, _body$dataStream$leng, _docDataModel$getCust;
19533
20250
  const activeRange = this._textSelectionManagerService.getActiveTextRange();
19534
20251
  const allRanges = this._textSelectionManagerService.getTextRanges();
19535
20252
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
19536
20253
  if (docDataModel == null) return;
19537
- const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderById(docDataModel.getUnitId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getSkeleton();
19538
- const docObject = this._getDocObject();
20254
+ const currentRender = this._renderManagerService.getRenderUnitById(docDataModel.getUnitId());
20255
+ const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
20256
+ const docObject = currentRender ? neoGetDocObject(currentRender) : null;
19539
20257
  if (activeRange == null || skeleton == null || docObject == null) return;
19540
20258
  const { startOffset, endOffset, style, collapsed, direction: rangeDirection, segmentId, startNodePosition, endNodePosition, segmentPage } = activeRange;
19541
20259
  const normalizedSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : "";
@@ -19547,11 +20265,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19547
20265
  min = Math.min(min, range.startOffset);
19548
20266
  max = Math.max(max, range.endOffset);
19549
20267
  }
19550
- this._textSelectionManagerService.replaceTextRanges([{
20268
+ this._textSelectionManagerService.replaceDocRanges([{
19551
20269
  startOffset: direction === Direction.LEFT || direction === Direction.UP ? max : min,
19552
20270
  endOffset: direction === Direction.LEFT || direction === Direction.UP ? min : max,
19553
20271
  style
19554
- }], false);
20272
+ }], void 0, false);
19555
20273
  return;
19556
20274
  }
19557
20275
  const anchorOffset = collapsed ? startOffset : rangeDirection === RANGE_DIRECTION.FORWARD ? startOffset : endOffset;
@@ -19565,11 +20283,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19565
20283
  if (nextOffset == null || nextOffset === focusOffset) return;
19566
20284
  const normalizedNextOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, nextOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19567
20285
  if (normalizedNextOffset == null || normalizedNextOffset === focusOffset) return;
19568
- this._textSelectionManagerService.replaceTextRanges([{
20286
+ this._textSelectionManagerService.replaceDocRanges([{
19569
20287
  startOffset: anchorOffset,
19570
20288
  endOffset: normalizedNextOffset,
19571
20289
  style
19572
- }], false);
20290
+ }], void 0, false);
19573
20291
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), normalizedNextOffset);
19574
20292
  return;
19575
20293
  }
@@ -19579,11 +20297,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19579
20297
  const curGlyph = skeleton.findNodeByCharIndex(focusOffset, segmentId, segmentPage);
19580
20298
  focusOffset = direction === Direction.RIGHT ? focusOffset + curGlyph.count : focusOffset - ((_preGlyph$count = preGlyph === null || preGlyph === void 0 ? void 0 : preGlyph.count) !== null && _preGlyph$count !== void 0 ? _preGlyph$count : 0);
19581
20299
  focusOffset = Math.min(dataStreamLength - 2, Math.max(0, focusOffset));
19582
- this._textSelectionManagerService.replaceTextRanges([{
20300
+ this._textSelectionManagerService.replaceDocRanges([{
19583
20301
  startOffset: anchorOffset,
19584
20302
  endOffset: focusOffset,
19585
20303
  style
19586
- }], false);
20304
+ }], void 0, false);
19587
20305
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), focusOffset);
19588
20306
  } else {
19589
20307
  const focusGlyph = skeleton.findNodeByCharIndex(focusOffset, segmentId, segmentPage);
@@ -19593,32 +20311,33 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19593
20311
  if (newPos == null) {
19594
20312
  const newFocusOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === Direction.UP ? 0 : dataStreamLength - 2, direction, normalizedSegmentId, normalizedSegmentPage);
19595
20313
  if (newFocusOffset == null || newFocusOffset === focusOffset) return;
19596
- this._textSelectionManagerService.replaceTextRanges([{
20314
+ this._textSelectionManagerService.replaceDocRanges([{
19597
20315
  startOffset: anchorOffset,
19598
20316
  endOffset: newFocusOffset,
19599
20317
  style
19600
- }], false);
20318
+ }], void 0, false);
19601
20319
  return;
19602
20320
  }
19603
20321
  const newActiveRange = new NodePositionConvertToCursor(documentOffsetConfig, skeleton).getRangePointData(newPos, newPos).cursorList[0];
19604
20322
  const newFocusOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, newActiveRange.endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19605
20323
  if (newFocusOffset == null || newFocusOffset === focusOffset) return;
19606
- this._textSelectionManagerService.replaceTextRanges([{
20324
+ this._textSelectionManagerService.replaceDocRanges([{
19607
20325
  startOffset: anchorOffset,
19608
20326
  endOffset: newFocusOffset,
19609
20327
  style
19610
- }], false);
20328
+ }], void 0, false);
19611
20329
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), newFocusOffset);
19612
20330
  }
19613
20331
  }
19614
20332
  _handleMoveCursor(direction, granularity = "character") {
19615
- var _this$_renderManagerS2, _docDataModel$getSelf2, _body$dataStream$leng2, _docDataModel$getCust2;
20333
+ var _docDataModel$getSelf2, _body$dataStream$leng2, _docDataModel$getCust2;
19616
20334
  const activeRange = this._textSelectionManagerService.getActiveTextRange();
19617
20335
  const allRanges = this._textSelectionManagerService.getTextRanges();
19618
20336
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
19619
20337
  if (docDataModel == null) return false;
19620
- const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(docDataModel.getUnitId())) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSkeletonManagerService).getSkeleton();
19621
- const docObject = this._getDocObject();
20338
+ const currentRender = this._renderManagerService.getRenderUnitById(docDataModel.getUnitId());
20339
+ const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
20340
+ const docObject = currentRender ? neoGetDocObject(currentRender) : null;
19622
20341
  if (activeRange == null || skeleton == null || docObject == null || allRanges == null) return;
19623
20342
  const { startOffset, endOffset, style, collapsed, segmentId, startNodePosition, endNodePosition, segmentPage } = activeRange;
19624
20343
  const normalizedSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : "";
@@ -19642,11 +20361,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19642
20361
  if (cursor == null) return;
19643
20362
  cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, cursor, direction, normalizedSegmentId, normalizedSegmentPage);
19644
20363
  if (cursor == null) return;
19645
- this._textSelectionManagerService.replaceTextRanges([{
20364
+ this._textSelectionManagerService.replaceDocRanges([{
19646
20365
  startOffset: cursor,
19647
20366
  endOffset: cursor,
19648
20367
  style
19649
- }], false);
20368
+ }], void 0, false);
19650
20369
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
19651
20370
  return;
19652
20371
  }
@@ -19675,11 +20394,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19675
20394
  cursor = this._normalizeCursorOffset(body.dataStream, customRanges, cursor, direction);
19676
20395
  const normalizedCursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, cursor, direction, normalizedSegmentId, normalizedSegmentPage);
19677
20396
  if (normalizedCursor == null) return;
19678
- this._textSelectionManagerService.replaceTextRanges([{
20397
+ this._textSelectionManagerService.replaceDocRanges([{
19679
20398
  startOffset: normalizedCursor,
19680
20399
  endOffset: normalizedCursor,
19681
20400
  style
19682
- }], false);
20401
+ }], void 0, false);
19683
20402
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), normalizedCursor);
19684
20403
  } else {
19685
20404
  const startNode = skeleton.findNodeByCharIndex(startOffset, segmentId, segmentPage);
@@ -19691,21 +20410,21 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19691
20410
  if (collapsed) cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === Direction.UP ? 0 : dataStreamLength - 2, direction, normalizedSegmentId, normalizedSegmentPage);
19692
20411
  else cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === Direction.UP ? startOffset : endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19693
20412
  if (cursor == null) return;
19694
- this._textSelectionManagerService.replaceTextRanges([{
20413
+ this._textSelectionManagerService.replaceDocRanges([{
19695
20414
  startOffset: cursor,
19696
20415
  endOffset: cursor,
19697
20416
  style
19698
- }], false);
20417
+ }], void 0, false);
19699
20418
  return;
19700
20419
  }
19701
20420
  const newActiveRange = new NodePositionConvertToCursor(documentOffsetConfig, skeleton).getRangePointData(newPos, newPos).cursorList[0];
19702
20421
  const cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, newActiveRange.endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19703
20422
  if (cursor == null) return;
19704
- this._textSelectionManagerService.replaceTextRanges([{
20423
+ this._textSelectionManagerService.replaceDocRanges([{
19705
20424
  startOffset: cursor,
19706
20425
  endOffset: cursor,
19707
20426
  style
19708
- }], false);
20427
+ }], void 0, false);
19709
20428
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
19710
20429
  }
19711
20430
  }
@@ -20156,8 +20875,8 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
20156
20875
  return (parent === null || parent === void 0 ? void 0 : parent.page) === page && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 || (_parent$parent = _parent$parent.columns) === null || _parent$parent === void 0 ? void 0 : _parent$parent.includes(parent)) === true;
20157
20876
  }
20158
20877
  _scrollToFocusNodePosition(unitId, offset) {
20159
- var _this$_renderManagerS3;
20160
- const backScrollController = (_this$_renderManagerS3 = this._renderManagerService.getRenderById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(DocBackScrollRenderController);
20878
+ var _this$_renderManagerS;
20879
+ const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
20161
20880
  if (backScrollController == null) return;
20162
20881
  backScrollController.scrollToRange({
20163
20882
  startOffset: offset,
@@ -20165,9 +20884,6 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
20165
20884
  collapsed: true
20166
20885
  });
20167
20886
  }
20168
- _getDocObject() {
20169
- return getDocObject(this._univerInstanceService, this._renderManagerService);
20170
- }
20171
20887
  };
20172
20888
  DocMoveCursorController = __decorate([
20173
20889
  __decorateParam(0, IUniverInstanceService),
@@ -20435,7 +21151,7 @@ let DocEditorBridgeController = class DocEditorBridgeController extends Disposab
20435
21151
  disposableCollection.dispose();
20436
21152
  if (!unit) return;
20437
21153
  const unitId = unit.getUnitId();
20438
- const render = this._renderManagerService.getRenderById(unitId);
21154
+ const render = this._renderManagerService.getRenderUnitById(unitId);
20439
21155
  const canvasEle = render === null || render === void 0 ? void 0 : render.engine.getCanvas().getCanvasEle();
20440
21156
  if (canvasEle == null) return;
20441
21157
  const disposable = fromEvent(canvasEle, "mousedown").subscribe((evt) => {
@@ -20454,8 +21170,8 @@ let DocEditorBridgeController = class DocEditorBridgeController extends Disposab
20454
21170
  if (updateCommandList.includes(command.id)) {
20455
21171
  const { unitId } = command.params;
20456
21172
  if (this._editorService.isSheetEditor(unitId) || unitId !== this._context.unitId) return;
20457
- const editor = this._editorService.getEditor(unitId);
20458
- if (editor && !editor.params.scrollBar) this._resize(unitId);
21173
+ const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
21174
+ if (editorRenderConfig && !editorRenderConfig.scrollBar) this._resize(unitId);
20459
21175
  }
20460
21176
  }));
20461
21177
  }
@@ -20920,7 +21636,7 @@ let DocZoomRenderController = class DocZoomRenderController extends Disposable {
20920
21636
  this._initCommandExecutedListener();
20921
21637
  this._isSheetEditor = this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
20922
21638
  const currentSheet = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
20923
- const sheetRenderer = currentSheet && this._renderManagerService.getRenderById(currentSheet.getUnitId());
21639
+ const sheetRenderer = currentSheet && this._renderManagerService.getRenderUnitById(currentSheet.getUnitId());
20924
21640
  this._initTimer = window.setTimeout(() => {
20925
21641
  const zoomRatio = sheetRenderer && this._isSheetEditor ? sheetRenderer.scene.scaleX : getDocEffectiveZoomRatio(this._context.unit);
20926
21642
  this.updateViewZoom(zoomRatio, true);
@@ -21086,7 +21802,6 @@ let DocsRenderService = class DocsRenderService extends RxDisposable {
21086
21802
  this._init();
21087
21803
  }
21088
21804
  _init() {
21089
- this._renderManagerService.createRender$.pipe(takeUntil(this.dispose$)).subscribe((unitId) => this._createRenderWithId(unitId));
21090
21805
  this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_DOC).forEach((documentModel) => {
21091
21806
  var _this$_instanceSrv$ge;
21092
21807
  return this._createRenderer(documentModel, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(documentModel.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
@@ -21101,7 +21816,7 @@ let DocsRenderService = class DocsRenderService extends RxDisposable {
21101
21816
  this._createRenderWithId(unitId, doc);
21102
21817
  return;
21103
21818
  }
21104
- const renderer = this._renderManagerService.getRenderById(unitId);
21819
+ const renderer = this._renderManagerService.getRenderUnitById(unitId);
21105
21820
  if (renderer) this._syncRendererCanvas(renderer, doc);
21106
21821
  }
21107
21822
  _createRenderWithId(unitId, doc) {
@@ -21363,18 +22078,20 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends Plugin {
21363
22078
  DocParagraphSettingCommand,
21364
22079
  InnerPasteCommand,
21365
22080
  CutContentCommand,
21366
- ReplaceContentCommand,
21367
22081
  ReplaceSnapshotCommand,
21368
22082
  CoverContentCommand,
21369
22083
  SetDocZoomRatioCommand,
21370
22084
  DocSelectAllCommand,
21371
22085
  DocParagraphSettingPanelOperation,
21372
22086
  DocSectionSettingPanelOperation,
22087
+ InsertDocumentColumnBreakOperation,
22088
+ InsertDocumentSectionBreakOperation,
21373
22089
  MoveCursorOperation,
21374
22090
  MoveSelectionOperation,
21375
22091
  ReplaceTextRunsCommand,
21376
22092
  ReplaceSelectionCommand,
21377
22093
  InsertCustomRangeCommand,
22094
+ InsertSpecialCharacterCommand,
21378
22095
  SetParagraphNamedStyleCommand,
21379
22096
  QuickHeadingCommand,
21380
22097
  DocCopyCurrentParagraphCommand,
@@ -21518,7 +22235,7 @@ _defineProperty(UniverDocsUIPlugin, "pluginName", "DOC_UI_PLUGIN");
21518
22235
  _defineProperty(UniverDocsUIPlugin, "packageName", name);
21519
22236
  _defineProperty(UniverDocsUIPlugin, "version", version);
21520
22237
  UniverDocsUIPlugin = __decorate([
21521
- DependentOn(UniverRenderEnginePlugin, UniverDocsPlugin),
22238
+ DependentOn(UniverDocsPlugin, UniverRenderEnginePlugin),
21522
22239
  __decorateParam(1, Inject(Injector)),
21523
22240
  __decorateParam(2, IRenderManagerService),
21524
22241
  __decorateParam(3, ICommandService),
@@ -21599,7 +22316,7 @@ function useEditor(opts) {
21599
22316
  const editorService = useDependency(IEditorService);
21600
22317
  useLayoutEffect(() => {
21601
22318
  if (container.current) {
21602
- const initialDoc = typeof initialValue === "string" ? void 0 : Tools.deepClone(initialValue);
22319
+ const initialDoc = typeof initialValue === "string" ? RichTextBuilder.create().insertText(initialValue).getData() : Tools.deepClone(initialValue);
21603
22320
  const snapshot = {
21604
22321
  body: {
21605
22322
  dataStream: typeof initialValue === "string" ? `${initialValue}\r\n` : "\r\n",
@@ -21692,7 +22409,7 @@ const useEditorClickOutside = (editorId, containerRef, onClickOutside) => {
21692
22409
  */
21693
22410
  function useIsFocusing(editorId) {
21694
22411
  var _docSelectionRenderSe;
21695
- const renderer = useDependency(IRenderManagerService).getRenderById(editorId);
22412
+ const renderer = useDependency(IRenderManagerService).getRenderUnitById(editorId);
21696
22413
  const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
21697
22414
  const selections = useObservable(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.textSelectionInner$);
21698
22415
  return Boolean(((_docSelectionRenderSe = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : false) && (selections === null || selections === void 0 ? void 0 : selections.textRanges.some((r) => r.collapsed)));
@@ -21706,7 +22423,8 @@ function useKeyboardEvent(isNeed, config, editor) {
21706
22423
  const key = useMemo(() => generateRandomId(4), []);
21707
22424
  useEffect(() => {
21708
22425
  if (!editor || !isNeed || !config) return;
21709
- const operationId = `sheet.operation.editor-${editor.getEditorId()}-keyboard-${key}`;
22426
+ const editorId = editor.getEditorId();
22427
+ const operationId = `sheet.operation.editor-${editorId}-keyboard-${key}`;
21710
22428
  const d = new DisposableCollection();
21711
22429
  d.add(commandService.registerCommand({
21712
22430
  id: operationId,
@@ -21720,6 +22438,8 @@ function useKeyboardEvent(isNeed, config, editor) {
21720
22438
  return {
21721
22439
  id: operationId,
21722
22440
  binding: keyCode.metaKey ? keyCode.keyCode | keyCode.metaKey : keyCode.keyCode,
22441
+ eventPreconditions: keyCode.nativeTextEditorBehavior == null ? void 0 : (event) => event.target instanceof HTMLElement && event.target.id === `__editor_${editorId}`,
22442
+ nativeTextEditorBehavior: keyCode.nativeTextEditorBehavior,
21723
22443
  preconditions: () => true,
21724
22444
  priority: 901,
21725
22445
  staticParameters: {
@@ -21995,7 +22715,7 @@ const RichTextEditor = (props) => {
21995
22715
  autoFocus,
21996
22716
  isSingle
21997
22717
  });
21998
- const renderer = useDependency(IRenderManagerService).getRenderById(editorId);
22718
+ const renderer = useDependency(IRenderManagerService).getRenderUnitById(editorId);
21999
22719
  const selectionIsFocusing = useIsFocusing(editorId);
22000
22720
  const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
22001
22721
  const editorFocused = useObservable(editor ? () => {
@@ -22082,4 +22802,4 @@ const RichTextEditor = (props) => {
22082
22802
  };
22083
22803
 
22084
22804
  //#endregion
22085
- export { AfterSpaceCommand, AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignMenuItemFactory, AlignOperationCommand, AlignRightCommand, BackgroundColorSelectorMenuItemFactory, BoldMenuItemFactory, BreakLineCommand, BulletListCommand, ChangeListNestingLevelCommand, ChangeListNestingLevelType, ChangeListTypeCommand, CheckListCommand, CoverContentCommand, CreateDocTableCommand, CutContentCommand, DEFAULT_DOC_FIT_TO_WIDTH_OPTIONS, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX, DOCS_COMPONENT_DEFAULT_Z_INDEX, DOCS_COMPONENT_HEADER_LAYER_INDEX, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_UI_PLUGIN_CONFIG_KEY, DOCS_VIEW_KEY, DOC_CONTENT_INSERT_MENU_ID, DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, 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, DOC_VERTICAL_PADDING, DeleteCurrentParagraphCommand, DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, DocAutoFormatService, DocBackScrollRenderController, DocCanvasPopManagerService, DocClipboardPasteAdapterService, DocCopyCommand, DocCreateTableOperation, DocCutCommand, DocEventManagerService, DocFloatMenuService, DocHtmlExportService, DocIMEInputManagerService, DocPageLayoutService, DocParagraphMenuService, DocParagraphPlaceholderRenderController, DocPasteCommand, DocPrintInterceptorService, DocRenderController, DocSelectAllCommand, DocSelectionRenderService, DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand, DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand, DocTableTabCommand, DocUIController, DocViewScaleService, DocsRenderService, menuSchema as DocsUIMenuSchema, EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY, EMPTY_PARAGRAPH_MENU_ID, Editor, EditorService, EnterCommand, FLOAT_TEXT_STYLE_MENU_ID, FLOAT_TOOLBAR_MENU_POSITION, FloatTextStyleMenuItemFactory, FontFamilySelectorMenuItemFactory, FontSizeSelectorMenuItemFactory, HorizontalLineCommand, IDocClipboardPasteAdapterService, IDocClipboardService, IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator, IEditorService, IMEInputCommand, INSERT_BELLOW_MENU_ID, InnerPasteCommand, InsertCustomRangeCommand, ItalicMenuItemFactory, ListOperationCommand, MergeTwoParagraphCommand, MoveCursorOperation, MoveDocBlockCommand, MoveSelectionOperation, NORMAL_TEXT_SELECTION_PLUGIN_NAME, NodePositionConvertToCursor, NodePositionConvertToRectRange, OrderListCommand, ParagraphMenuInsertBelowSubmenuItemFactory, LarkPastePlugin as PastePluginLark, UniverPastePlugin as PastePluginUniver, WordPastePlugin as PastePluginWord, QuickListCommand, RectRange, ReplaceContentCommand, ReplaceSelectionCommand, ReplaceSnapshotCommand, ReplaceTextRunsCommand, ResetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextColorCommand, RichTextEditor, SetDocZoomRatioCommand, SetDocZoomRatioOperation, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatTextFillCommand, SetInlineFormatUnderlineCommand, SetParagraphNamedStyleCommand, StrikeThroughMenuItemFactory, SwitchDocModeCommand, TEXT_RANGE_LAYER_INDEX, TabCommand, TextColorSelectorMenuItemFactory, TextRange, ToggleCheckListCommand, UnderlineMenuItemFactory, UniverDocsUIPlugin, VIEWPORT_KEY, addCustomDecorationBySelectionFactory, addCustomDecorationFactory, buildMoveDocBlockActions, calcDocFitToWidthScale, calcDocRangePositions, collectDocsTableLikeEmbedChildUnitIds, convertBodyToHtml, convertPositionsToRectRanges, createDefaultDocsTableLikeCustomBlockBleedViewport, createDocsCustomBlockInsertMutation, createDocsCustomBlockRemoveMutation, createDocsCustomBlockSizeRefreshScheduler, createEditorUndoRedoKeyboardConfig, createEmbedDocsCustomBlockData, createInsertCustomBlockActions, createRemoveCustomBlockActions, deleteCustomDecorationFactory, disableMenuWhenHeaderFooterEditing, executeEditorUndoRedoCommand, genTableSource, generateParagraphs, getAnchorBounding, getCanvasOffsetByEngine, getCommandSkeleton, getCursorWhenDelete, getCutActionsFromDocRanges, getDocBlockRangeMenuId, getDocObject, getDocObjectById, getEmptyTableCell, getEmptyTableRow, getLineBounding, getListMarkerFallbackBound, getListParagraphContextMenuHit, getOneTextSelectionRange, getStyleInTextRange, getTableColumn, hasParagraphInTable, hideMenuWhenSelectionInBlockRange, isInSameTableCell, isSheetLikeDocsCustomBlockChildType, isTextRangeInAnyBlockRange, isValidRectRange, neoGetDocObject, normalizeDocFitToWidthOptions, resolveDocFitBaseWidth, resolveDocViewScale, resolveDocsCustomBlockRenderViewport, resolveDocsCustomBlockSize, resolveDocsTableLikeCustomBlockBleedViewport, resolveDocsTableLikeCustomBlockContentHeight, resolveDocsTableLikeCustomBlockContentWidth, scrollDocsTableLikeCustomBlockLive, shouldRefreshDocsCustomBlockSizeForCommand, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, whenDocAndEditorFocused };
22805
+ export { AfterSpaceCommand, AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignMenuItemFactory, AlignOperationCommand, AlignRightCommand, BackgroundColorSelectorMenuItemFactory, BoldMenuItemFactory, BreakLineCommand, BulletListCommand, ChangeListNestingLevelCommand, ChangeListNestingLevelType, ChangeListTypeCommand, CheckListCommand, CoverContentCommand, CreateDocTableCommand, CutContentCommand, DEFAULT_DOC_FIT_TO_WIDTH_OPTIONS, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX, DOCS_COMPONENT_DEFAULT_Z_INDEX, DOCS_COMPONENT_HEADER_LAYER_INDEX, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_UI_PLUGIN_CONFIG_KEY, DOCS_VIEW_KEY, DOC_CONTENT_INSERT_MENU_ID, DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA, DOC_CUSTOM_RANGE_CHROME_RADIUS, DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, 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, DOC_VERTICAL_PADDING, DeleteCurrentParagraphCommand, DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, DocAutoFormatService, DocBackScrollRenderController, DocCanvasPopManagerService, DocClipboardPasteAdapterService, DocCopyCommand, DocCreateTableOperation, DocCutCommand, DocEventManagerService, DocFloatMenuService, DocHtmlExportService, DocIMEInputManagerService, DocPageLayoutService, DocParagraphMenuService, DocParagraphPlaceholderRenderController, DocPasteCommand, DocPrintInterceptorService, DocRenderController, DocSelectAllCommand, DocSelectionRenderService, DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand, DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand, DocTableTabCommand, DocUIController, DocViewScaleService, DocsRenderService, menuSchema as DocsUIMenuSchema, EMPTY_PARAGRAPH_MENU_ID, Editor, EditorService, EnterCommand, FLOAT_TEXT_STYLE_MENU_ID, FLOAT_TOOLBAR_MENU_POSITION, FloatTextStyleMenuItemFactory, FontFamilySelectorMenuItemFactory, FontSizeSelectorMenuItemFactory, HorizontalLineCommand, IDocClipboardPasteAdapterService, IDocClipboardService, IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator, IEditorService, IMEInputCommand, INSERT_BELLOW_MENU_ID, InnerPasteCommand, InsertCustomRangeCommand, ItalicMenuItemFactory, ListOperationCommand, MergeTwoParagraphCommand, MoveCursorOperation, MoveDocBlockCommand, MoveSelectionOperation, NORMAL_TEXT_SELECTION_PLUGIN_NAME, NodePositionConvertToCursor, NodePositionConvertToRectRange, OrderListCommand, ParagraphMenuInsertBelowSubmenuItemFactory, LarkPastePlugin as PastePluginLark, UniverPastePlugin as PastePluginUniver, WordPastePlugin as PastePluginWord, QuickListCommand, RectRange, ReplaceSelectionCommand, ReplaceSnapshotCommand, ReplaceTextRunsCommand, ResetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextColorCommand, RichTextEditor, SetDocZoomRatioCommand, SetDocZoomRatioOperation, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatTextFillCommand, SetInlineFormatUnderlineCommand, SetParagraphNamedStyleCommand, StrikeThroughMenuItemFactory, SwitchDocModeCommand, TEXT_RANGE_LAYER_INDEX, TabCommand, TextColorSelectorMenuItemFactory, TextRange, ToggleCheckListCommand, UnderlineMenuItemFactory, UniverDocsUIPlugin, VIEWPORT_KEY, addCustomDecorationBySelectionFactory, addCustomDecorationFactory, buildMoveDocBlockActions, calcDocFitToWidthScale, calcDocRangePositions, collectDocsTableLikeEmbedChildUnitIds, convertBodyToHtml, convertPositionsToRectRanges, createDefaultDocsTableLikeCustomBlockBleedViewport, createDocsCustomBlockSizeRefreshScheduler, createEditorUndoRedoKeyboardConfig, deleteCustomDecorationFactory, disableMenuWhenHeaderFooterEditing, drawDocCustomRangeChrome, executeEditorUndoRedoCommand, genTableSource, generateParagraphs, getAnchorBounding, getCanvasOffsetByEngine, getCommandSkeleton, getCursorWhenDelete, getCutActionsFromDocRanges, getDocBlockRangeMenuId, getDocObjectById, getEmptyTableCell, getEmptyTableRow, getLineBounding, getListMarkerFallbackBound, getListParagraphContextMenuHit, getOneTextSelectionRange, getStyleInTextRange, getTableColumn, getTextRangeFromCharIndex, hasParagraphInTable, hideMenuWhenSelectionInBlockRange, isInSameTableCell, isTextRangeInAnyBlockRange, isValidRectRange, neoGetDocObject, normalizeDocFitToWidthOptions, resolveDocCustomRangeChromeTheme, resolveDocFitBaseWidth, resolveDocViewScale, resolveDocsCustomBlockRenderViewport, resolveDocsTableLikeCustomBlockBleedViewport, resolveDocsTableLikeCustomBlockContentHeight, resolveDocsTableLikeCustomBlockContentWidth, scrollDocsTableLikeCustomBlockLive, shouldRefreshDocsCustomBlockSizeForCommand, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, whenDocAndEditorFocused };