@univerjs/docs-ui 1.0.0-alpha.7 → 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 (101) hide show
  1. package/lib/cjs/index.js +747 -371
  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 +750 -329
  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 -0
  42. package/lib/index.js +750 -329
  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/commands/commands/clipboard.inner.command.d.ts +2 -0
  65. package/lib/types/commands/commands/replace-content.command.d.ts +10 -14
  66. package/lib/types/commands/operations/insert-break.operation.d.ts +21 -0
  67. package/lib/types/controllers/doc-move-cursor.controller.d.ts +0 -1
  68. package/lib/types/controllers/doc-section-setting.controller.d.ts +4 -1
  69. package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +11 -2
  70. package/lib/types/index.d.ts +10 -10
  71. package/lib/types/locale/en-US.d.ts +13 -0
  72. package/lib/types/menu/menu.d.ts +13 -0
  73. package/lib/types/services/clipboard/clipboard.service.d.ts +11 -2
  74. package/lib/types/services/clipboard/doc-paste-mutation-adapter.service.d.ts +6 -1
  75. package/lib/types/services/editor/editor-manager.service.d.ts +1 -0
  76. package/lib/types/services/editor/editor.d.ts +7 -26
  77. package/lib/types/services/selection/doc-selection-render.service.d.ts +0 -3
  78. package/lib/types/views/paragraph-setting/hook/utils.d.ts +2 -0
  79. package/lib/types/views/rich-text-editor/hooks/use-keyboard-event.d.ts +2 -1
  80. package/lib/types/views/section-setting/use-section-setting.d.ts +33 -2
  81. package/lib/umd/index.js +11 -10
  82. package/lib/umd/locale/ar-SA.js +1 -1
  83. package/lib/umd/locale/ca-ES.js +1 -1
  84. package/lib/umd/locale/de-DE.js +1 -1
  85. package/lib/umd/locale/en-US.js +1 -1
  86. package/lib/umd/locale/es-ES.js +1 -1
  87. package/lib/umd/locale/fa-IR.js +1 -1
  88. package/lib/umd/locale/fr-FR.js +1 -1
  89. package/lib/umd/locale/id-ID.js +1 -1
  90. package/lib/umd/locale/it-IT.js +1 -1
  91. package/lib/umd/locale/ja-JP.js +1 -1
  92. package/lib/umd/locale/ko-KR.js +1 -1
  93. package/lib/umd/locale/pl-PL.js +1 -1
  94. package/lib/umd/locale/pt-BR.js +1 -1
  95. package/lib/umd/locale/ru-RU.js +1 -1
  96. package/lib/umd/locale/sk-SK.js +1 -1
  97. package/lib/umd/locale/vi-VN.js +1 -1
  98. package/lib/umd/locale/zh-CN.js +1 -1
  99. package/lib/umd/locale/zh-HK.js +1 -1
  100. package/lib/umd/locale/zh-TW.js +1 -1
  101. package/package.json +9 -9
package/lib/es/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";
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
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
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
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, SmileIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, SymbolsIcon, 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,6 +133,29 @@ 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
153
161
  function isTopLevelStructuralGap(dataStream, offset) {
@@ -205,7 +213,7 @@ function getCustomDecorationAtPosition(customDecorations, position) {
205
213
  }
206
214
 
207
215
  //#endregion
208
- //#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
209
217
  function _typeof(o) {
210
218
  "@babel/helpers - typeof";
211
219
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -216,7 +224,7 @@ function _typeof(o) {
216
224
  }
217
225
 
218
226
  //#endregion
219
- //#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
220
228
  function toPrimitive(t, r) {
221
229
  if ("object" != _typeof(t) || !t) return t;
222
230
  var e = t[Symbol.toPrimitive];
@@ -229,14 +237,14 @@ function toPrimitive(t, r) {
229
237
  }
230
238
 
231
239
  //#endregion
232
- //#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
233
241
  function toPropertyKey(t) {
234
242
  var i = toPrimitive(t, "string");
235
243
  return "symbol" == _typeof(i) ? i : i + "";
236
244
  }
237
245
 
238
246
  //#endregion
239
- //#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
240
248
  function _defineProperty(e, r, t) {
241
249
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
242
250
  value: t,
@@ -247,7 +255,7 @@ function _defineProperty(e, r, t) {
247
255
  }
248
256
 
249
257
  //#endregion
250
- //#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
251
259
  function __decorateParam(paramIndex, decorator) {
252
260
  return function(target, key) {
253
261
  decorator(target, key, paramIndex);
@@ -255,7 +263,7 @@ function __decorateParam(paramIndex, decorator) {
255
263
  }
256
264
 
257
265
  //#endregion
258
- //#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
259
267
  function __decorate(decorators, target, key, desc) {
260
268
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
261
269
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -380,7 +388,7 @@ let DocMenuStyleService = class DocMenuStyleService extends Disposable {
380
388
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
381
389
  if (docDataModel == null) return { ...DEFAULT_TEXT_STYLE };
382
390
  const unitId = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId();
383
- 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);
384
392
  const docViewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
385
393
  if (docViewModel == null) return { ...DEFAULT_TEXT_STYLE };
386
394
  if (docViewModel.getEditArea() === DocumentEditArea.BODY) return { ...DEFAULT_TEXT_STYLE };
@@ -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
@@ -1082,7 +1090,7 @@ const InnerPasteCommand = {
1082
1090
  type: CommandType.COMMAND,
1083
1091
  handler: async (accessor, params) => {
1084
1092
  var _docDataModel$getSelf, _body$tables, _body$customBlocks, _body$blockRanges;
1085
- const { segmentId, textRanges, doc } = params;
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);
@@ -1127,6 +1135,11 @@ const InnerPasteCommand = {
1127
1135
  const cloneBody = Tools.deepClone(body);
1128
1136
  const blockRangeMappings = [];
1129
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);
1130
1143
  if (hasBlockRange) cloneBody.blockRanges.forEach((targetBlockRange, index) => {
1131
1144
  const sourceBlockRange = body.blockRanges[index];
1132
1145
  targetBlockRange.blockId = generateRandomId(6);
@@ -1168,7 +1181,7 @@ const InnerPasteCommand = {
1168
1181
  rawActions.push(orderAction);
1169
1182
  });
1170
1183
  }
1171
- if ((blockRangeMappings.length > 0 || customBlockMappings.length > 0) && pasteAdapterService) {
1184
+ if ((blockRangeMappings.length > 0 || customBlockMappings.length > 0 || selectionCustomRangeMappings.length > 0) && pasteAdapterService) {
1172
1185
  const mutationInfos = pasteAdapterService.getPasteMutationInfos({
1173
1186
  unitId,
1174
1187
  segmentId,
@@ -1176,6 +1189,7 @@ const InnerPasteCommand = {
1176
1189
  sourceBody: body,
1177
1190
  targetBody: cloneBody,
1178
1191
  blockRangeMappings,
1192
+ customRangeMappings: selectionCustomRangeMappings,
1179
1193
  customBlockMappings
1180
1194
  });
1181
1195
  if (mutationInfos.redoMutations.length > 0 || mutationInfos.undoMutations.length > 0) {
@@ -3746,12 +3760,12 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3746
3760
  }
3747
3761
  async copy(sliceType = SliceBodyType.copy, ranges) {
3748
3762
  var _this$_getDocumentBod;
3749
- 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 : {};
3750
3764
  if (newSnapshotList.length === 0 || snapshot == null) return false;
3751
3765
  try {
3752
3766
  var _allRanges$;
3753
3767
  const isCopyInHeaderFooter = !!(allRanges === null || allRanges === void 0 || (_allRanges$ = allRanges[0]) === null || _allRanges$ === void 0 ? void 0 : _allRanges$.segmentId);
3754
- await this._setClipboardData(newSnapshotList, !isCopyInHeaderFooter && needCache);
3768
+ await this._setClipboardData(newSnapshotList, !isCopyInHeaderFooter && needCache, plainTextList);
3755
3769
  } catch (e) {
3756
3770
  this._logService.error("[DocClipboardService] copy failed", e);
3757
3771
  return false;
@@ -3820,16 +3834,25 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3820
3834
  }
3821
3835
  }
3822
3836
  async _paste(docData) {
3823
- var _body$customRanges, _body$paragraphs, _currentDocument$getS;
3837
+ var _body$customRanges$ma, _body$customRanges, _body$paragraphs, _currentDocument$getS;
3824
3838
  const { body: _body } = docData;
3825
3839
  if (_body == null) return false;
3826
3840
  let body = normalizeBody(_body);
3827
3841
  const currentDocument = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3828
3842
  if (!currentDocument) return false;
3829
3843
  this._clipboardHooks.forEach((hook) => {
3830
- if (hook.onBeforePaste) body = hook.onBeforePaste(body);
3844
+ if (hook.onBeforePaste) body = hook.onBeforePaste(body, {
3845
+ documentData: docData,
3846
+ targetUnitId: currentDocument.getUnitId()
3847
+ });
3831
3848
  });
3832
- 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);
3833
3856
  (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 || _body$paragraphs.forEach((copy) => {
3834
3857
  var _copy$paragraphStyle;
3835
3858
  if ((_copy$paragraphStyle = copy.paragraphStyle) === null || _copy$paragraphStyle === void 0 ? void 0 : _copy$paragraphStyle.headingId) copy.paragraphStyle.headingId = generateRandomId(6);
@@ -3857,6 +3880,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3857
3880
  ...docData,
3858
3881
  body
3859
3882
  },
3883
+ customRangeMappings,
3860
3884
  segmentId,
3861
3885
  textRanges
3862
3886
  });
@@ -3865,10 +3889,10 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3865
3889
  return false;
3866
3890
  }
3867
3891
  }
3868
- async _setClipboardData(documentList, needCache = true) {
3892
+ async _setClipboardData(documentList, needCache = true, plainTextList) {
3869
3893
  var _documentList$0$body;
3870
3894
  const copyId = generateRandomId(6);
3871
- const text = (documentList.length > 1 ? documentList.map((doc) => {
3895
+ const text = (plainTextList ? plainTextList.join("\n") : documentList.length > 1 ? documentList.map((doc) => {
3872
3896
  var _doc$body;
3873
3897
  return ((_doc$body = doc.body) === null || _doc$body === void 0 ? void 0 : _doc$body.dataStream) || "";
3874
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, "");
@@ -3905,10 +3929,12 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3905
3929
  }, doc);
3906
3930
  }
3907
3931
  _getDocumentBodyInRanges(sliceType, ranges) {
3908
- var _docDataModel$getSelf;
3932
+ var _this$_clipboardHooks, _docDataModel$getSelf;
3909
3933
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3910
3934
  const allRanges = ranges !== null && ranges !== void 0 ? ranges : this._docSelectionManagerService.getDocRanges();
3911
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;
3912
3938
  let needCache = true;
3913
3939
  if (docDataModel == null || allRanges.length === 0) return;
3914
3940
  const segmentId = allRanges[0].segmentId;
@@ -3916,13 +3942,14 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3916
3942
  const snapshot = docDataModel.getSnapshot();
3917
3943
  if (body == null) return;
3918
3944
  for (const range of allRanges) {
3919
- var _docDataModel$getSelf2;
3945
+ var _docDataModel$getSelf2, _copyContentHook;
3920
3946
  const { startOffset, endOffset, collapsed, rangeType } = range;
3921
3947
  if (collapsed || startOffset == null || endOffset == null) continue;
3922
3948
  if (rangeType === DOC_RANGE_TYPE.RECT) {
3923
3949
  needCache = false;
3924
3950
  const bodySlice = getTableClipboardBodySlice(body, range);
3925
3951
  results.push(bodySlice);
3952
+ plainTextResults.push(bodySlice.dataStream);
3926
3953
  continue;
3927
3954
  }
3928
3955
  const deleteRange = {
@@ -3933,6 +3960,11 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3933
3960
  const docBody = (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.sliceBody(deleteRange.startOffset, deleteRange.endOffset, sliceType);
3934
3961
  if (docBody == null) continue;
3935
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);
3936
3968
  }
3937
3969
  return {
3938
3970
  newSnapshotList: results.map((e) => ({
@@ -3940,6 +3972,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3940
3972
  body: e
3941
3973
  })),
3942
3974
  needCache,
3975
+ plainTextList: plainTextResults,
3943
3976
  snapshot,
3944
3977
  ranges: allRanges
3945
3978
  };
@@ -3998,16 +4031,17 @@ let DocClipboardService = class DocClipboardService extends Disposable {
3998
4031
  return doc;
3999
4032
  }
4000
4033
  async _uploadBase64ImagesInHtml(html) {
4001
- var _this$_clipboardHooks;
4034
+ var _this$_clipboardHooks2;
4002
4035
  if (!html || !html.includes("data:image/")) return html;
4003
- 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;
4004
4037
  if (!onBeforePasteImage) return html;
4005
4038
  const doc = new DOMParser().parseFromString(html, "text/html");
4006
4039
  const images = Array.from(doc.querySelectorAll("img[src^=\"data:image/\"]"));
4007
4040
  if (images.length === 0) return html;
4008
4041
  await Promise.all(images.map(async (image, index) => {
4009
4042
  if (image.dataset.imageSourceType && image.dataset.imageSourceType !== ImageSourceType.BASE64) return;
4010
- 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);
4011
4045
  if (!uploaded) return;
4012
4046
  image.dataset.imageSourceType = uploaded.imageSourceType;
4013
4047
  if (uploaded.imageSourceType === ImageSourceType.UUID) {
@@ -4021,7 +4055,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
4021
4055
  return doc.documentElement.outerHTML;
4022
4056
  }
4023
4057
  async _createImagePasteHtml(files) {
4024
- var _this$_clipboardHooks2, _this$_clipboardHooks3;
4058
+ var _this$_clipboardHooks3, _this$_clipboardHooks4;
4025
4059
  const doc = {
4026
4060
  id: "",
4027
4061
  documentStyle: {},
@@ -4057,7 +4091,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
4057
4091
  };
4058
4092
  });
4059
4093
  };
4060
- 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;
4061
4095
  await Promise.all(files.map(async (file, index) => {
4062
4096
  var _body$customBlocks;
4063
4097
  const image = await onBeforePasteImage(file);
@@ -4801,7 +4835,7 @@ const IMEInputCommand = {
4801
4835
  const renderManagerService = accessor.get(IRenderManagerService);
4802
4836
  const univerInstanceService = accessor.get(IUniverInstanceService);
4803
4837
  const docMenuStyleService = accessor.get(DocMenuStyleService);
4804
- 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);
4805
4839
  const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
4806
4840
  if (docDataModel == null || imeInputManagerService == null) return false;
4807
4841
  const previousActiveRange = imeInputManagerService.getActiveRange();
@@ -4894,7 +4928,8 @@ const SetInlineFormatBoldCommand = {
4894
4928
  id: SetInlineFormatBoldCommandId,
4895
4929
  type: CommandType.COMMAND,
4896
4930
  handler: async (accessor, params) => {
4897
- return handleInlineFormat(SetInlineFormatBoldCommandId, params, accessor.get(ICommandService));
4931
+ const commandService = accessor.get(ICommandService);
4932
+ return handleInlineFormat(SetInlineFormatBoldCommandId, params, commandService);
4898
4933
  }
4899
4934
  };
4900
4935
  const SetInlineFormatItalicCommandId = "doc.command.set-inline-format-italic";
@@ -4902,7 +4937,8 @@ const SetInlineFormatItalicCommand = {
4902
4937
  id: SetInlineFormatItalicCommandId,
4903
4938
  type: CommandType.COMMAND,
4904
4939
  handler: async (accessor, params) => {
4905
- return handleInlineFormat(SetInlineFormatItalicCommandId, params, accessor.get(ICommandService));
4940
+ const commandService = accessor.get(ICommandService);
4941
+ return handleInlineFormat(SetInlineFormatItalicCommandId, params, commandService);
4906
4942
  }
4907
4943
  };
4908
4944
  const SetInlineFormatUnderlineCommandId = "doc.command.set-inline-format-underline";
@@ -4910,7 +4946,8 @@ const SetInlineFormatUnderlineCommand = {
4910
4946
  id: SetInlineFormatUnderlineCommandId,
4911
4947
  type: CommandType.COMMAND,
4912
4948
  handler: async (accessor, params) => {
4913
- return handleInlineFormat(SetInlineFormatUnderlineCommandId, params, accessor.get(ICommandService));
4949
+ const commandService = accessor.get(ICommandService);
4950
+ return handleInlineFormat(SetInlineFormatUnderlineCommandId, params, commandService);
4914
4951
  }
4915
4952
  };
4916
4953
  const SetInlineFormatStrikethroughCommandId = "doc.command.set-inline-format-strikethrough";
@@ -4918,7 +4955,8 @@ const SetInlineFormatStrikethroughCommand = {
4918
4955
  id: SetInlineFormatStrikethroughCommandId,
4919
4956
  type: CommandType.COMMAND,
4920
4957
  handler: async (accessor, params) => {
4921
- return handleInlineFormat(SetInlineFormatStrikethroughCommandId, params, accessor.get(ICommandService));
4958
+ const commandService = accessor.get(ICommandService);
4959
+ return handleInlineFormat(SetInlineFormatStrikethroughCommandId, params, commandService);
4922
4960
  }
4923
4961
  };
4924
4962
  const SetInlineFormatSubscriptCommandId = "doc.command.set-inline-format-subscript";
@@ -4926,7 +4964,8 @@ const SetInlineFormatSubscriptCommand = {
4926
4964
  id: SetInlineFormatSubscriptCommandId,
4927
4965
  type: CommandType.COMMAND,
4928
4966
  handler: async (accessor, params) => {
4929
- return handleInlineFormat(SetInlineFormatSubscriptCommandId, params, accessor.get(ICommandService));
4967
+ const commandService = accessor.get(ICommandService);
4968
+ return handleInlineFormat(SetInlineFormatSubscriptCommandId, params, commandService);
4930
4969
  }
4931
4970
  };
4932
4971
  const SetInlineFormatSuperscriptCommandId = "doc.command.set-inline-format-superscript";
@@ -4934,7 +4973,8 @@ const SetInlineFormatSuperscriptCommand = {
4934
4973
  id: SetInlineFormatSuperscriptCommandId,
4935
4974
  type: CommandType.COMMAND,
4936
4975
  handler: async (accessor, params) => {
4937
- return handleInlineFormat(SetInlineFormatSuperscriptCommandId, params, accessor.get(ICommandService));
4976
+ const commandService = accessor.get(ICommandService);
4977
+ return handleInlineFormat(SetInlineFormatSuperscriptCommandId, params, commandService);
4938
4978
  }
4939
4979
  };
4940
4980
  const SetInlineFormatFontSizeCommandId = "doc.command.set-inline-format-fontsize";
@@ -4942,7 +4982,8 @@ const SetInlineFormatFontSizeCommand = {
4942
4982
  id: SetInlineFormatFontSizeCommandId,
4943
4983
  type: CommandType.COMMAND,
4944
4984
  handler: async (accessor, params) => {
4945
- return handleInlineFormat(SetInlineFormatFontSizeCommandId, params, accessor.get(ICommandService));
4985
+ const commandService = accessor.get(ICommandService);
4986
+ return handleInlineFormat(SetInlineFormatFontSizeCommandId, params, commandService);
4946
4987
  }
4947
4988
  };
4948
4989
  const SetInlineFormatFontFamilyCommandId = "doc.command.set-inline-format-font-family";
@@ -4950,7 +4991,8 @@ const SetInlineFormatFontFamilyCommand = {
4950
4991
  id: SetInlineFormatFontFamilyCommandId,
4951
4992
  type: CommandType.COMMAND,
4952
4993
  handler: async (accessor, params) => {
4953
- return handleInlineFormat(SetInlineFormatFontFamilyCommandId, params, accessor.get(ICommandService));
4994
+ const commandService = accessor.get(ICommandService);
4995
+ return handleInlineFormat(SetInlineFormatFontFamilyCommandId, params, commandService);
4954
4996
  }
4955
4997
  };
4956
4998
  const SetInlineFormatTextColorCommandId = "doc.command.set-inline-format-text-color";
@@ -4958,7 +5000,8 @@ const SetInlineFormatTextColorCommand = {
4958
5000
  id: SetInlineFormatTextColorCommandId,
4959
5001
  type: CommandType.COMMAND,
4960
5002
  handler: async (accessor, params) => {
4961
- return handleInlineFormat(SetInlineFormatTextColorCommandId, params, accessor.get(ICommandService));
5003
+ const commandService = accessor.get(ICommandService);
5004
+ return handleInlineFormat(SetInlineFormatTextColorCommandId, params, commandService);
4962
5005
  }
4963
5006
  };
4964
5007
  const ResetInlineFormatTextColorCommandId = "doc.command.reset-inline-format-text-color";
@@ -4966,7 +5009,8 @@ const ResetInlineFormatTextColorCommand = {
4966
5009
  id: ResetInlineFormatTextColorCommandId,
4967
5010
  type: CommandType.COMMAND,
4968
5011
  handler: async (accessor, params) => {
4969
- return handleInlineFormat(ResetInlineFormatTextColorCommandId, params, accessor.get(ICommandService));
5012
+ const commandService = accessor.get(ICommandService);
5013
+ return handleInlineFormat(ResetInlineFormatTextColorCommandId, params, commandService);
4970
5014
  }
4971
5015
  };
4972
5016
  const SetInlineFormatTextFillCommandId = "doc.command.set-inline-format-text-fill";
@@ -4974,7 +5018,8 @@ const SetInlineFormatTextFillCommand = {
4974
5018
  id: SetInlineFormatTextFillCommandId,
4975
5019
  type: CommandType.COMMAND,
4976
5020
  handler: async (accessor, params) => {
4977
- return handleInlineFormat(SetInlineFormatTextFillCommandId, params, accessor.get(ICommandService));
5021
+ const commandService = accessor.get(ICommandService);
5022
+ return handleInlineFormat(SetInlineFormatTextFillCommandId, params, commandService);
4978
5023
  }
4979
5024
  };
4980
5025
  const SetInlineFormatTextBackgroundColorCommandId = "doc.command.set-inline-format-text-background-color";
@@ -4982,7 +5027,8 @@ const SetInlineFormatTextBackgroundColorCommand = {
4982
5027
  id: SetInlineFormatTextBackgroundColorCommandId,
4983
5028
  type: CommandType.COMMAND,
4984
5029
  handler: async (accessor, params) => {
4985
- return handleInlineFormat(SetInlineFormatTextBackgroundColorCommandId, params, accessor.get(ICommandService));
5030
+ const commandService = accessor.get(ICommandService);
5031
+ return handleInlineFormat(SetInlineFormatTextBackgroundColorCommandId, params, commandService);
4986
5032
  }
4987
5033
  };
4988
5034
  const ResetInlineFormatTextBackgroundColorCommandId = "doc.command.reset-inline-format-text-background-color";
@@ -4990,7 +5036,8 @@ const ResetInlineFormatTextBackgroundColorCommand = {
4990
5036
  id: ResetInlineFormatTextBackgroundColorCommandId,
4991
5037
  type: CommandType.COMMAND,
4992
5038
  handler: async (accessor, params) => {
4993
- return handleInlineFormat(ResetInlineFormatTextBackgroundColorCommandId, params, accessor.get(ICommandService));
5039
+ const commandService = accessor.get(ICommandService);
5040
+ return handleInlineFormat(ResetInlineFormatTextBackgroundColorCommandId, params, commandService);
4994
5041
  }
4995
5042
  };
4996
5043
  const COMMAND_ID_TO_FORMAT_KEY_MAP = {
@@ -5288,35 +5335,6 @@ function collectTopLevelReplaceAction(jsonX, rawActions, path, previousValue, va
5288
5335
  const action = jsonX.replaceOp(path, previousValue, value);
5289
5336
  if (action != null) rawActions.push(action);
5290
5337
  }
5291
- /**
5292
- * @deprecated please use ReplaceSnapshotCommand instead.
5293
- */
5294
- const ReplaceContentCommand = {
5295
- id: "doc.command-replace-content",
5296
- type: CommandType.COMMAND,
5297
- handler: async (accessor, params) => {
5298
- var _docDataModel$getSelf2;
5299
- const { unitId, body, textRanges, segmentId = "", options } = params;
5300
- const univerInstanceService = accessor.get(IUniverInstanceService);
5301
- const commandService = accessor.get(ICommandService);
5302
- const docSelectionManagerService = accessor.get(DocSelectionManagerService);
5303
- const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
5304
- const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.getBody();
5305
- if (docDataModel == null || prevBody == null) return false;
5306
- const doMutation = getMutationParams(unitId, segmentId, docDataModel, prevBody, body);
5307
- doMutation.params.textRanges = textRanges;
5308
- if (options) doMutation.params.options = options;
5309
- if (doMutation.params.actions == null && textRanges) {
5310
- docSelectionManagerService.replaceDocRanges(textRanges, {
5311
- unitId,
5312
- subUnitId: unitId
5313
- }, false);
5314
- return true;
5315
- }
5316
- const result = commandService.syncExecuteCommand(doMutation.id, doMutation.params);
5317
- return Boolean(result);
5318
- }
5319
- };
5320
5338
  const CoverContentCommand = {
5321
5339
  id: "doc.command-cover-content",
5322
5340
  type: CommandType.COMMAND,
@@ -5400,13 +5418,13 @@ const ReplaceTextRunsCommand = {
5400
5418
  id: "doc.command.replace-text-runs",
5401
5419
  type: CommandType.COMMAND,
5402
5420
  handler: (accessor, params) => {
5403
- var _docDataModel$getSelf3;
5421
+ var _docDataModel$getSelf2;
5404
5422
  const { unitId, body, textRanges, segmentId = "", options } = params;
5405
5423
  const univerInstanceService = accessor.get(IUniverInstanceService);
5406
5424
  const commandService = accessor.get(ICommandService);
5407
5425
  const themeService = accessor.get(ThemeService);
5408
5426
  const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
5409
- 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();
5410
5428
  if (docDataModel == null || prevBody == null) return false;
5411
5429
  const textX = BuildTextUtils.selection.replaceTextRuns({
5412
5430
  doc: docDataModel,
@@ -6082,10 +6100,10 @@ function insertNamedStyleParagraph(accessor, doc, namedStyleType, startOffset, e
6082
6100
  segmentId,
6083
6101
  unitId: doc.getUnitId()
6084
6102
  }));
6085
- if (success) accessor.get(DocSelectionManagerService).replaceTextRanges([{
6103
+ if (success) accessor.get(DocSelectionManagerService).replaceDocRanges([{
6086
6104
  startOffset,
6087
6105
  endOffset: startOffset
6088
- }], false);
6106
+ }], void 0, false);
6089
6107
  return success;
6090
6108
  }
6091
6109
  const QuickHeadingCommand = {
@@ -7201,6 +7219,12 @@ const TEXT_ANCHOR_KEY_PREFIX = "__TestSelectionAnchor__";
7201
7219
  const ID_LENGTH$1 = 6;
7202
7220
  const BLINK_ON = 500;
7203
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
+ }
7204
7228
  function getAnchorBounding(pointsGroup) {
7205
7229
  const points = pointsGroup[0];
7206
7230
  const startPoint = points[0];
@@ -7955,7 +7979,7 @@ function getParagraphInfoByGlyph(node) {
7955
7979
  };
7956
7980
  }
7957
7981
  function serializeTextRange(textRange) {
7958
- const { startOffset, endOffset, collapsed, rangeType, startNodePosition, endNodePosition, direction, segmentId, segmentPage } = textRange;
7982
+ const { startOffset, endOffset, collapsed, rangeType, startNodePosition, endNodePosition, direction, segmentId, segmentPage, style } = textRange;
7959
7983
  return {
7960
7984
  startOffset,
7961
7985
  endOffset,
@@ -7966,6 +7990,7 @@ function serializeTextRange(textRange) {
7966
7990
  direction,
7967
7991
  segmentId,
7968
7992
  segmentPage,
7993
+ style,
7969
7994
  isActive: textRange.isActive()
7970
7995
  };
7971
7996
  }
@@ -8155,27 +8180,37 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8155
8180
  const { scene, mainComponent } = this._context;
8156
8181
  const document = mainComponent;
8157
8182
  const docSkeleton = this._docSkeletonManagerService.getSkeleton();
8158
- const generalAddRange = (startOffset, endOffset) => {
8159
- 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);
8160
8185
  if (rangeList == null) return;
8161
8186
  const { textRanges, rectRanges } = rangeList;
8162
8187
  for (const textRange of textRanges) this._addTextRange(textRange);
8163
8188
  this._addRectRanges(rectRanges);
8164
8189
  };
8165
8190
  for (const range of ranges) {
8191
+ var _range$style;
8166
8192
  const { startOffset, endOffset, rangeType, startNodePosition, endNodePosition } = range;
8167
- if (rangeType === DOC_RANGE_TYPE.RECT) {
8168
- 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);
8169
8204
  if (rectRange) this._addRectRanges([rectRange]);
8170
8205
  } else if (rangeType === DOC_RANGE_TYPE.TEXT) try {
8171
8206
  let textRange = null;
8172
- 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);
8173
- 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);
8174
8209
  if (textRange) this._addTextRange(textRange);
8175
8210
  } catch (_e) {
8176
- generalAddRange(startOffset, endOffset);
8211
+ generalAddRange(startOffset, endOffset, rangeStyle);
8177
8212
  }
8178
- else generalAddRange(startOffset, endOffset);
8213
+ else generalAddRange(startOffset, endOffset, rangeStyle);
8179
8214
  }
8180
8215
  this._textSelectionInner$.next({
8181
8216
  textRanges: this._getAllTextRanges(),
@@ -8246,9 +8281,6 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8246
8281
  blur() {
8247
8282
  this._input.blur();
8248
8283
  }
8249
- /**
8250
- * @deprecated
8251
- */
8252
8284
  deactivate() {
8253
8285
  this._container.style.left = "0px";
8254
8286
  this._container.style.top = "0px";
@@ -8705,7 +8737,7 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
8705
8737
  const scrollStop = viewport.onScrollEnd$.subscribeEvent((param) => {
8706
8738
  const viewport = param.viewport;
8707
8739
  if (!viewport) return;
8708
- const bounds = viewport.getBounding();
8740
+ const bounds = viewport.calcViewportInfo();
8709
8741
  const activeRangeInstance = this._getActiveRangeInstance();
8710
8742
  const anchor = activeRangeInstance === null || activeRangeInstance === void 0 ? void 0 : activeRangeInstance.getAnchor();
8711
8743
  if (!anchor || anchor && !anchor.visible) return;
@@ -8916,8 +8948,8 @@ const SwitchDocModeCommand = {
8916
8948
  const docDataModel = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
8917
8949
  if (docDataModel == null) return false;
8918
8950
  const unitId = docDataModel.getUnitId();
8919
- const skeleton = (_renderManagerService = renderManagerService.getRenderById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService).getSkeleton();
8920
- 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);
8921
8953
  if (skeleton == null || docSelectionRenderService == null) return false;
8922
8954
  const segmentId = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegment();
8923
8955
  const segmentPage = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegmentPage();
@@ -9779,7 +9811,7 @@ var Editor = class extends Disposable {
9779
9811
  return docSelectionRenderService.isFocusing && Boolean(docSelectionRenderService.getActiveTextRange());
9780
9812
  }
9781
9813
  /**
9782
- * @deprecated use `IEditorService.focus` as instead. this is for internal usage.
9814
+ * Focus the input element directly. This is for internal usage.
9783
9815
  */
9784
9816
  focus() {
9785
9817
  const curDoc = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
@@ -9788,7 +9820,7 @@ var Editor = class extends Disposable {
9788
9820
  this._param.render.with(DocSelectionRenderService).focus();
9789
9821
  }
9790
9822
  /**
9791
- * @deprecated use `IEditorService.blur` as instead. this is for internal usage.
9823
+ * Blur the input element directly. This is for internal usage.
9792
9824
  */
9793
9825
  blur() {
9794
9826
  this._param.render.with(DocSelectionRenderService).blur();
@@ -9868,21 +9900,17 @@ var Editor = class extends Disposable {
9868
9900
  const docDataModel = this._getDocDataModel();
9869
9901
  docDataModel === null || docDataModel === void 0 || docDataModel.dispose();
9870
9902
  }
9871
- /**
9872
- * @deprecated use getEditorId.
9873
- */
9874
- get editorUnitId() {
9875
- return this._param.editorUnitId;
9876
- }
9877
- /**
9878
- * @deprecated @TODO: @JOCS remove this in the future.
9879
- */
9880
- get params() {
9881
- return this._param;
9882
- }
9883
9903
  get cancelDefaultResizeListener() {
9884
9904
  return this._param.cancelDefaultResizeListener;
9885
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
+ }
9886
9914
  get render() {
9887
9915
  return this._param.render;
9888
9916
  }
@@ -9900,47 +9928,11 @@ var Editor = class extends Disposable {
9900
9928
  }
9901
9929
  getSkeleton() {
9902
9930
  var _this$_injector$get$g;
9903
- 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();
9904
9932
  }
9905
9933
  isSheetEditor() {
9906
9934
  return isInternalEditorID(this._getEditorId());
9907
9935
  }
9908
- /**
9909
- * @deprecated use getDocumentData.
9910
- */
9911
- getValue() {
9912
- var _docDataModel$getBody;
9913
- 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, "");
9914
- }
9915
- /**
9916
- * @deprecated use getDocumentData.
9917
- */
9918
- getBody() {
9919
- return this._getDocDataModel().getBody();
9920
- }
9921
- /**
9922
- * @deprecated.
9923
- */
9924
- update(param) {
9925
- this._param = {
9926
- ...this._param,
9927
- ...param
9928
- };
9929
- }
9930
- /**
9931
- * @deprecated.
9932
- */
9933
- updateCanvasStyle() {
9934
- var _this$_param$canvasSt;
9935
- const docDataModel = this._getDocDataModel();
9936
- if (docDataModel == null) return;
9937
- const documentStyle = {};
9938
- if ((_this$_param$canvasSt = this._param.canvasStyle) === null || _this$_param$canvasSt === void 0 ? void 0 : _this$_param$canvasSt.fontSize) {
9939
- if (documentStyle.textStyle == null) documentStyle.textStyle = {};
9940
- documentStyle.textStyle.fs = this._param.canvasStyle.fontSize;
9941
- }
9942
- docDataModel.updateDocumentStyle(documentStyle);
9943
- }
9944
9936
  _getDocDataModel() {
9945
9937
  const editorUnitId = this._getEditorId();
9946
9938
  return this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC);
@@ -10014,13 +10006,14 @@ let EditorService = class EditorService extends Disposable {
10014
10006
  this._blur$.next(null);
10015
10007
  }
10016
10008
  focus(editorUnitId) {
10009
+ var _editor$getDocumentDa, _editor$getDocumentDa2;
10017
10010
  if (editorUnitId === this._focusEditorUnitId) return;
10018
10011
  if (this._focusEditorUnitId) this.blur();
10019
10012
  if (editorUnitId == null) return;
10020
10013
  const editor = this.getEditor(editorUnitId);
10021
10014
  if (editor == null) return;
10022
10015
  this._univerInstanceService.setCurrentUnitForType(editorUnitId);
10023
- 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;
10024
10017
  this._contextService.setContextValue(EDITOR_ACTIVATED, true);
10025
10018
  if (!isInternalEditorID(editorUnitId)) this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, true);
10026
10019
  if (isCommentEditorID(editorUnitId)) this._contextService.setContextValue(FOCUSING_COMMENT_EDITOR, true);
@@ -10043,32 +10036,23 @@ let EditorService = class EditorService extends Disposable {
10043
10036
  return this._editors;
10044
10037
  }
10045
10038
  getEditorRenderConfig(editorUnitId) {
10046
- var _this$_editorRenderCo;
10039
+ var _ref, _this$_editorRenderCo;
10047
10040
  const editor = this._editors.get(editorUnitId);
10048
- if (editor) {
10049
- var _editor$params$canvas;
10050
- return {
10051
- canvasStyle: (_editor$params$canvas = editor.params.canvasStyle) !== null && _editor$params$canvas !== void 0 ? _editor$params$canvas : {},
10052
- scrollBar: editor.params.scrollBar
10053
- };
10054
- }
10055
- 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;
10056
10042
  }
10057
10043
  register(config, container) {
10058
10044
  const { initialSnapshot, canvasStyle = {} } = config;
10059
10045
  const editorUnitId = initialSnapshot.id;
10060
10046
  this._editorRenderConfigs.set(editorUnitId, {
10061
10047
  canvasStyle,
10062
- scrollBar: config.scrollBar
10048
+ scrollBar: config.scrollBar,
10049
+ ...config.backScrollOffset === void 0 ? {} : { backScrollOffset: config.backScrollOffset }
10063
10050
  });
10064
10051
  if (this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC) == null) this._univerInstanceService.createUnit(UniverInstanceType.UNIVER_DOC, initialSnapshot || this._getBlank(editorUnitId), { makeCurrent: false });
10065
- let render = this._renderManagerService.getRenderById(editorUnitId);
10066
- if (render == null) {
10067
- this._renderManagerService.create(editorUnitId);
10068
- render = this._renderManagerService.getRenderById(editorUnitId);
10069
- }
10052
+ let render = this._renderManagerService.getRenderUnitById(editorUnitId);
10053
+ if (render == null) render = this._renderManagerService.createRender(editorUnitId);
10070
10054
  if (render) {
10071
- render.engine.setContainer(container);
10055
+ render.engine.mount(container);
10072
10056
  const editor = new Editor({
10073
10057
  ...config,
10074
10058
  render,
@@ -10178,7 +10162,7 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
10178
10162
  anchorNodePosition && this.scrollToNode(anchorNodePosition);
10179
10163
  }
10180
10164
  scrollToNode(startNodePosition) {
10181
- var _editor$params$backSc;
10165
+ var _editorRenderConfig$b;
10182
10166
  const { unitId, scene, mainComponent } = this._context;
10183
10167
  const skeleton = this._docSkeletonManagerService.getSkeleton();
10184
10168
  if (mainComponent == null || skeleton == null) return;
@@ -10189,12 +10173,12 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
10189
10173
  const left = aLeft + docsLeft;
10190
10174
  const top = aTop + docsTop;
10191
10175
  const viewportMain = scene.getViewport("viewMain");
10192
- const editor = this._editorService.getEditor(unitId);
10193
10176
  if (viewportMain == null) return;
10194
- 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;
10195
10178
  let offsetY = 0;
10196
10179
  let offsetX = 0;
10197
- 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;
10198
10182
  if (top < boundTop) offsetY = top - boundTop - delta;
10199
10183
  else if (top > boundBottom - height) offsetY = top - boundBottom + height + delta;
10200
10184
  if (left < boundLeft) offsetX = left - boundLeft;
@@ -10240,12 +10224,15 @@ let DocParagraphPlaceholderRenderController = class DocParagraphPlaceholderRende
10240
10224
  this.disposeWithMe(documents.pageRender$.subscribe((pageRenderConfig) => this._drawPagePlaceholders(pageRenderConfig)));
10241
10225
  }
10242
10226
  _drawPagePlaceholders({ page, pageLeft, pageTop, ctx }) {
10243
- var _this$_context$unit$g, _activeRange$segmentI, _page$segmentId;
10227
+ var _this$_context$unit$g, _activeRange$segmentI, _page$segmentId, _this$_context$mainCo;
10244
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();
10245
10229
  if (!body) return;
10246
10230
  const activeRange = this._docSelectionManagerService.getActiveTextRange();
10247
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;
10248
- 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
+ });
10249
10236
  if (!placeholders.length) return;
10250
10237
  drawParagraphPlaceholders(ctx, placeholders);
10251
10238
  }
@@ -10272,20 +10259,39 @@ function shouldRenderParagraphPlaceholder(documentModel, unitId, config) {
10272
10259
  if (isInternalEditorID(unitId)) return false;
10273
10260
  return ((_documentModel$getSna = documentModel.getSnapshot().documentStyle) === null || _documentModel$getSna === void 0 ? void 0 : _documentModel$getSna.documentFlavor) === DocumentFlavor.MODERN;
10274
10261
  }
10275
- function getParagraphPlaceholderLayouts(page, body, locale, pageLeft = 0, pageTop = 0, activeOffset) {
10262
+ function getParagraphPlaceholderLayouts(page, body, locale, pageLeft = 0, pageTop = 0, activeOffset, options) {
10276
10263
  var _body$paragraphs, _page$skeTables;
10277
10264
  const paragraphs = new Map(((_body$paragraphs = body.paragraphs) !== null && _body$paragraphs !== void 0 ? _body$paragraphs : []).map((paragraph) => [paragraph.startIndex, paragraph]));
10278
10265
  const layouts = [];
10279
- const visitSection = (section, originLeft, originTop) => {
10280
- 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);
10281
10268
  };
10282
10269
  for (const section of page.sections) visitSection(section, pageLeft + page.marginLeft, pageTop + page.marginTop);
10283
- (_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table) => {
10284
- 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
+ }
10285
10291
  });
10286
10292
  return layouts;
10287
10293
  }
10288
- function visitColumn(column, body, paragraphs, locale, layouts, originLeft, originTop, activeOffset) {
10294
+ function visitColumn(column, body, paragraphs, locale, layouts, originLeft, originTop, activeOffset, clip) {
10289
10295
  for (const line of column.lines) {
10290
10296
  if (!line.paragraphStart) continue;
10291
10297
  const paragraphStart = line.st;
@@ -10295,7 +10301,7 @@ function visitColumn(column, body, paragraphs, locale, layouts, originLeft, orig
10295
10301
  if (!paragraph || !isEmptyParagraph(body.dataStream, line.st, line.paragraphIndex)) continue;
10296
10302
  const text = getPlaceholderText(paragraph, locale);
10297
10303
  if (!text) continue;
10298
- layouts.push(getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop));
10304
+ layouts.push(getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop, clip));
10299
10305
  }
10300
10306
  }
10301
10307
  function isOffsetInParagraph(offset, paragraphStart, paragraphEnd) {
@@ -10313,8 +10319,8 @@ function getPlaceholderText(paragraph, locale) {
10313
10319
  default: return locale.normalText;
10314
10320
  }
10315
10321
  }
10316
- function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop) {
10317
- 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;
10318
10324
  const divide = line.divides[0];
10319
10325
  const firstGlyph = ((_divide$glyphGroup = divide === null || divide === void 0 ? void 0 : divide.glyphGroup) !== null && _divide$glyphGroup !== void 0 ? _divide$glyphGroup : [])[0];
10320
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];
@@ -10323,13 +10329,22 @@ function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop)
10323
10329
  const fontWeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.bl) ? "bold" : "normal";
10324
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);
10325
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;
10326
10337
  return {
10338
+ clipBottom: clipTop + line.lineHeight,
10339
+ clipLeft,
10340
+ clipRight,
10341
+ clipTop,
10327
10342
  fontFamily,
10328
10343
  fontSize,
10329
10344
  fontWeight,
10330
- 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),
10331
10346
  text,
10332
- x: lineStartX + listOffset,
10347
+ x,
10333
10348
  y: originTop + line.top + line.marginTop + line.paddingTop + line.asc
10334
10349
  };
10335
10350
  }
@@ -10369,8 +10384,20 @@ function drawParagraphPlaceholders(ctx, placeholders) {
10369
10384
  ctx.fillStyle = PLACEHOLDER_COLOR;
10370
10385
  ctx.textBaseline = "alphabetic";
10371
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();
10372
10398
  ctx.font = `${placeholder.fontWeight} ${placeholder.fontSize}px ${placeholder.fontFamily}`;
10373
- ctx.fillText(placeholder.text, placeholder.x, placeholder.y, placeholder.maxWidth || void 0);
10399
+ ctx.fillText(placeholder.text, placeholder.x, placeholder.y);
10400
+ ctx.restore();
10374
10401
  }
10375
10402
  ctx.restore();
10376
10403
  }
@@ -10517,7 +10544,10 @@ let DocPageLayoutService = class DocPageLayoutService extends Disposable {
10517
10544
  }
10518
10545
  if (engineHeight > docsHeight) sceneHeight = (engineHeight - pageMarginTop * 2) / viewScale;
10519
10546
  else sceneHeight = docsHeight + pageMarginTop * 2;
10520
- scene.resize(sceneWidth, sceneHeight);
10547
+ scene.transformByState({
10548
+ width: sceneWidth,
10549
+ height: sceneHeight
10550
+ });
10521
10551
  if (engineWidth <= 1) {
10522
10552
  docsLeft = -1e4;
10523
10553
  docsTop = -1e4;
@@ -10554,7 +10584,7 @@ let DocRenderController = class DocRenderController extends RxDisposable {
10554
10584
  }
10555
10585
  reRender(unitId) {
10556
10586
  var _this$_renderManagerS;
10557
- 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);
10558
10588
  const skeleton = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getSkeleton();
10559
10589
  if (!skeleton) return;
10560
10590
  if (!!skeleton.getViewModel().getDataModel().getSnapshot().disabled) return;
@@ -10702,7 +10732,10 @@ let DocRenderController = class DocRenderController extends RxDisposable {
10702
10732
  docsComponent.resize(width, height);
10703
10733
  docBackground.resize(width, height);
10704
10734
  const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
10705
- if (!editorRenderConfig || editorRenderConfig.scrollBar) scene.resize(width, height);
10735
+ if (!editorRenderConfig || editorRenderConfig.scrollBar) scene.transformByState({
10736
+ width,
10737
+ height
10738
+ });
10706
10739
  }
10707
10740
  _syncCanvasBackground(documentFlavor = this._context.unit.getSnapshot().documentStyle.documentFlavor) {
10708
10741
  var _docBackground$setFil;
@@ -10890,7 +10923,7 @@ const CloseHeaderFooterCommand = {
10890
10923
  const instanceService = accessor.get(IUniverInstanceService);
10891
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();
10892
10925
  if (unitId == null) return false;
10893
- const renderObject = renderManagerService.getRenderById(unitId);
10926
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
10894
10927
  if (renderObject == null) return false;
10895
10928
  const docSkeletonManagerService = renderObject.with(DocSkeletonManagerService);
10896
10929
  const viewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
@@ -11011,9 +11044,10 @@ const DOC_SECTION_SETTING_COMPONENT = "doc_ui_section-setting-panel";
11011
11044
  * limitations under the License.
11012
11045
  */
11013
11046
  let DocSectionSettingController = class DocSectionSettingController extends Disposable {
11014
- constructor(_sidebarService) {
11047
+ constructor(_sidebarService, _selectionManager) {
11015
11048
  super();
11016
11049
  this._sidebarService = _sidebarService;
11050
+ this._selectionManager = _selectionManager;
11017
11051
  _defineProperty(this, "_panelId", "DocSectionSetting");
11018
11052
  }
11019
11053
  openPanel() {
@@ -11027,8 +11061,19 @@ let DocSectionSettingController = class DocSectionSettingController extends Disp
11027
11061
  closePanel() {
11028
11062
  this._sidebarService.close(this._panelId);
11029
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
+ }
11030
11075
  };
11031
- DocSectionSettingController = __decorate([__decorateParam(0, Inject(ISidebarService))], DocSectionSettingController);
11076
+ DocSectionSettingController = __decorate([__decorateParam(0, Inject(ISidebarService)), __decorateParam(1, Inject(DocSelectionManagerService))], DocSectionSettingController);
11032
11077
 
11033
11078
  //#endregion
11034
11079
  //#region src/commands/operations/doc-section-setting-panel.operation.ts
@@ -11041,6 +11086,52 @@ const DocSectionSettingPanelOperation = {
11041
11086
  }
11042
11087
  };
11043
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
+
11044
11135
  //#endregion
11045
11136
  //#region src/views/PageSettings.tsx
11046
11137
  const MODERN_WIDTH_OPTIONS = [
@@ -11711,6 +11802,7 @@ const ListTypePicker = (props) => {
11711
11802
  const { value, onChange, options } = props;
11712
11803
  return /* @__PURE__ */ jsx("div", {
11713
11804
  className: "univer-grid univer-grid-cols-3 univer-gap-2 univer-p-1.5",
11805
+ "data-u-editor-interaction-boundary": "true",
11714
11806
  children: options.map((item) => {
11715
11807
  return /* @__PURE__ */ jsx("a", {
11716
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 }),
@@ -11841,7 +11933,7 @@ function getInsertTableHiddenObservable(accessor) {
11841
11933
  editAreaSubscription = null;
11842
11934
  if (unitId == null) return subscriber.next(true);
11843
11935
  if (univerInstanceService.getUnitType(unitId) !== UniverInstanceType.UNIVER_DOC) return subscriber.next(true);
11844
- const currentRender = renderManagerService.getRenderById(unitId);
11936
+ const currentRender = renderManagerService.getRenderUnitById(unitId);
11845
11937
  if (currentRender == null) return subscriber.next(true);
11846
11938
  editAreaSubscription = currentRender.with(DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe((editArea) => {
11847
11939
  subscriber.next(editArea === DocumentEditArea.HEADER || editArea === DocumentEditArea.FOOTER);
@@ -11872,7 +11964,7 @@ function disableMenuWhenHeaderFooterEditing(accessor) {
11872
11964
  emit(true);
11873
11965
  return;
11874
11966
  }
11875
- const currentRender = renderManagerService.getRenderById(unitId);
11967
+ const currentRender = renderManagerService.getRenderUnitById(unitId);
11876
11968
  const skeletonManager = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService);
11877
11969
  const viewModel = skeletonManager === null || skeletonManager === void 0 ? void 0 : skeletonManager.getViewModel();
11878
11970
  if (!viewModel) {
@@ -11893,7 +11985,7 @@ function disableMenuWhenHeaderFooterEditing(accessor) {
11893
11985
  };
11894
11986
  });
11895
11987
  }
11896
- function getHeaderFooterMenuHiddenObservable(accessor) {
11988
+ function getTraditionalDocMenuHiddenObservable(accessor) {
11897
11989
  const univerInstanceService = accessor.get(IUniverInstanceService);
11898
11990
  const commandService = accessor.get(ICommandService);
11899
11991
  return new Observable((subscriber) => {
@@ -12501,11 +12593,60 @@ function HeaderFooterMenuItemFactory(accessor) {
12501
12593
  type: MenuItemType.BUTTON,
12502
12594
  icon: "HeaderFooterIcon",
12503
12595
  tooltip: "docs-ui.toolbar.headerFooter",
12504
- hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => {
12596
+ hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getTraditionalDocMenuHiddenObservable(accessor), (one, two) => {
12505
12597
  return one || two;
12506
12598
  })
12507
12599
  };
12508
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
+ }
12509
12650
  const TableIcon = "GridIcon";
12510
12651
  const TABLE_MENU_ID = "doc.menu.table";
12511
12652
  function TableMenuFactory(accessor) {
@@ -13718,19 +13859,53 @@ const menuSchema = {
13718
13859
  },
13719
13860
  menuItemFactory: HorizontalLineFactory
13720
13861
  },
13721
- [DOC_INSERT_EMOJI_MENU_ID]: {
13862
+ [DOC_BREAKS_MENU_ID]: {
13722
13863
  order: 4,
13723
13864
  gridLayout: {
13724
13865
  row: 1,
13725
- column: 3
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
13726
13901
  },
13727
13902
  menuItemFactory: EmojiPickerMenuItemFactory
13728
13903
  },
13729
13904
  [DOC_INSERT_SYMBOL_MENU_ID]: {
13730
- order: 5,
13905
+ order: 6,
13731
13906
  gridLayout: {
13732
13907
  row: 2,
13733
- column: 3
13908
+ column: 4
13734
13909
  },
13735
13910
  menuItemFactory: SymbolPickerMenuItemFactory
13736
13911
  }
@@ -14700,7 +14875,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
14700
14875
  };
14701
14876
  }
14702
14877
  attachPopupToRect(rect, popup, unitId) {
14703
- const currentRender = this._renderManagerService.getRenderById(unitId);
14878
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
14704
14879
  if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
14705
14880
  const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
14706
14881
  const { position, position$, disposable } = this._createRectPositionObserver(rect, currentRender);
@@ -14729,7 +14904,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
14729
14904
  * @returns disposable
14730
14905
  */
14731
14906
  attachPopupToObject(targetObject, popup, unitId) {
14732
- const currentRender = this._renderManagerService.getRenderById(unitId);
14907
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
14733
14908
  if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
14734
14909
  const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
14735
14910
  const { position, position$, disposable } = this._createObjectPositionObserver(targetObject, currentRender);
@@ -14761,7 +14936,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
14761
14936
  attachPopupToRange(range, popup, unitId) {
14762
14937
  if (!this._univerInstanceService.getUnit(unitId)) throw new Error(`Document not found, unitId: ${unitId}`);
14763
14938
  const { direction = "top", multipleDirection } = popup;
14764
- const currentRender = this._renderManagerService.getRenderById(unitId);
14939
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
14765
14940
  if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
14766
14941
  const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
14767
14942
  const { positions: bounds, positions$: bounds$, disposable } = this._createRangePositionObserver(range, currentRender);
@@ -15164,12 +15339,13 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
15164
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 : [];
15165
15340
  const layouts = [];
15166
15341
  customRanges.forEach((range) => {
15167
- const rects = calcDocRangePositions$1({
15342
+ const textRange = {
15168
15343
  startOffset: range.startIndex,
15169
15344
  endOffset: range.endIndex + 1,
15170
15345
  collapsed: false,
15171
15346
  segmentId
15172
- }, this._documents, this._skeleton, segmentPage);
15347
+ };
15348
+ const rects = calcDocRangePositions$1(textRange, this._documents, this._skeleton, segmentPage);
15173
15349
  if (!rects) return null;
15174
15350
  layouts.push({
15175
15351
  customRange: range,
@@ -15630,7 +15806,7 @@ function DocSideMenuContent() {
15630
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 : "";
15631
15807
  const [activeId, setActiveId] = useState(void 0);
15632
15808
  const unitId = (_currentDoc$getUnitId = currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) !== null && _currentDoc$getUnitId !== void 0 ? _currentDoc$getUnitId : "";
15633
- const renderer = renderManagerService.getRenderById(unitId);
15809
+ const renderer = renderManagerService.getRenderUnitById(unitId);
15634
15810
  const title = documentData === null || documentData === void 0 ? void 0 : documentData.title;
15635
15811
  const docEventManagerService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocEventManagerService);
15636
15812
  const paragraphBounds = docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.paragraphBounds;
@@ -15672,7 +15848,8 @@ function DocSideMenuContent() {
15672
15848
  }).filter((item) => item === null || item === void 0 ? void 0 : item.text);
15673
15849
  const handleScroll = useEvent((params) => {
15674
15850
  const scrollTop = params.viewportScrollY;
15675
- const activeId = findActiveHeading(paragraphBounds, paragraphMap, scrollTop, scrollTop + canvasHeight / scaleY);
15851
+ const bottom = scrollTop + canvasHeight / scaleY;
15852
+ const activeId = findActiveHeading(paragraphBounds, paragraphMap, scrollTop, bottom);
15676
15853
  if (activeId) setActiveId(activeId);
15677
15854
  });
15678
15855
  const menus = (paragraphMenus === null || paragraphMenus === void 0 ? void 0 : paragraphMenus.find((p) => p.isTitle)) ? paragraphMenus : [...title ? [{
@@ -15799,7 +15976,7 @@ let DocUIController = class DocUIController extends Disposable {
15799
15976
  _initFocusHandler() {
15800
15977
  this.disposeWithMe(this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_DOC, (unitId) => {
15801
15978
  if (this._shouldPreserveEmbedFocus(unitId)) return;
15802
- this._injector.get(IRenderManagerService).getRenderById(unitId).with(DocSelectionRenderService).focus();
15979
+ this._injector.get(IRenderManagerService).getRenderUnitById(unitId).with(DocSelectionRenderService).focus();
15803
15980
  }));
15804
15981
  }
15805
15982
  _shouldPreserveEmbedFocus(unitId) {
@@ -15937,7 +16114,7 @@ function collectDocsTableLikeEmbedChildUnitIds(drawings, resolveChildUnitId) {
15937
16114
  const data = getDrawingData(drawing);
15938
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;
15939
16116
  const childType = typeof (data === null || data === void 0 ? void 0 : data.childType) === "number" ? data.childType : void 0;
15940
- if (!childUnitId || !isSheetLikeDocsCustomBlockChildType$1(childType)) return;
16117
+ if (!childUnitId || !isSheetLikeDocsCustomBlockChildType(childType)) return;
15941
16118
  childUnitIds.add(childUnitId);
15942
16119
  });
15943
16120
  return childUnitIds;
@@ -16026,10 +16203,10 @@ function resolveMaxScrollLeft(element, requestedMaxScrollLeft) {
16026
16203
  const MODERN_DOCS_CUSTOM_BLOCK_VIEWPORT_INSET = 10;
16027
16204
  function resolveDocsCustomBlockRenderViewport(params) {
16028
16205
  var _params$fallbackWidth, _params$fallbackHeigh, _params$contentHeight, _params$visibleCanvas, _params$pageMarginLef, _params$pageMarginRig, _params$contentWidth, _params$docsLeft, _params$visibleCanvas2;
16029
- const defaultSize = resolveDocsCustomBlockSize$1(params.childType);
16206
+ const defaultSize = resolveDocsCustomBlockSize(params.childType);
16030
16207
  const fallbackWidth = (_params$fallbackWidth = params.fallbackWidth) !== null && _params$fallbackWidth !== void 0 ? _params$fallbackWidth : defaultSize.width;
16031
16208
  const fallbackHeight = (_params$fallbackHeigh = params.fallbackHeight) !== null && _params$fallbackHeigh !== void 0 ? _params$fallbackHeigh : defaultSize.height;
16032
- const sheetLike = isSheetLikeDocsCustomBlockChildType$1(params.childType);
16209
+ const sheetLike = isSheetLikeDocsCustomBlockChildType(params.childType);
16033
16210
  const contentHeight = Number.isFinite(params.contentHeight) && ((_params$contentHeight = params.contentHeight) !== null && _params$contentHeight !== void 0 ? _params$contentHeight : 0) > 0 ? params.contentHeight : fallbackHeight;
16034
16211
  const visibleCanvasHeight = Number.isFinite(params.visibleCanvasHeight) && ((_params$visibleCanvas = params.visibleCanvasHeight) !== null && _params$visibleCanvas !== void 0 ? _params$visibleCanvas : 0) > 0 ? params.visibleCanvasHeight : void 0;
16035
16212
  const height = sheetLike ? contentHeight : fallbackHeight;
@@ -16055,7 +16232,8 @@ function resolveDocsCustomBlockRenderViewport(params) {
16055
16232
  width: layoutWidth
16056
16233
  };
16057
16234
  }
16058
- 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;
16059
16237
  const docsLeft = (_params$docsLeft = params.docsLeft) !== null && _params$docsLeft !== void 0 ? _params$docsLeft : 0;
16060
16238
  const fallbackViewportLeft = docsLeft + inset;
16061
16239
  const fallbackViewportWidth = Math.max(0, pageWidth - inset * 2);
@@ -16081,7 +16259,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
16081
16259
  //#endregion
16082
16260
  //#region package.json
16083
16261
  var name = "@univerjs/docs-ui";
16084
- var version = "1.0.0-alpha.7";
16262
+ var version = "1.0.0-alpha.8";
16085
16263
 
16086
16264
  //#endregion
16087
16265
  //#region src/commands/commands/doc-paragraph-setting.command.ts
@@ -16253,7 +16431,7 @@ function getSegmentId(documentStyle, editArea, pageIndex, page) {
16253
16431
  }
16254
16432
  const DocHeaderFooterOptions = (props) => {
16255
16433
  var _segmentContext$segme, _segmentContext$segme2;
16256
- const docSelectionRenderService = useDependency(IRenderManagerService).getRenderById(props.unitId).with(DocSelectionRenderService);
16434
+ const docSelectionRenderService = useDependency(IRenderManagerService).getRenderUnitById(props.unitId).with(DocSelectionRenderService);
16257
16435
  const segmentContext = useObservable(docSelectionRenderService.segmentContext$, {
16258
16436
  segmentId: docSelectionRenderService.getSegment(),
16259
16437
  segmentPage: docSelectionRenderService.getSegmentPage()
@@ -16268,12 +16446,12 @@ function DocHeaderFooterOptionsContent(props) {
16268
16446
  const commandService = useDependency(ICommandService);
16269
16447
  const layoutService = useDependency(ILayoutService);
16270
16448
  const { unitId } = props;
16271
- const docSelectionRenderService = renderManagerService.getRenderById(unitId).with(DocSelectionRenderService);
16449
+ const docSelectionRenderService = renderManagerService.getRenderUnitById(unitId).with(DocSelectionRenderService);
16272
16450
  const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
16273
16451
  const getCurrentSectionContext = () => {
16274
16452
  var _renderManagerService, _docSkeletonManagerSe;
16275
16453
  const snapshot = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot();
16276
- 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);
16277
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()];
16278
16456
  return snapshot == null ? void 0 : {
16279
16457
  ...getDocPageSectionContext(snapshot, page),
@@ -16291,7 +16469,7 @@ function DocHeaderFooterOptionsContent(props) {
16291
16469
  };
16292
16470
  });
16293
16471
  const sectionContext = getCurrentSectionContext();
16294
- 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));
16295
16473
  const canLinkToPrevious = ((_sectionContext$secti = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.sectionIndex) !== null && _sectionContext$secti !== void 0 ? _sectionContext$secti : -1) > 0;
16296
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]));
16297
16475
  const handleCheckboxChange = (val, type) => {
@@ -16302,7 +16480,7 @@ function DocHeaderFooterOptionsContent(props) {
16302
16480
  }));
16303
16481
  const sectionContext = getCurrentSectionContext();
16304
16482
  const documentStyle = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config;
16305
- 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);
16306
16484
  const viewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
16307
16485
  if (documentStyle == null || viewModel == null) return;
16308
16486
  const editArea = viewModel.getEditArea();
@@ -16367,7 +16545,7 @@ function DocHeaderFooterOptionsContent(props) {
16367
16545
  var _renderManagerService4;
16368
16546
  const context = getCurrentSectionContext();
16369
16547
  if (!(context === null || context === void 0 ? void 0 : context.sectionId) || context.sectionIndex <= 0 || !docDataModel) return;
16370
- 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";
16371
16549
  const currentVariant = getHeaderFooterVariant(context.config, docSelectionRenderService.getSegmentPage(), context.page);
16372
16550
  const key = getSectionHeaderFooterReferenceKey(kind, currentVariant);
16373
16551
  const segmentId = generateRandomId(6);
@@ -16857,7 +17035,7 @@ const useFirstParagraphLineSpacing = (paragraph) => {
16857
17035
  var _renderManagerService;
16858
17036
  const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
16859
17037
  if (!docDataModel) return;
16860
- 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();
16861
17039
  }, []);
16862
17040
  const stateChange$ = useMemo(() => new BehaviorSubject({}), []);
16863
17041
  const [spacingRule, setSpacingRuleInternal] = useState(() => {
@@ -16886,7 +17064,8 @@ const useFirstParagraphLineSpacing = (paragraph) => {
16886
17064
  const divideNode = glyphNode === null || glyphNode === void 0 ? void 0 : glyphNode.parent;
16887
17065
  const metrics = getLineSpacingMetrics(divideNode === null || divideNode === void 0 ? void 0 : divideNode.parent);
16888
17066
  const nextStoredLineSpacing = convertLineSpacingForRuleChange(convertDisplayLineSpacingToStoredValue(lineSpacing, spacingRule), spacingRule, v, metrics);
16889
- setLineSpacingInternal(convertStoredLineSpacingToDisplayValue(nextStoredLineSpacing, v));
17067
+ const nextDisplayLineSpacing = convertStoredLineSpacingToDisplayValue(nextStoredLineSpacing, v);
17068
+ setLineSpacingInternal(nextDisplayLineSpacing);
16890
17069
  setSpacingRuleInternal(v);
16891
17070
  stateChange$.next({
16892
17071
  spacingRule: v,
@@ -17929,9 +18108,6 @@ const PARAGRAPH_MENU_HOVER_OPEN_DELAY = 800;
17929
18108
  const PARAGRAPH_MENU_HOVER_HIDE_DELAY = 240;
17930
18109
  const PARAGRAPH_MENU_HOVER_BRIDGE_EDGE_OVERLAP = 12;
17931
18110
  const PARAGRAPH_MENU_HOVER_BRIDGE_VERTICAL_PADDING = 8;
17932
- function getParagraphMenuTriggerClassName(visible) {
17933
- 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 });
17934
- }
17935
18111
  function shouldExecuteParagraphMenuMove(validatorService, context) {
17936
18112
  return validatorService.canMoveBlock(context);
17937
18113
  }
@@ -18415,7 +18591,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18415
18591
  const handledSlashRequestNonceRef = useRef(0);
18416
18592
  const renderManagerService = useDependency(IRenderManagerService);
18417
18593
  const univerInstanceService = useDependency(IUniverInstanceService);
18418
- const renderUnit = renderManagerService.getRenderById(popup.unitId);
18594
+ const renderUnit = renderManagerService.getRenderUnitById(popup.unitId);
18419
18595
  const doc = univerInstanceService.getUnit(popup.unitId, UniverInstanceType.UNIVER_DOC);
18420
18596
  const docParagraphMenuService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocParagraphMenuService);
18421
18597
  const docEventManagerService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocEventManagerService);
@@ -18454,10 +18630,11 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18454
18630
  const boundingRect = (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.getBoundingClientRect();
18455
18631
  const left = ((_boundingRect$left = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.left) !== null && _boundingRect$left !== void 0 ? _boundingRect$left : 0) - 4;
18456
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;
18457
18634
  setMenuDirection(getParagraphMenuPopupDirection(left, 212, 8, {
18458
18635
  anchorRight: right,
18459
18636
  direction,
18460
- 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
18461
18638
  }));
18462
18639
  const nextAnchorRect = {
18463
18640
  left,
@@ -18491,10 +18668,11 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18491
18668
  clearHideTimer();
18492
18669
  const latestTarget = (_docParagraphMenuServ = docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget) !== null && _docParagraphMenuServ !== void 0 ? _docParagraphMenuServ : activeTarget;
18493
18670
  setParagraphMenuInteractionActive(docParagraphMenuService, true);
18494
- targetRangeRef.current = latestTarget ? {
18671
+ const targetRange = latestTarget ? {
18495
18672
  ...latestTarget.menuRange,
18496
18673
  segmentId: activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.segmentId
18497
18674
  } : getParagraphMenuTargetRange(activeParagraphBound);
18675
+ targetRangeRef.current = targetRange;
18498
18676
  updateAnchorRect();
18499
18677
  setOpenMode(mode);
18500
18678
  setVisible(true);
@@ -18522,7 +18700,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18522
18700
  };
18523
18701
  const replaceSelection = (range) => {
18524
18702
  if (!range) return;
18525
- docSelectionManagerService.replaceTextRanges([range], false);
18703
+ docSelectionManagerService.replaceDocRanges([range], void 0, false);
18526
18704
  };
18527
18705
  const getCurrentTextRangesSnapshot = () => {
18528
18706
  var _docSelectionManagerS;
@@ -18530,7 +18708,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18530
18708
  };
18531
18709
  const restoreTextRanges = (ranges) => {
18532
18710
  if (!ranges) return;
18533
- docSelectionManagerService.replaceTextRanges(ranges, false);
18711
+ docSelectionManagerService.replaceDocRanges(ranges, void 0, false);
18534
18712
  };
18535
18713
  const executeResolvedCommand = (option, targetRange) => {
18536
18714
  const resolved = getParagraphMenuResolvedCommand(option, targetRange);
@@ -18689,7 +18867,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18689
18867
  /* @__PURE__ */ jsxs("div", {
18690
18868
  "data-u-comp": "paragraph-menu",
18691
18869
  ref: anchorRef,
18692
- 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 }),
18693
18871
  onMouseEnter: (e) => {
18694
18872
  var _popup$onPointerEnter;
18695
18873
  (_popup$onPointerEnter = popup.onPointerEnter) === null || _popup$onPointerEnter === void 0 || _popup$onPointerEnter.call(popup, e);
@@ -18861,13 +19039,13 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
18861
19039
  return;
18862
19040
  }
18863
19041
  if (commandId === DocPasteCommand.id) {
18864
- docSelectionManagerService.replaceTextRanges([afterTableRange], false);
19042
+ docSelectionManagerService.replaceDocRanges([afterTableRange], void 0, false);
18865
19043
  await commandService.executeCommand(DocPasteCommand.id);
18866
19044
  finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
18867
19045
  return;
18868
19046
  }
18869
- if (commandId === DocTableDeleteTableCommand.id) docSelectionManagerService.replaceTextRanges([tableRange], false);
18870
- else if (params.id === "doc.menu.insert-bellow" || commandId !== "doc.menu.insert-bellow") docSelectionManagerService.replaceTextRanges([afterTableRange], false);
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);
18871
19049
  if (commandService && commandId) commandService.executeCommand(commandId, commandId === DocTableDeleteTableCommand.id ? {
18872
19050
  ...commandParams,
18873
19051
  targetRange: tableRange
@@ -18927,7 +19105,7 @@ function getSectionColumnGap(section) {
18927
19105
  var _section$columnProper2, _section$columnProper3;
18928
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;
18929
19107
  }
18930
- function getSectionSettingValues(sections) {
19108
+ function getSectionSettingValues(sections, documentStyle) {
18931
19109
  return {
18932
19110
  columnCount: getCommonValue(sections.map(getSectionColumnCount)),
18933
19111
  columnGap: getCommonValue(sections.map(getSectionColumnGap)),
@@ -18938,6 +19116,38 @@ function getSectionSettingValues(sections) {
18938
19116
  sectionType: getCommonValue(sections.map((section) => {
18939
19117
  var _section$sectionType;
18940
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;
18941
19151
  }))
18942
19152
  };
18943
19153
  }
@@ -18951,6 +19161,23 @@ function createSectionColumnUpdates(sections, documentStyle, change) {
18951
19161
  };
18952
19162
  });
18953
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
+ }
18954
19181
  function getSelectedSections(documentDataModel, ranges) {
18955
19182
  const body = documentDataModel.getBody();
18956
19183
  if (!body || ranges.length === 0 || ranges.some((range) => Boolean(range.segmentId))) return [];
@@ -18964,14 +19191,24 @@ function getSelectedSections(documentDataModel, ranges) {
18964
19191
  });
18965
19192
  });
18966
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
+ }
18967
19199
  function useSectionSetting() {
19200
+ var _documentDataModel$ge;
18968
19201
  const commandService = useDependency(ICommandService);
18969
19202
  const instanceService = useDependency(IUniverInstanceService);
18970
19203
  const selectionManager = useDependency(DocSelectionManagerService);
19204
+ const controller = useDependency(DocSectionSettingController);
18971
19205
  const documentDataModel = useObservable(useMemo(() => instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), [instanceService]));
18972
19206
  const resolveSections = () => (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === DocumentFlavor.TRADITIONAL ? getSelectedSections(documentDataModel, selectionManager.getDocRanges()) : [];
18973
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]);
18974
- 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) : [];
18975
19212
  const update = (updates) => {
18976
19213
  if (!documentDataModel || updates.length === 0) return Promise.resolve(false);
18977
19214
  return commandService.executeCommand(UpdateDocumentSectionCommand.id, {
@@ -18986,7 +19223,15 @@ function useSectionSetting() {
18986
19223
  return {
18987
19224
  valid: Boolean(documentDataModel && sections.length > 0),
18988
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,
18989
19231
  ...values,
19232
+ selectSection(sectionId) {
19233
+ navigateToSection(controller, documentDataModel !== null && documentDataModel !== void 0 ? documentDataModel : void 0, allSections, sectionId);
19234
+ },
18990
19235
  setColumnCount(value) {
18991
19236
  const next = Math.max(1, Math.round(value));
18992
19237
  return update(documentDataModel ? createSectionColumnUpdates(sections, documentDataModel.getDocumentStyle(), { columnCount: next }) : []);
@@ -19000,6 +19245,44 @@ function useSectionSetting() {
19000
19245
  },
19001
19246
  setSectionType(value) {
19002
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)) });
19003
19286
  }
19004
19287
  };
19005
19288
  }
@@ -19010,9 +19293,9 @@ function SettingRow(props) {
19010
19293
  return /* @__PURE__ */ jsxs("div", {
19011
19294
  className: "univer-grid univer-min-h-8 univer-items-center univer-gap-3",
19012
19295
  style: { gridTemplateColumns: "minmax(0, 1fr) minmax(140px, 160px)" },
19013
- children: [/* @__PURE__ */ jsx("div", {
19296
+ children: [/* @__PURE__ */ jsxs("div", {
19014
19297
  className: "univer-min-w-0 univer-text-xs univer-leading-5 univer-text-gray-900 dark:!univer-text-gray-100",
19015
- children: props.label
19298
+ children: [props.label, props.unit]
19016
19299
  }), /* @__PURE__ */ jsx("div", {
19017
19300
  className: "univer-w-full univer-min-w-0",
19018
19301
  children: props.children
@@ -19020,27 +19303,11 @@ function SettingRow(props) {
19020
19303
  });
19021
19304
  }
19022
19305
  function SectionSetting() {
19306
+ var _setting$selectedSect;
19023
19307
  const localeService = useDependency(LocaleService);
19024
19308
  const controller = useDependency(DocSectionSettingController);
19025
19309
  const setting = useSectionSetting();
19026
- const labels = useMemo(() => ({
19027
- selectedSections: localeService.t("docs-ui.doc.sectionSetting.selectedSections", String(setting.selectedCount)),
19028
- columnCount: localeService.t("docs-ui.doc.sectionSetting.columnCount"),
19029
- columnGap: `${localeService.t("docs-ui.doc.sectionSetting.columnGap")}(px)`,
19030
- columnSeparator: localeService.t("docs-ui.doc.sectionSetting.columnSeparator"),
19031
- none: localeService.t("docs-ui.doc.sectionSetting.none"),
19032
- betweenColumns: localeService.t("docs-ui.doc.sectionSetting.betweenColumns"),
19033
- sectionStart: localeService.t("docs-ui.doc.sectionSetting.sectionStart"),
19034
- unspecified: localeService.t("docs-ui.doc.sectionSetting.unspecified"),
19035
- continuous: localeService.t("docs-ui.doc.sectionSetting.continuous"),
19036
- nextPage: localeService.t("docs-ui.doc.sectionSetting.nextPage"),
19037
- evenPage: localeService.t("docs-ui.doc.sectionSetting.evenPage"),
19038
- oddPage: localeService.t("docs-ui.doc.sectionSetting.oddPage")
19039
- }), [
19040
- useObservable(localeService.currentLocale$),
19041
- localeService,
19042
- setting.selectedCount
19043
- ]);
19310
+ useObservable(localeService.currentLocale$);
19044
19311
  useEffect(() => {
19045
19312
  if (!setting.valid) controller.closePanel();
19046
19313
  }, [controller, setting.valid]);
@@ -19049,13 +19316,27 @@ function SectionSetting() {
19049
19316
  className: "univer-box-border univer-w-full",
19050
19317
  children: [setting.selectedCount > 1 && /* @__PURE__ */ jsx("div", {
19051
19318
  className: "univer-mb-4 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-300",
19052
- children: labels.selectedSections
19319
+ children: localeService.t("docs-ui.doc.sectionSetting.selectedSections", `${setting.selectedCount}`)
19053
19320
  }), /* @__PURE__ */ jsxs("div", {
19054
19321
  className: "univer-grid univer-gap-3",
19055
19322
  children: [
19056
19323
  /* @__PURE__ */ jsx(SettingRow, {
19057
- 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"),
19058
19338
  children: /* @__PURE__ */ jsx(InputNumber, {
19339
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.columnCount"),
19059
19340
  className: "univer-w-full",
19060
19341
  min: 1,
19061
19342
  max: 12,
@@ -19066,8 +19347,10 @@ function SectionSetting() {
19066
19347
  })
19067
19348
  }),
19068
19349
  /* @__PURE__ */ jsx(SettingRow, {
19069
- label: labels.columnGap,
19350
+ label: localeService.t("docs-ui.doc.sectionSetting.columnGap"),
19351
+ unit: " (px)",
19070
19352
  children: /* @__PURE__ */ jsx(InputNumber, {
19353
+ "aria-label": localeService.t("docs-ui.doc.sectionSetting.columnGap"),
19071
19354
  className: "univer-w-full",
19072
19355
  min: 0,
19073
19356
  max: 1e3,
@@ -19078,49 +19361,183 @@ function SectionSetting() {
19078
19361
  })
19079
19362
  }),
19080
19363
  /* @__PURE__ */ jsx(SettingRow, {
19081
- label: labels.columnSeparator,
19364
+ label: localeService.t("docs-ui.doc.sectionSetting.columnSeparator"),
19082
19365
  children: /* @__PURE__ */ jsx(Select, {
19083
19366
  className: "univer-w-full",
19084
- value: setting.separatorType == null ? "" : String(setting.separatorType),
19085
- options: [{
19086
- label: labels.none,
19087
- value: String(ColumnSeparatorType.NONE)
19088
- }, {
19089
- label: labels.betweenColumns,
19090
- value: String(ColumnSeparatorType.BETWEEN_EACH_COLUMN)
19091
- }],
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
+ ],
19092
19383
  onChange: (value) => setting.setSeparatorType(Number(value))
19093
19384
  })
19094
19385
  }),
19095
19386
  /* @__PURE__ */ jsx(SettingRow, {
19096
- label: labels.sectionStart,
19387
+ label: localeService.t("docs-ui.doc.sectionSetting.sectionStart"),
19097
19388
  children: /* @__PURE__ */ jsx(Select, {
19098
19389
  className: "univer-w-full",
19099
- value: setting.sectionType == null ? "" : String(setting.sectionType),
19390
+ value: setting.sectionType == null ? "" : `${setting.sectionType}`,
19100
19391
  options: [
19392
+ ...setting.sectionType == null ? [{
19393
+ label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
19394
+ value: "",
19395
+ disabled: true
19396
+ }] : [],
19397
+ {
19398
+ label: localeService.t("docs-ui.doc.sectionSetting.unspecified"),
19399
+ value: `${SectionType.SECTION_TYPE_UNSPECIFIED}`
19400
+ },
19101
19401
  {
19102
- label: labels.unspecified,
19103
- value: String(SectionType.SECTION_TYPE_UNSPECIFIED)
19402
+ label: localeService.t("docs-ui.doc.sectionSetting.continuous"),
19403
+ value: `${SectionType.CONTINUOUS}`
19104
19404
  },
19105
19405
  {
19106
- label: labels.continuous,
19107
- value: String(SectionType.CONTINUOUS)
19406
+ label: localeService.t("docs-ui.doc.sectionSetting.nextColumn"),
19407
+ value: `${SectionType.NEXT_COLUMN}`
19108
19408
  },
19109
19409
  {
19110
- label: labels.nextPage,
19111
- value: String(SectionType.NEXT_PAGE)
19410
+ label: localeService.t("docs-ui.doc.sectionSetting.nextPage"),
19411
+ value: `${SectionType.NEXT_PAGE}`
19112
19412
  },
19113
19413
  {
19114
- label: labels.evenPage,
19115
- value: String(SectionType.EVEN_PAGE)
19414
+ label: localeService.t("docs-ui.doc.sectionSetting.evenPage"),
19415
+ value: `${SectionType.EVEN_PAGE}`
19116
19416
  },
19117
19417
  {
19118
- label: labels.oddPage,
19119
- value: String(SectionType.ODD_PAGE)
19418
+ label: localeService.t("docs-ui.doc.sectionSetting.oddPage"),
19419
+ value: `${SectionType.ODD_PAGE}`
19120
19420
  }
19121
19421
  ],
19122
19422
  onChange: (value) => setting.setSectionType(Number(value))
19123
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
+ })
19124
19541
  })
19125
19542
  ]
19126
19543
  })]
@@ -19225,6 +19642,7 @@ let ComponentsController = class ComponentsController extends Disposable {
19225
19642
  AddImageIcon,
19226
19643
  BoldIcon,
19227
19644
  CopyDoubleIcon,
19645
+ ColumnIcon,
19228
19646
  CutIcon,
19229
19647
  DeleteColumnDoubleIcon,
19230
19648
  DeleteIcon,
@@ -19366,7 +19784,7 @@ let DocAutoFormatController = class DocAutoFormatController extends Disposable {
19366
19784
  match: (context) => {
19367
19785
  const { selection, unit } = context;
19368
19786
  const { startNodePosition, endNodePosition } = selection;
19369
- const renderObject = this._renderManagerService.getRenderById(unit.getUnitId());
19787
+ const renderObject = this._renderManagerService.getRenderUnitById(unit.getUnitId());
19370
19788
  const skeleton = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton();
19371
19789
  if (skeleton == null) return false;
19372
19790
  if (startNodePosition && endNodePosition && isInSameTableCellData(skeleton, startNodePosition, endNodePosition)) return true;
@@ -19504,9 +19922,10 @@ var TextBubbleShape = class TextBubbleShape extends Shape {
19504
19922
  ctx.save();
19505
19923
  ctx.font = "13px Source Han Sans CN";
19506
19924
  const textWidth = ctx.measureText(text).width;
19925
+ const realInfoWidth = Math.min(textWidth + 2 * 6, 200);
19507
19926
  drawBubble(ctx, {
19508
19927
  height: 18,
19509
- width: Math.min(textWidth + 2 * 6, 200),
19928
+ width: realInfoWidth,
19510
19929
  radius: 4,
19511
19930
  fill: color,
19512
19931
  evented: false
@@ -19827,13 +20246,14 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19827
20246
  }));
19828
20247
  }
19829
20248
  _handleShiftMoveSelection(direction, granularity = "character") {
19830
- var _this$_renderManagerS, _docDataModel$getSelf, _body$dataStream$leng, _docDataModel$getCust;
20249
+ var _docDataModel$getSelf, _body$dataStream$leng, _docDataModel$getCust;
19831
20250
  const activeRange = this._textSelectionManagerService.getActiveTextRange();
19832
20251
  const allRanges = this._textSelectionManagerService.getTextRanges();
19833
20252
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
19834
20253
  if (docDataModel == null) return;
19835
- const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderById(docDataModel.getUnitId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getSkeleton();
19836
- 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;
19837
20257
  if (activeRange == null || skeleton == null || docObject == null) return;
19838
20258
  const { startOffset, endOffset, style, collapsed, direction: rangeDirection, segmentId, startNodePosition, endNodePosition, segmentPage } = activeRange;
19839
20259
  const normalizedSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : "";
@@ -19845,11 +20265,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19845
20265
  min = Math.min(min, range.startOffset);
19846
20266
  max = Math.max(max, range.endOffset);
19847
20267
  }
19848
- this._textSelectionManagerService.replaceTextRanges([{
20268
+ this._textSelectionManagerService.replaceDocRanges([{
19849
20269
  startOffset: direction === Direction.LEFT || direction === Direction.UP ? max : min,
19850
20270
  endOffset: direction === Direction.LEFT || direction === Direction.UP ? min : max,
19851
20271
  style
19852
- }], false);
20272
+ }], void 0, false);
19853
20273
  return;
19854
20274
  }
19855
20275
  const anchorOffset = collapsed ? startOffset : rangeDirection === RANGE_DIRECTION.FORWARD ? startOffset : endOffset;
@@ -19863,11 +20283,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19863
20283
  if (nextOffset == null || nextOffset === focusOffset) return;
19864
20284
  const normalizedNextOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, nextOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19865
20285
  if (normalizedNextOffset == null || normalizedNextOffset === focusOffset) return;
19866
- this._textSelectionManagerService.replaceTextRanges([{
20286
+ this._textSelectionManagerService.replaceDocRanges([{
19867
20287
  startOffset: anchorOffset,
19868
20288
  endOffset: normalizedNextOffset,
19869
20289
  style
19870
- }], false);
20290
+ }], void 0, false);
19871
20291
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), normalizedNextOffset);
19872
20292
  return;
19873
20293
  }
@@ -19877,11 +20297,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19877
20297
  const curGlyph = skeleton.findNodeByCharIndex(focusOffset, segmentId, segmentPage);
19878
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);
19879
20299
  focusOffset = Math.min(dataStreamLength - 2, Math.max(0, focusOffset));
19880
- this._textSelectionManagerService.replaceTextRanges([{
20300
+ this._textSelectionManagerService.replaceDocRanges([{
19881
20301
  startOffset: anchorOffset,
19882
20302
  endOffset: focusOffset,
19883
20303
  style
19884
- }], false);
20304
+ }], void 0, false);
19885
20305
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), focusOffset);
19886
20306
  } else {
19887
20307
  const focusGlyph = skeleton.findNodeByCharIndex(focusOffset, segmentId, segmentPage);
@@ -19891,32 +20311,33 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19891
20311
  if (newPos == null) {
19892
20312
  const newFocusOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === Direction.UP ? 0 : dataStreamLength - 2, direction, normalizedSegmentId, normalizedSegmentPage);
19893
20313
  if (newFocusOffset == null || newFocusOffset === focusOffset) return;
19894
- this._textSelectionManagerService.replaceTextRanges([{
20314
+ this._textSelectionManagerService.replaceDocRanges([{
19895
20315
  startOffset: anchorOffset,
19896
20316
  endOffset: newFocusOffset,
19897
20317
  style
19898
- }], false);
20318
+ }], void 0, false);
19899
20319
  return;
19900
20320
  }
19901
20321
  const newActiveRange = new NodePositionConvertToCursor(documentOffsetConfig, skeleton).getRangePointData(newPos, newPos).cursorList[0];
19902
20322
  const newFocusOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, newActiveRange.endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19903
20323
  if (newFocusOffset == null || newFocusOffset === focusOffset) return;
19904
- this._textSelectionManagerService.replaceTextRanges([{
20324
+ this._textSelectionManagerService.replaceDocRanges([{
19905
20325
  startOffset: anchorOffset,
19906
20326
  endOffset: newFocusOffset,
19907
20327
  style
19908
- }], false);
20328
+ }], void 0, false);
19909
20329
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), newFocusOffset);
19910
20330
  }
19911
20331
  }
19912
20332
  _handleMoveCursor(direction, granularity = "character") {
19913
- var _this$_renderManagerS2, _docDataModel$getSelf2, _body$dataStream$leng2, _docDataModel$getCust2;
20333
+ var _docDataModel$getSelf2, _body$dataStream$leng2, _docDataModel$getCust2;
19914
20334
  const activeRange = this._textSelectionManagerService.getActiveTextRange();
19915
20335
  const allRanges = this._textSelectionManagerService.getTextRanges();
19916
20336
  const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
19917
20337
  if (docDataModel == null) return false;
19918
- const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(docDataModel.getUnitId())) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSkeletonManagerService).getSkeleton();
19919
- 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;
19920
20341
  if (activeRange == null || skeleton == null || docObject == null || allRanges == null) return;
19921
20342
  const { startOffset, endOffset, style, collapsed, segmentId, startNodePosition, endNodePosition, segmentPage } = activeRange;
19922
20343
  const normalizedSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : "";
@@ -19940,11 +20361,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19940
20361
  if (cursor == null) return;
19941
20362
  cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, cursor, direction, normalizedSegmentId, normalizedSegmentPage);
19942
20363
  if (cursor == null) return;
19943
- this._textSelectionManagerService.replaceTextRanges([{
20364
+ this._textSelectionManagerService.replaceDocRanges([{
19944
20365
  startOffset: cursor,
19945
20366
  endOffset: cursor,
19946
20367
  style
19947
- }], false);
20368
+ }], void 0, false);
19948
20369
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
19949
20370
  return;
19950
20371
  }
@@ -19973,11 +20394,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19973
20394
  cursor = this._normalizeCursorOffset(body.dataStream, customRanges, cursor, direction);
19974
20395
  const normalizedCursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, cursor, direction, normalizedSegmentId, normalizedSegmentPage);
19975
20396
  if (normalizedCursor == null) return;
19976
- this._textSelectionManagerService.replaceTextRanges([{
20397
+ this._textSelectionManagerService.replaceDocRanges([{
19977
20398
  startOffset: normalizedCursor,
19978
20399
  endOffset: normalizedCursor,
19979
20400
  style
19980
- }], false);
20401
+ }], void 0, false);
19981
20402
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), normalizedCursor);
19982
20403
  } else {
19983
20404
  const startNode = skeleton.findNodeByCharIndex(startOffset, segmentId, segmentPage);
@@ -19989,21 +20410,21 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
19989
20410
  if (collapsed) cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === Direction.UP ? 0 : dataStreamLength - 2, direction, normalizedSegmentId, normalizedSegmentPage);
19990
20411
  else cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === Direction.UP ? startOffset : endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
19991
20412
  if (cursor == null) return;
19992
- this._textSelectionManagerService.replaceTextRanges([{
20413
+ this._textSelectionManagerService.replaceDocRanges([{
19993
20414
  startOffset: cursor,
19994
20415
  endOffset: cursor,
19995
20416
  style
19996
- }], false);
20417
+ }], void 0, false);
19997
20418
  return;
19998
20419
  }
19999
20420
  const newActiveRange = new NodePositionConvertToCursor(documentOffsetConfig, skeleton).getRangePointData(newPos, newPos).cursorList[0];
20000
20421
  const cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, newActiveRange.endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
20001
20422
  if (cursor == null) return;
20002
- this._textSelectionManagerService.replaceTextRanges([{
20423
+ this._textSelectionManagerService.replaceDocRanges([{
20003
20424
  startOffset: cursor,
20004
20425
  endOffset: cursor,
20005
20426
  style
20006
- }], false);
20427
+ }], void 0, false);
20007
20428
  this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
20008
20429
  }
20009
20430
  }
@@ -20454,8 +20875,8 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
20454
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;
20455
20876
  }
20456
20877
  _scrollToFocusNodePosition(unitId, offset) {
20457
- var _this$_renderManagerS3;
20458
- 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);
20459
20880
  if (backScrollController == null) return;
20460
20881
  backScrollController.scrollToRange({
20461
20882
  startOffset: offset,
@@ -20463,9 +20884,6 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
20463
20884
  collapsed: true
20464
20885
  });
20465
20886
  }
20466
- _getDocObject() {
20467
- return getDocObject(this._univerInstanceService, this._renderManagerService);
20468
- }
20469
20887
  };
20470
20888
  DocMoveCursorController = __decorate([
20471
20889
  __decorateParam(0, IUniverInstanceService),
@@ -20733,7 +21151,7 @@ let DocEditorBridgeController = class DocEditorBridgeController extends Disposab
20733
21151
  disposableCollection.dispose();
20734
21152
  if (!unit) return;
20735
21153
  const unitId = unit.getUnitId();
20736
- const render = this._renderManagerService.getRenderById(unitId);
21154
+ const render = this._renderManagerService.getRenderUnitById(unitId);
20737
21155
  const canvasEle = render === null || render === void 0 ? void 0 : render.engine.getCanvas().getCanvasEle();
20738
21156
  if (canvasEle == null) return;
20739
21157
  const disposable = fromEvent(canvasEle, "mousedown").subscribe((evt) => {
@@ -20752,8 +21170,8 @@ let DocEditorBridgeController = class DocEditorBridgeController extends Disposab
20752
21170
  if (updateCommandList.includes(command.id)) {
20753
21171
  const { unitId } = command.params;
20754
21172
  if (this._editorService.isSheetEditor(unitId) || unitId !== this._context.unitId) return;
20755
- const editor = this._editorService.getEditor(unitId);
20756
- if (editor && !editor.params.scrollBar) this._resize(unitId);
21173
+ const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
21174
+ if (editorRenderConfig && !editorRenderConfig.scrollBar) this._resize(unitId);
20757
21175
  }
20758
21176
  }));
20759
21177
  }
@@ -21218,7 +21636,7 @@ let DocZoomRenderController = class DocZoomRenderController extends Disposable {
21218
21636
  this._initCommandExecutedListener();
21219
21637
  this._isSheetEditor = this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
21220
21638
  const currentSheet = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
21221
- const sheetRenderer = currentSheet && this._renderManagerService.getRenderById(currentSheet.getUnitId());
21639
+ const sheetRenderer = currentSheet && this._renderManagerService.getRenderUnitById(currentSheet.getUnitId());
21222
21640
  this._initTimer = window.setTimeout(() => {
21223
21641
  const zoomRatio = sheetRenderer && this._isSheetEditor ? sheetRenderer.scene.scaleX : getDocEffectiveZoomRatio(this._context.unit);
21224
21642
  this.updateViewZoom(zoomRatio, true);
@@ -21384,7 +21802,6 @@ let DocsRenderService = class DocsRenderService extends RxDisposable {
21384
21802
  this._init();
21385
21803
  }
21386
21804
  _init() {
21387
- this._renderManagerService.createRender$.pipe(takeUntil(this.dispose$)).subscribe((unitId) => this._createRenderWithId(unitId));
21388
21805
  this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_DOC).forEach((documentModel) => {
21389
21806
  var _this$_instanceSrv$ge;
21390
21807
  return this._createRenderer(documentModel, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(documentModel.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
@@ -21399,7 +21816,7 @@ let DocsRenderService = class DocsRenderService extends RxDisposable {
21399
21816
  this._createRenderWithId(unitId, doc);
21400
21817
  return;
21401
21818
  }
21402
- const renderer = this._renderManagerService.getRenderById(unitId);
21819
+ const renderer = this._renderManagerService.getRenderUnitById(unitId);
21403
21820
  if (renderer) this._syncRendererCanvas(renderer, doc);
21404
21821
  }
21405
21822
  _createRenderWithId(unitId, doc) {
@@ -21661,13 +22078,14 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends Plugin {
21661
22078
  DocParagraphSettingCommand,
21662
22079
  InnerPasteCommand,
21663
22080
  CutContentCommand,
21664
- ReplaceContentCommand,
21665
22081
  ReplaceSnapshotCommand,
21666
22082
  CoverContentCommand,
21667
22083
  SetDocZoomRatioCommand,
21668
22084
  DocSelectAllCommand,
21669
22085
  DocParagraphSettingPanelOperation,
21670
22086
  DocSectionSettingPanelOperation,
22087
+ InsertDocumentColumnBreakOperation,
22088
+ InsertDocumentSectionBreakOperation,
21671
22089
  MoveCursorOperation,
21672
22090
  MoveSelectionOperation,
21673
22091
  ReplaceTextRunsCommand,
@@ -21817,7 +22235,7 @@ _defineProperty(UniverDocsUIPlugin, "pluginName", "DOC_UI_PLUGIN");
21817
22235
  _defineProperty(UniverDocsUIPlugin, "packageName", name);
21818
22236
  _defineProperty(UniverDocsUIPlugin, "version", version);
21819
22237
  UniverDocsUIPlugin = __decorate([
21820
- DependentOn(UniverRenderEnginePlugin, UniverDocsPlugin),
22238
+ DependentOn(UniverDocsPlugin, UniverRenderEnginePlugin),
21821
22239
  __decorateParam(1, Inject(Injector)),
21822
22240
  __decorateParam(2, IRenderManagerService),
21823
22241
  __decorateParam(3, ICommandService),
@@ -21898,7 +22316,7 @@ function useEditor(opts) {
21898
22316
  const editorService = useDependency(IEditorService);
21899
22317
  useLayoutEffect(() => {
21900
22318
  if (container.current) {
21901
- const initialDoc = typeof initialValue === "string" ? void 0 : Tools.deepClone(initialValue);
22319
+ const initialDoc = typeof initialValue === "string" ? RichTextBuilder.create().insertText(initialValue).getData() : Tools.deepClone(initialValue);
21902
22320
  const snapshot = {
21903
22321
  body: {
21904
22322
  dataStream: typeof initialValue === "string" ? `${initialValue}\r\n` : "\r\n",
@@ -21991,7 +22409,7 @@ const useEditorClickOutside = (editorId, containerRef, onClickOutside) => {
21991
22409
  */
21992
22410
  function useIsFocusing(editorId) {
21993
22411
  var _docSelectionRenderSe;
21994
- const renderer = useDependency(IRenderManagerService).getRenderById(editorId);
22412
+ const renderer = useDependency(IRenderManagerService).getRenderUnitById(editorId);
21995
22413
  const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
21996
22414
  const selections = useObservable(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.textSelectionInner$);
21997
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)));
@@ -22005,7 +22423,8 @@ function useKeyboardEvent(isNeed, config, editor) {
22005
22423
  const key = useMemo(() => generateRandomId(4), []);
22006
22424
  useEffect(() => {
22007
22425
  if (!editor || !isNeed || !config) return;
22008
- const operationId = `sheet.operation.editor-${editor.getEditorId()}-keyboard-${key}`;
22426
+ const editorId = editor.getEditorId();
22427
+ const operationId = `sheet.operation.editor-${editorId}-keyboard-${key}`;
22009
22428
  const d = new DisposableCollection();
22010
22429
  d.add(commandService.registerCommand({
22011
22430
  id: operationId,
@@ -22019,6 +22438,8 @@ function useKeyboardEvent(isNeed, config, editor) {
22019
22438
  return {
22020
22439
  id: operationId,
22021
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,
22022
22443
  preconditions: () => true,
22023
22444
  priority: 901,
22024
22445
  staticParameters: {
@@ -22294,7 +22715,7 @@ const RichTextEditor = (props) => {
22294
22715
  autoFocus,
22295
22716
  isSingle
22296
22717
  });
22297
- const renderer = useDependency(IRenderManagerService).getRenderById(editorId);
22718
+ const renderer = useDependency(IRenderManagerService).getRenderUnitById(editorId);
22298
22719
  const selectionIsFocusing = useIsFocusing(editorId);
22299
22720
  const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
22300
22721
  const editorFocused = useObservable(editor ? () => {
@@ -22381,4 +22802,4 @@ const RichTextEditor = (props) => {
22381
22802
  };
22382
22803
 
22383
22804
  //#endregion
22384
- 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 };