@univerjs/docs-ui 1.0.2 → 1.0.4

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 (109) hide show
  1. package/lib/cjs/index.js +1315 -349
  2. package/lib/cjs/locale/ar-SA.js +13 -0
  3. package/lib/cjs/locale/ca-ES.js +13 -0
  4. package/lib/cjs/locale/de-DE.js +13 -0
  5. package/lib/cjs/locale/en-US.js +13 -0
  6. package/lib/cjs/locale/es-ES.js +13 -0
  7. package/lib/cjs/locale/fa-IR.js +13 -0
  8. package/lib/cjs/locale/fr-FR.js +13 -0
  9. package/lib/cjs/locale/id-ID.js +13 -0
  10. package/lib/cjs/locale/it-IT.js +13 -0
  11. package/lib/cjs/locale/ja-JP.js +13 -0
  12. package/lib/cjs/locale/ko-KR.js +13 -0
  13. package/lib/cjs/locale/pl-PL.js +13 -0
  14. package/lib/cjs/locale/pt-BR.js +13 -0
  15. package/lib/cjs/locale/ru-RU.js +13 -0
  16. package/lib/cjs/locale/sk-SK.js +13 -0
  17. package/lib/cjs/locale/vi-VN.js +13 -0
  18. package/lib/cjs/locale/zh-CN.js +13 -0
  19. package/lib/cjs/locale/zh-HK.js +13 -0
  20. package/lib/cjs/locale/zh-TW.js +13 -0
  21. package/lib/es/index.js +1319 -355
  22. package/lib/es/locale/ar-SA.js +13 -0
  23. package/lib/es/locale/ca-ES.js +13 -0
  24. package/lib/es/locale/de-DE.js +13 -0
  25. package/lib/es/locale/en-US.js +13 -0
  26. package/lib/es/locale/es-ES.js +13 -0
  27. package/lib/es/locale/fa-IR.js +13 -0
  28. package/lib/es/locale/fr-FR.js +13 -0
  29. package/lib/es/locale/id-ID.js +13 -0
  30. package/lib/es/locale/it-IT.js +13 -0
  31. package/lib/es/locale/ja-JP.js +13 -0
  32. package/lib/es/locale/ko-KR.js +13 -0
  33. package/lib/es/locale/pl-PL.js +13 -0
  34. package/lib/es/locale/pt-BR.js +13 -0
  35. package/lib/es/locale/ru-RU.js +13 -0
  36. package/lib/es/locale/sk-SK.js +13 -0
  37. package/lib/es/locale/vi-VN.js +13 -0
  38. package/lib/es/locale/zh-CN.js +13 -0
  39. package/lib/es/locale/zh-HK.js +13 -0
  40. package/lib/es/locale/zh-TW.js +13 -0
  41. package/lib/index.css +21 -0
  42. package/lib/index.js +1319 -355
  43. package/lib/locale/ar-SA.js +13 -0
  44. package/lib/locale/ca-ES.js +13 -0
  45. package/lib/locale/de-DE.js +13 -0
  46. package/lib/locale/en-US.js +13 -0
  47. package/lib/locale/es-ES.js +13 -0
  48. package/lib/locale/fa-IR.js +13 -0
  49. package/lib/locale/fr-FR.js +13 -0
  50. package/lib/locale/id-ID.js +13 -0
  51. package/lib/locale/it-IT.js +13 -0
  52. package/lib/locale/ja-JP.js +13 -0
  53. package/lib/locale/ko-KR.js +13 -0
  54. package/lib/locale/pl-PL.js +13 -0
  55. package/lib/locale/pt-BR.js +13 -0
  56. package/lib/locale/ru-RU.js +13 -0
  57. package/lib/locale/sk-SK.js +13 -0
  58. package/lib/locale/vi-VN.js +13 -0
  59. package/lib/locale/zh-CN.js +13 -0
  60. package/lib/locale/zh-HK.js +13 -0
  61. package/lib/locale/zh-TW.js +13 -0
  62. package/lib/types/commands/commands/clipboard.inner.command.d.ts +2 -0
  63. package/lib/types/commands/commands/doc-delete.command.d.ts +5 -2
  64. package/lib/types/commands/commands/doc-header-footer.command.d.ts +2 -0
  65. package/lib/types/commands/commands/insert-header-footer-field.command.d.ts +28 -0
  66. package/lib/types/commands/commands/refresh-header-footer-fields.command.d.ts +22 -0
  67. package/lib/types/commands/operations/doc-header-footer-ribbon.operation.d.ts +19 -0
  68. package/lib/types/controllers/doc-header-footer-ribbon.controller.d.ts +31 -0
  69. package/lib/types/controllers/render-controllers/doc-field.render-controller.d.ts +31 -0
  70. package/lib/types/controllers/ui.controller.d.ts +1 -0
  71. package/lib/types/index.d.ts +1 -0
  72. package/lib/types/locale/en-US.d.ts +13 -0
  73. package/lib/types/menu/context-menu.d.ts +1 -0
  74. package/lib/types/menu/header-footer-ribbon.d.ts +17 -0
  75. package/lib/types/services/clipboard/clipboard.service.d.ts +4 -0
  76. package/lib/types/services/doc-event-manager.service.d.ts +1 -0
  77. package/lib/types/services/editor/editor-runtime-config.d.ts +2 -0
  78. package/lib/types/services/selection/doc-selection-render.service.d.ts +2 -0
  79. package/lib/types/services/selection/text-range.d.ts +6 -1
  80. package/lib/types/services/selection/word-boundary.d.ts +1 -0
  81. package/lib/types/shortcuts/core-editing.shortcut.d.ts +4 -0
  82. package/lib/types/shortcuts/format.shortcut.d.ts +1 -0
  83. package/lib/types/shortcuts/utils.d.ts +1 -0
  84. package/lib/types/utils/date-time-field.d.ts +22 -0
  85. package/lib/types/views/header-footer/panel/DocHeaderFooterFields.d.ts +19 -0
  86. package/lib/types/views/header-footer/panel/DocHeaderFooterRibbonControl.d.ts +20 -0
  87. package/lib/types/views/header-footer/panel/component-name.d.ts +2 -0
  88. package/lib/types/views/header-footer/panel/use-header-footer-options.d.ts +2 -2
  89. package/lib/umd/index.js +15 -14
  90. package/lib/umd/locale/ar-SA.js +1 -1
  91. package/lib/umd/locale/ca-ES.js +1 -1
  92. package/lib/umd/locale/de-DE.js +1 -1
  93. package/lib/umd/locale/en-US.js +1 -1
  94. package/lib/umd/locale/es-ES.js +1 -1
  95. package/lib/umd/locale/fa-IR.js +1 -1
  96. package/lib/umd/locale/fr-FR.js +1 -1
  97. package/lib/umd/locale/id-ID.js +1 -1
  98. package/lib/umd/locale/it-IT.js +1 -1
  99. package/lib/umd/locale/ja-JP.js +1 -1
  100. package/lib/umd/locale/ko-KR.js +1 -1
  101. package/lib/umd/locale/pl-PL.js +1 -1
  102. package/lib/umd/locale/pt-BR.js +1 -1
  103. package/lib/umd/locale/ru-RU.js +1 -1
  104. package/lib/umd/locale/sk-SK.js +1 -1
  105. package/lib/umd/locale/vi-VN.js +1 -1
  106. package/lib/umd/locale/zh-CN.js +1 -1
  107. package/lib/umd/locale/zh-HK.js +1 -1
  108. package/lib/umd/locale/zh-TW.js +1 -1
  109. package/package.json +10 -10
package/lib/es/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { BaselineOffset, BlockType, BooleanNumber, BuildTextUtils, COLORS, ColorKit, ColumnSeparatorType, CommandType, CustomDecorationType, 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, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_STANDALONE, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_UNIVER_EDITOR, HorizontalAlign, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterceptorManager, JSON1, JSONX, LOCALE_META, LRUMap, ListGlyphType, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, NAMED_STYLE_MAP, NamedStyleType, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PAPER_TYPES, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, PresetListType, QuickListTypeMap, RANGE_DIRECTION, Rectangle, RedoCommand, RegionService, RichTextBuilder, RxDisposable, SHEET_EDITOR_UNITS, SectionType, SliceBodyType, SpacingRule, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextX, TextXActionType, ThemeService, Tools, UndoCommand, UniverInstanceType, UpdateDocsAttributeType, VerticalAlign, checkForSubstrings, cloneBodyWithFreshParagraphIds, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createSectionId, debounce, fromEventSubject, generateRandomId, getBlockRangeInterval, getBodySlice, getBodySliceForTextXAction, getColorStyle, getCustomBlockIdsInSelections, getParagraphContentStartOffset, getParagraphContentStartOffsets, getPlainText, getRichTextEditPath, getSectionHeaderFooterReferenceKey, getTableRangeInterval, getTextRunSlice, isCommentEditorID, isInternalEditorID, isSafeUrl, merge, mergeOverrideWithDependencies, normalizeBody, remove, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, sequenceExecuteAsync, skipParseTagNames, toDisposable, touchDependencies, validateDocBodyStructure } from "@univerjs/core";
2
- import { CreateHeaderFooterCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocHistoryAction, DocInterceptorService, DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutSessionStatus, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentPermissionCommand, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsPlugin, UpdateDocumentSectionCommand, UpdateTextCommand, buildDocTransform, canEditDocumentTargets, consumeContentInsertRange, createSectionColumnProperties, generateParagraphs, getDocumentEditTargetObjectIds, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, getTopLevelSectionBreaks, isSheetLikeDocsCustomBlockChildType, resolveDocsCustomBlockSize, shouldUseInlineTextSelectionForDocsCustomBlockDrawing } from "@univerjs/docs";
1
+ import { BaselineOffset, BlockType, BooleanNumber, BuildTextUtils, COLORS, ColorKit, ColumnSeparatorType, CommandType, CustomDecorationType, 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, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_UNIVER_EDITOR, HorizontalAlign, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterceptorManager, JSON1, JSONX, LOCALE_META, LRUMap, ListGlyphType, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, NAMED_STYLE_MAP, NamedStyleType, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PAPER_TYPES, PRESERVE_INSERTED_PARAGRAPH_IDS, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, PresetListType, QuickListTypeMap, RANGE_DIRECTION, Rectangle, RedoCommand, RegionService, RichTextBuilder, RxDisposable, SHEET_EDITOR_UNITS, SectionType, SliceBodyType, SpacingRule, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextX, TextXActionType, ThemeService, Tools, UndoCommand, UniverInstanceType, UpdateDocsAttributeType, VerticalAlign, checkForSubstrings, cloneBodyWithFreshParagraphIds, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createInternalEditorID, createParagraphId, createSectionId, debounce, fromEventSubject, generateRandomId, getBlockRangeInterval, getBodySlice, getBodySliceForTextXAction, getColorStyle, getCustomBlockIdsInSelections, getParagraphContentStartOffset, getParagraphContentStartOffsets, getPlainText, getRichTextEditPath, getSectionHeaderFooterReferenceKey, getTableRangeInterval, getTextRunSlice, isCommentEditorID, isInternalEditorID, isSafeUrl, merge, mergeOverrideWithDependencies, normalizeBody, remove, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReference, resolveSectionHeaderFooterReferences, sequenceExecuteAsync, skipParseTagNames, toDisposable, touchDependencies, validateDocBodyStructure } from "@univerjs/core";
2
+ import { CreateHeaderFooterCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocHistoryAction, DocInterceptorService, DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutSessionStatus, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentPermissionCommand, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsPlugin, UpdateDocumentSectionCommand, UpdateTextCommand, buildDocTransform, canEditDocumentTargets, consumeContentInsertRange, createSectionColumnProperties, generateParagraphs, getDocumentEditTargetObjectIds, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, getTopLevelSectionBreaks, isSheetLikeDocsCustomBlockChildType, resolveDocsCustomBlockSize, shouldUseInlineTextSelectionForDocsCustomBlockDrawing, transformDocumentTextRanges } from "@univerjs/docs";
3
3
  import * as EngineRender from "@univerjs/engine-render";
4
4
  import { BaseObject, CURSOR_TYPE, DRAWING_OBJECT_UPPER_LAYER_INDEX, DeviceInputEventType, DocBackground, DocumentEditArea, DocumentSkeletonPageType, Documents, GlyphType, IRenderManagerService, Layer, LineType, Liquid, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, PageLayoutType, Path, RENDER_CLASS_TYPE, 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, getTopmostDocsTableHit, hasListGlyph, isFirstGlyph, isIndentByGlyph, parseDataStreamToTree, pixelToPt, ptToPixel, pxToNum, registerDocumentLayoutPresentation } from "@univerjs/engine-render";
5
- import { Button, Checkbox, Dropdown, DropdownMenu, InputNumber, MessageType, MobileSelect, Popup, Select, Separator, Tooltip, borderClassName, clsx, resetButtonClassName, scrollbarClassName, useMobileKeyboardViewportLayout } from "@univerjs/design";
5
+ import { Button, Checkbox, Dialog, Dropdown, DropdownMenu, InputNumber, MessageType, MobileSelect, Popup, Select, Separator, Tooltip, borderClassName, clsx, resetButtonClassName, scrollbarClassName, selectClassName, useMobileKeyboardViewportLayout } from "@univerjs/design";
6
6
  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, FormatPainterSessionService, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, ILayoutService, IMenuManagerService, IMessageService, IRibbonService, IShortcutService, ISidebarService, IUIPartsService, IWorkbenchService, IconManager, KeyCode, MOBILE_UI_MODE, MenuItemType, MenuManagerPosition, MetaKeys, MobileDrawer, MobileKeyboardInsetContext, MobileMenu, MobileZoomIndicator, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RectPopup, RibbonInsertGroup, RibbonStartGroup, SYMBOL_PICKER_COMPONENT, Slider, ToolbarButton, ToolbarItem, UniverMobileUIPlugin, bindFormatPainterCanvas, connectInjector, getMenuHiddenObservable, getMobileCanvasPanDelta, imageMimeTypeSet, objectPermissionMenuItemFactory, openObjectPermissionDialog, openObjectPermissionPanel, preventBrowserZoomInContainers, useConfigValue, useDependency, useEvent, useInjector, useMobileCanvasPanel, useMobileCanvasViewport, useObservable } from "@univerjs/ui";
7
7
  import { UnitAction, UnitObject } from "@univerjs/protocol";
8
8
  import { BehaviorSubject, EMPTY, Observable, Subject, animationFrameScheduler, auditTime, combineLatest, debounceTime, distinctUntilChanged, filter, first, fromEvent, map, merge as merge$1, observeOn, of, shareReplay, startWith, switchMap, take, takeUntil, tap, throttleTime } from "rxjs";
9
9
  import { bufferTime, filter as filter$1, map as map$1 } from "rxjs/operators";
10
- import { createElement, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
10
+ import { createElement, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
- import { AddImageIcon, AlignTextBothIcon, BoldIcon, CatalogueIcon, CheckMarkIcon, CloseIcon, ColorWheelMultiIcon, ColumnIcon, CopyDoubleIcon, CutIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DeleteTableDoubleIcon, DocPasteOptionsIcon, DocSettingIcon, DownIcon, FontColorDoubleIcon, GridIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, HeaderFooterIcon, HorizontallyIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, KeyboardIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LineIndentDecreaseIcon, LineIndentIncreaseIcon, LoadingMultiIcon, MenuIcon, MoreHorizontalIcon, MoreLeftIcon, MoreRightIcon, NoColorDoubleIcon, OrderIcon, PaintBucketDoubleIcon, ParagraphSettingIcon, PasteSpecialDoubleIcon, QuickAddIcon, ReduceDoubleIcon, ReduceIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, SectionSettingIcon, ShapeIcon, SmileIcon, StatisticalFunctionIcon, StrikethroughIcon, SubscriptIcon, SubtitleTypeIcon, SuperscriptIcon, SymbolsIcon, TextColorSwatchDoubleIcon, TextIcon, TextTypeIcon, TitleTypeIcon, TodoListDoubleIcon, UnderlineIcon, UnorderIcon, WriteIcon } from "@univerjs/icons";
12
+ import { AddImageIcon, AlignTextBothIcon, BoldIcon, CalendarIcon, CatalogueIcon, CheckMarkIcon, CloseIcon, ColorWheelMultiIcon, ColumnIcon, CopyDoubleIcon, CutIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DeleteTableDoubleIcon, DocPasteOptionsIcon, DocSettingIcon, DownIcon, FontColorDoubleIcon, GridIcon, H1Icon, H2Icon, H3Icon, H4Icon, H5Icon, HeaderFooterIcon, HorizontallyIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, KeyboardIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LineIndentDecreaseIcon, LineIndentIncreaseIcon, LoadingMultiIcon, MenuIcon, MoreDownIcon, MoreHorizontalIcon, MoreLeftIcon, MoreRightIcon, NoColorDoubleIcon, NumberIcon, OrderIcon, PaintBucketDoubleIcon, ParagraphSettingIcon, PasteSpecialDoubleIcon, QuickAddIcon, ReduceDoubleIcon, ReduceIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, SectionSettingIcon, ShapeIcon, SmileIcon, StatisticalFunctionIcon, StrikethroughIcon, SubscriptIcon, SubtitleTypeIcon, SuperscriptIcon, SymbolsIcon, TextColorSwatchDoubleIcon, TextIcon, TextTypeIcon, TitleTypeIcon, TodoListDoubleIcon, UnderlineIcon, UnorderIcon, WriteIcon } from "@univerjs/icons";
13
13
  import { getDrawingShapeKeyByDrawingSearch } from "@univerjs/drawing";
14
14
 
15
15
  //#region src/basics/docs-view-key.ts
@@ -1643,10 +1643,10 @@ var NodePositionConvertToCursor = class {
1643
1643
  let segmentPage = page;
1644
1644
  if (pageType === DocumentSkeletonPageType.HEADER) {
1645
1645
  var _skeHeaders$get;
1646
- segmentPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
1646
+ segmentPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(page.headerLayoutKey ?? pageWidth);
1647
1647
  } else if (pageType === DocumentSkeletonPageType.FOOTER) {
1648
1648
  var _skeFooters$get;
1649
- segmentPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
1649
+ segmentPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(page.footerLayoutKey ?? pageWidth);
1650
1650
  } else if (pageType === DocumentSkeletonPageType.NOTE) {
1651
1651
  var _getPageFromPath3, _page$notes;
1652
1652
  const noteId = (_getPageFromPath3 = getPageFromPath(skeletonData, path)) === null || _getPageFromPath3 === void 0 ? void 0 : _getPageFromPath3.segmentId;
@@ -1813,8 +1813,8 @@ function getCellPageFromSegmentPath(skeletonData, rootPage, path) {
1813
1813
  if (path[0] === "pages") return null;
1814
1814
  const segmentPages = [];
1815
1815
  const { headerId, footerId, pageWidth } = rootPage;
1816
- const headerPage = headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(pageWidth);
1817
- const footerPage = footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(pageWidth);
1816
+ const headerPage = headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(rootPage.headerLayoutKey ?? pageWidth);
1817
+ const footerPage = footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(rootPage.footerLayoutKey ?? pageWidth);
1818
1818
  if (headerPage != null) segmentPages.push(headerPage);
1819
1819
  if (footerPage != null) segmentPages.push(footerPage);
1820
1820
  for (const segmentPage of segmentPages) {
@@ -2229,7 +2229,7 @@ function getCellPageFromPositionPath(skeletonData, position) {
2229
2229
  const rootPage = skeletonData.pages[segmentPage];
2230
2230
  if (rootPage == null) return null;
2231
2231
  const { headerId, footerId, pageWidth } = rootPage;
2232
- const segmentPages = [headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(pageWidth), footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(pageWidth)];
2232
+ const segmentPages = [headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(rootPage.headerLayoutKey ?? pageWidth), footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(rootPage.footerLayoutKey ?? pageWidth)];
2233
2233
  for (const segmentPage of segmentPages) {
2234
2234
  if (segmentPage == null) continue;
2235
2235
  const page = getPageFromPath({
@@ -2307,7 +2307,7 @@ function getLineBounding(pointsGroup) {
2307
2307
  });
2308
2308
  }
2309
2309
  var TextRange = class {
2310
- constructor(_scene, _document, _docSkeleton, anchorNodePosition, focusNodePosition, style = NORMAL_TEXT_SELECTION_PLUGIN_STYLE, _segmentId = "", _segmentPage = -1) {
2310
+ constructor(_scene, _document, _docSkeleton, anchorNodePosition, focusNodePosition, style = NORMAL_TEXT_SELECTION_PLUGIN_STYLE, _segmentId = "", _segmentPage = -1, _logicalRange) {
2311
2311
  this._scene = _scene;
2312
2312
  this._document = _document;
2313
2313
  this._docSkeleton = _docSkeleton;
@@ -2316,6 +2316,7 @@ var TextRange = class {
2316
2316
  this.style = style;
2317
2317
  this._segmentId = _segmentId;
2318
2318
  this._segmentPage = _segmentPage;
2319
+ this._logicalRange = _logicalRange;
2319
2320
  _defineProperty(this, "rangeType", DOC_RANGE_TYPE.TEXT);
2320
2321
  _defineProperty(this, "_current", false);
2321
2322
  _defineProperty(this, "_rangeShape", void 0);
@@ -2345,6 +2346,7 @@ var TextRange = class {
2345
2346
  }
2346
2347
  get startOffset() {
2347
2348
  var _this$_docSkeleton$ge;
2349
+ if (this._logicalRange) return Math.min(this._logicalRange.startOffset, this._logicalRange.endOffset);
2348
2350
  const { startOffset } = getOneTextSelectionRange(this._cursorList) ?? {};
2349
2351
  const body = (_this$_docSkeleton$ge = this._docSkeleton.getViewModel().getDataModel().getSelfOrHeaderFooterModel(this._segmentId)) === null || _this$_docSkeleton$ge === void 0 ? void 0 : _this$_docSkeleton$ge.getBody();
2350
2352
  if (startOffset == null || body == null) return startOffset;
@@ -2353,6 +2355,7 @@ var TextRange = class {
2353
2355
  }
2354
2356
  get endOffset() {
2355
2357
  var _this$_docSkeleton$ge2;
2358
+ if (this._logicalRange) return Math.max(this._logicalRange.startOffset, this._logicalRange.endOffset);
2356
2359
  const { endOffset } = getOneTextSelectionRange(this._cursorList) ?? {};
2357
2360
  const body = (_this$_docSkeleton$ge2 = this._docSkeleton.getViewModel().getDataModel().getSelfOrHeaderFooterModel(this._segmentId)) === null || _this$_docSkeleton$ge2 === void 0 ? void 0 : _this$_docSkeleton$ge2.getBody();
2358
2361
  if (endOffset == null || body == null) return endOffset;
@@ -2376,6 +2379,7 @@ var TextRange = class {
2376
2379
  return end;
2377
2380
  }
2378
2381
  get direction() {
2382
+ if (this._logicalRange) return this._logicalRange.startOffset <= this._logicalRange.endOffset ? RANGE_DIRECTION.FORWARD : RANGE_DIRECTION.BACKWARD;
2379
2383
  const { collapsed, anchorNodePosition, focusNodePosition } = this;
2380
2384
  if (collapsed || anchorNodePosition == null || focusNodePosition == null) return RANGE_DIRECTION.NONE;
2381
2385
  return compareNodePositionLogic(anchorNodePosition, focusNodePosition) ? RANGE_DIRECTION.FORWARD : RANGE_DIRECTION.BACKWARD;
@@ -2462,6 +2466,7 @@ var TextRange = class {
2462
2466
  }
2463
2467
  refresh() {
2464
2468
  var _this$_anchorShape6, _this$_rangeShape2;
2469
+ this._refreshLogicalRangePositions();
2465
2470
  const { _document, _docSkeleton } = this;
2466
2471
  const anchor = this.anchorNodePosition;
2467
2472
  const focus = this.focusNodePosition;
@@ -2484,6 +2489,26 @@ var TextRange = class {
2484
2489
  this._setCursorList(cursorList);
2485
2490
  if (borderBoxPointGroup.length > 0) this._createOrUpdateRange(borderBoxPointGroup, docsLeft, docsTop);
2486
2491
  }
2492
+ _refreshLogicalRangePositions() {
2493
+ var _this$_docSkeleton$ge3;
2494
+ const range = this._logicalRange;
2495
+ if (!range) return;
2496
+ const start = Math.min(range.startOffset, range.endOffset);
2497
+ const end = Math.max(range.startOffset, range.endOffset);
2498
+ let first;
2499
+ let last;
2500
+ for (const page of ((_this$_docSkeleton$ge3 = this._docSkeleton.getSkeletonData()) === null || _this$_docSkeleton$ge3 === void 0 ? void 0 : _this$_docSkeleton$ge3.pages) ?? []) {
2501
+ if (page.isLayoutPlaceholder || page.isMaterializationPlaceholder || page.ed < start || page.st >= end) continue;
2502
+ const positions = findDocRangeNodePositions(this._docSkeleton, Math.max(start, page.st), Math.min(end - 1, page.ed), this._segmentId, this._segmentPage);
2503
+ if (positions) {
2504
+ first ??= positions.startPosition;
2505
+ last = positions.endPosition;
2506
+ }
2507
+ }
2508
+ const forward = range.startOffset <= range.endOffset;
2509
+ this.anchorNodePosition = forward ? first : last;
2510
+ this.focusNodePosition = forward ? last : first;
2511
+ }
2487
2512
  _isEmpty() {
2488
2513
  return this.anchorNodePosition == null && this.focusNodePosition == null;
2489
2514
  }
@@ -2798,7 +2823,17 @@ function getColumnInputBoundaryCollapsedPosition(anchorPosition, focusPosition,
2798
2823
  function getTextRangeFromCharIndex(startOffset, endOffset, scene, document, skeleton, style, segmentId, segmentPage, startIsBack = true, endIsBack = true) {
2799
2824
  const startNodePosition = skeleton.findNodePositionByCharIndex(startOffset, startIsBack, segmentId, segmentPage);
2800
2825
  const endNodePosition = skeleton.findNodePositionByCharIndex(endOffset, endIsBack, segmentId, segmentPage);
2801
- if (startNodePosition == null || endNodePosition == null) return;
2826
+ if (startNodePosition == null || endNodePosition == null) {
2827
+ var _skeleton$getSkeleton;
2828
+ const pages = (_skeleton$getSkeleton = skeleton.getSkeletonData()) === null || _skeleton$getSkeleton === void 0 ? void 0 : _skeleton$getSkeleton.pages;
2829
+ const startPage = pages === null || pages === void 0 ? void 0 : pages[skeleton.findBodyPageIndexByCharIndex(startOffset)];
2830
+ const endPage = pages === null || pages === void 0 ? void 0 : pages[skeleton.findBodyPageIndexByCharIndex(endOffset)];
2831
+ if (segmentId === "" && startOffset !== endOffset && startPage && endPage && (startPage.isMaterializationPlaceholder || endPage.isMaterializationPlaceholder)) return new TextRange(scene, document, skeleton, void 0, void 0, style, segmentId, segmentPage, {
2832
+ startOffset: startIsBack ? startOffset : startOffset + 1,
2833
+ endOffset: endIsBack ? endOffset : endOffset + 1
2834
+ });
2835
+ return;
2836
+ }
2802
2837
  return new TextRange(scene, document, skeleton, startNodePosition, endNodePosition, style, segmentId, segmentPage);
2803
2838
  }
2804
2839
  function getRectRangeFromCharIndex(startOffset, endOffset, scene, document, skeleton, style, segmentId, segmentPage) {
@@ -2810,7 +2845,14 @@ function getRectRangeFromCharIndex(startOffset, endOffset, scene, document, skel
2810
2845
  function getRangeListFromCharIndex(startOffset, endOffset, scene, document, skeleton, style, segmentId, segmentPage) {
2811
2846
  const startNodePosition = skeleton.findNodePositionByCharIndex(startOffset, true, segmentId, segmentPage);
2812
2847
  const endNodePosition = skeleton.findNodePositionByCharIndex(endOffset, true, segmentId, segmentPage);
2813
- if (startNodePosition == null || endNodePosition == null) return;
2848
+ if (startNodePosition == null || endNodePosition == null) {
2849
+ const textRange = getTextRangeFromCharIndex(startOffset, endOffset, scene, document, skeleton, style, segmentId, segmentPage);
2850
+ if (textRange) return {
2851
+ textRanges: [textRange],
2852
+ rectRanges: []
2853
+ };
2854
+ return;
2855
+ }
2814
2856
  return getRangeListFromSelection(startNodePosition, endNodePosition, scene, document, skeleton, style, segmentId, segmentPage);
2815
2857
  }
2816
2858
  function getRangeListFromSelection(anchorPosition, focusPosition, scene, document, skeleton, style, segmentId, segmentPage) {
@@ -3127,6 +3169,20 @@ function getWordBoundaryByIndex(content, nodeIndex, paragraphStartOffset) {
3127
3169
  endOffset: paragraphStartOffset + range.end
3128
3170
  };
3129
3171
  }
3172
+ function getWordSelectionByIndex(content, nodeIndex, paragraphStartOffset, isBack) {
3173
+ var _segments;
3174
+ const text = content.replace(/[\r\n]+$/, "");
3175
+ if (!text.length || nodeIndex < 0) return null;
3176
+ const index = Math.min(nodeIndex, text.length - 1);
3177
+ const segments = Array.from(new Intl.Segmenter(void 0, { granularity: "word" }).segment(text));
3178
+ const segmentIndex = segments.findIndex((segment) => segment.index <= index && index < segment.index + segment.segment.length);
3179
+ const segment = segments[segmentIndex];
3180
+ const whitespace = /^\s+$/.test(segment.segment);
3181
+ return {
3182
+ startOffset: paragraphStartOffset + (whitespace ? ((_segments = segments[segmentIndex - 1]) === null || _segments === void 0 ? void 0 : _segments.index) ?? segment.index : segment.index),
3183
+ endOffset: paragraphStartOffset + (whitespace ? Math.min(nodeIndex + (isBack ? 0 : 1), text.length) : segment.index + segment.segment.length)
3184
+ };
3185
+ }
3130
3186
  function getNextWordBoundaryOffset(content, nodeIndex, paragraphStartOffset, direction) {
3131
3187
  if (nodeIndex < 0) return null;
3132
3188
  const ranges = getWordRanges(content);
@@ -3156,6 +3212,12 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
3156
3212
  get isFocusing() {
3157
3213
  return this._input === this._getOwnerDocument().activeElement;
3158
3214
  }
3215
+ get inputElement() {
3216
+ return this._input;
3217
+ }
3218
+ get selectionContainer() {
3219
+ return this._container;
3220
+ }
3159
3221
  get isEditing() {
3160
3222
  var _this$_textSelectionI;
3161
3223
  return ((_this$_textSelectionI = this._textSelectionInner$.value) === null || _this$_textSelectionI === void 0 ? void 0 : _this$_textSelectionI.isEditing) === true;
@@ -3289,15 +3351,13 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
3289
3351
  this._selectionStyle = style;
3290
3352
  }
3291
3353
  replaceDocRanges(ranges, isEditing = true, options) {
3292
- var _this$_context$unit$g;
3293
3354
  if (this._onPointerEvent) {
3294
3355
  this._pendingSelection = null;
3295
3356
  return false;
3296
3357
  }
3297
3358
  this._syncNoteSegment(ranges[0]);
3298
- const isBodyOrNote = this._currentSegmentId === "" || ((_this$_context$unit$g = this._context.unit.getSnapshot().notes) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g[this._currentSegmentId]) != null;
3299
3359
  let currentLogicalSelection = null;
3300
- if (isBodyOrNote && ranges.length > 0) {
3360
+ if (ranges.length > 0) {
3301
3361
  const { unitId } = this._context;
3302
3362
  const selection = this._docSelectionManagerService.getSelectionInfo({
3303
3363
  unitId,
@@ -3388,7 +3448,7 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
3388
3448
  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);
3389
3449
  else textRange = getTextRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
3390
3450
  if (textRange) this._addTextRange(textRange);
3391
- } catch (_e) {
3451
+ } catch {
3392
3452
  generalAddRange(startOffset, endOffset, rangeStyle);
3393
3453
  }
3394
3454
  else generalAddRange(startOffset, endOffset, rangeStyle);
@@ -3478,7 +3538,7 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
3478
3538
  if (paragraphInfo == null) return;
3479
3539
  const { content, st, nodeIndex } = paragraphInfo;
3480
3540
  if (nodeIndex === -1) return;
3481
- const wordBoundary = getWordBoundaryByIndex(content, nodeIndex, st);
3541
+ const wordBoundary = this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY || this._context.unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY ? getWordSelectionByIndex(content, nodeIndex, st, startNode.ratioX < .5) : getWordBoundaryByIndex(content, nodeIndex, st);
3482
3542
  if (wordBoundary != null) {
3483
3543
  this.removeAllRanges();
3484
3544
  const textRanges = [{
@@ -4067,10 +4127,26 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
4067
4127
  }));
4068
4128
  }
4069
4129
  _refreshMissingInputRange(config) {
4130
+ var _this$_context$unit$g;
4070
4131
  if (config.activeRange == null) {
4071
4132
  config.activeRange = this._getActiveRange();
4072
4133
  config.rangeList = this._getAllTextRanges();
4073
4134
  }
4135
+ const { unitId } = this._context;
4136
+ if (config.activeRange != null || unitId !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY || ((_this$_context$unit$g = this._context.unit.getBody()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.dataStream) !== "\r\n") return;
4137
+ const selection = this._docSelectionManagerService.getSelectionInfo({
4138
+ unitId,
4139
+ subUnitId: unitId
4140
+ });
4141
+ if (selection == null || selection.textRanges.length !== 1 || selection.rectRanges.length > 0) return;
4142
+ const caret = selection.textRanges[0];
4143
+ if (!caret.isActive || caret.startOffset !== 0 || caret.endOffset !== 0) return;
4144
+ config.activeRange = {
4145
+ ...caret,
4146
+ segmentId: selection.segmentId,
4147
+ segmentPage: selection.segmentPage
4148
+ };
4149
+ config.rangeList = [config.activeRange];
4074
4150
  }
4075
4151
  _handleInputFocus(event) {
4076
4152
  this._eventHandle(event, (config) => {
@@ -5119,7 +5195,7 @@ const InnerPasteCommand = {
5119
5195
  unitId: targetUnitId,
5120
5196
  subUnitId: targetUnitId
5121
5197
  };
5122
- const selections = docSelectionManagerService.getTextRanges(selectionParams) ?? [];
5198
+ const selections = params.selections ?? docSelectionManagerService.getTextRanges(selectionParams) ?? [];
5123
5199
  const rectRanges = docSelectionManagerService.getRectRanges(selectionParams) ?? [];
5124
5200
  const selectionInfo = docSelectionManagerService.getSelectionInfo(selectionParams);
5125
5201
  const { body: sourceBody, tableSource, drawings } = doc;
@@ -5615,7 +5691,7 @@ const CutContentCommand = {
5615
5691
  id: "doc.command.inner-cut",
5616
5692
  type: CommandType.COMMAND,
5617
5693
  handler: (accessor, params) => {
5618
- var _selectionInfo$option3;
5694
+ var _selectionInfo$option3, _docDataModel$getSelf7;
5619
5695
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
5620
5696
  const commandService = accessor.get(ICommandService);
5621
5697
  const univerInstanceService = accessor.get(IUniverInstanceService);
@@ -5635,12 +5711,19 @@ const CutContentCommand = {
5635
5711
  const docSkeletonManagerService = getCommandSkeleton(accessor, unitId);
5636
5712
  if (docSkeletonManagerService == null) return false;
5637
5713
  const viewModel = docSkeletonManagerService.getViewModel();
5714
+ const body = (_docDataModel$getSelf7 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf7 === void 0 ? void 0 : _docDataModel$getSelf7.getBody();
5715
+ const clearsBody = wholeBodySelected || body != null && isWholeBodySelected(selections, rectRanges, body);
5638
5716
  const doMutation = {
5639
5717
  id: RichTextEditingMutation.id,
5640
5718
  params: {
5641
5719
  unitId,
5642
5720
  actions: [],
5643
- textRanges,
5721
+ textRanges: clearsBody ? [{
5722
+ ...textRanges[0],
5723
+ startOffset: 0,
5724
+ endOffset: 0,
5725
+ collapsed: true
5726
+ }] : textRanges,
5644
5727
  trigger: CutContentCommand.id
5645
5728
  }
5646
5729
  };
@@ -5657,6 +5740,31 @@ function isHorizontalLineParagraph(dataStream, paragraph) {
5657
5740
  return Array.from(dataStream).every((token) => token === DataStreamTreeTokenType.PARAGRAPH || token === DataStreamTreeTokenType.SECTION_BREAK) && (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.borderBottom) != null && paragraphStyle.borderTop == null && paragraphStyle.borderLeft == null && paragraphStyle.borderRight == null && paragraphStyle.borderBetween == null;
5658
5741
  }
5659
5742
 
5743
+ //#endregion
5744
+ //#region src/commands/operations/doc-cursor.operation.ts
5745
+ /**
5746
+ * The operation to move cursor in the current document.
5747
+ */
5748
+ const MoveCursorOperation = {
5749
+ id: "doc.operation.move-cursor",
5750
+ type: CommandType.OPERATION,
5751
+ handler: (accessor, params) => {
5752
+ if (!params) return false;
5753
+ return true;
5754
+ }
5755
+ };
5756
+ /**
5757
+ * The operation to move selection in the current document.
5758
+ */
5759
+ const MoveSelectionOperation = {
5760
+ id: "doc.operation.move-selection",
5761
+ type: CommandType.OPERATION,
5762
+ handler: (accessor, params) => {
5763
+ if (!params) return false;
5764
+ return true;
5765
+ }
5766
+ };
5767
+
5660
5768
  //#endregion
5661
5769
  //#region src/commands/commands/format-painter.command.ts
5662
5770
  function captureTextFormat(body, range, defaultStyle = {}, lists = {}, document = { documentStyle: {} }) {
@@ -6070,11 +6178,25 @@ function isDeleteOffsetInsideBlockRange(body, offset) {
6070
6178
  return interval.startOffset < offset && offset < interval.endOffset - 1;
6071
6179
  })) ?? false;
6072
6180
  }
6181
+ function selectDeleteBoundary(accessor, direction, granularity) {
6182
+ var _selections$getActive, _selections$getRectRa;
6183
+ const selections = accessor.get(DocSelectionManagerService);
6184
+ if (((_selections$getActive = selections.getActiveTextRange()) === null || _selections$getActive === void 0 ? void 0 : _selections$getActive.collapsed) && !((_selections$getRectRa = selections.getRectRanges()) === null || _selections$getRectRa === void 0 ? void 0 : _selections$getRectRa.length)) {
6185
+ var _selections$getActive2;
6186
+ accessor.get(ICommandService).syncExecuteCommand(MoveSelectionOperation.id, {
6187
+ direction,
6188
+ granularity
6189
+ });
6190
+ return ((_selections$getActive2 = selections.getActiveTextRange()) === null || _selections$getActive2 === void 0 ? void 0 : _selections$getActive2.collapsed) === false;
6191
+ }
6192
+ return true;
6193
+ }
6073
6194
  const DeleteLeftCommand = {
6074
6195
  id: "doc.command.delete-left",
6075
6196
  type: CommandType.COMMAND,
6076
- handler: async (accessor) => {
6197
+ handler: async (accessor, params) => {
6077
6198
  var _docDataModel$getSelf3, _docDataModel$getSelf4;
6199
+ if ((params === null || params === void 0 ? void 0 : params.granularity) && !selectDeleteBoundary(accessor, Direction.LEFT, params.granularity)) return true;
6078
6200
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
6079
6201
  const univerInstanceService = accessor.get(IUniverInstanceService);
6080
6202
  const commandService = accessor.get(ICommandService);
@@ -6234,8 +6356,9 @@ const DeleteLeftCommand = {
6234
6356
  const DeleteRightCommand = {
6235
6357
  id: "doc.command.delete-right",
6236
6358
  type: CommandType.COMMAND,
6237
- handler: async (accessor) => {
6359
+ handler: async (accessor, params) => {
6238
6360
  var _docDataModel$getSelf5;
6361
+ if ((params === null || params === void 0 ? void 0 : params.granularity) && !selectDeleteBoundary(accessor, Direction.RIGHT, params.granularity)) return true;
6239
6362
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
6240
6363
  const docDataModel = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
6241
6364
  if (!docDataModel) return false;
@@ -8456,7 +8579,11 @@ let DocClipboardService = class DocClipboardService extends Disposable {
8456
8579
  _defineProperty(this, "_umdToHtml", void 0);
8457
8580
  this._umdToHtml = new UDMToHtmlService(docHtmlExportService);
8458
8581
  this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
8459
- if (!this._applyingPaste && command.type === CommandType.MUTATION) this.dismissPasteOptions();
8582
+ var _command$params, _this$_pasteOptions$$;
8583
+ if (this._applyingPaste || command.type !== CommandType.MUTATION) return;
8584
+ const unitId = (_command$params = command.params) === null || _command$params === void 0 ? void 0 : _command$params.unitId;
8585
+ const pasteUnitId = ((_this$_pasteOptions$$ = this._pasteOptions$.value) === null || _this$_pasteOptions$$ === void 0 ? void 0 : _this$_pasteOptions$$.unitId) ?? this._getCurrentDocumentUnitId();
8586
+ if (!unitId || unitId === pasteUnitId) this.dismissPasteOptions();
8460
8587
  }));
8461
8588
  const invalidateSelection = () => {
8462
8589
  const key = this._getPasteSelectionKey();
@@ -8530,6 +8657,12 @@ let DocClipboardService = class DocClipboardService extends Disposable {
8530
8657
  mode
8531
8658
  });
8532
8659
  }
8660
+ isPasteOptionsEnabled(unitId) {
8661
+ return !isInternalEditorID(unitId) || this._clipboardHooks.some((hook) => {
8662
+ var _hook$supportsPasteOp;
8663
+ return (_hook$supportsPasteOp = hook.supportsPasteOptions) === null || _hook$supportsPasteOp === void 0 ? void 0 : _hook$supportsPasteOp.call(hook, unitId);
8664
+ });
8665
+ }
8533
8666
  setNextPasteMode(mode) {
8534
8667
  this._nextPasteMode = mode;
8535
8668
  }
@@ -8620,7 +8753,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
8620
8753
  try {
8621
8754
  this._stateChangeManager.flushPendingChanges(unitId);
8622
8755
  const result = this._paste(doc, unitId);
8623
- if (result && !isInternalEditorID(unitId)) this._savePasteSession(payload, mode === "text" ? cachedSource : source, style, mode, unitId);
8756
+ if (result && this.isPasteOptionsEnabled(unitId)) this._savePasteSession(payload, mode === "text" ? cachedSource : source, style, mode, unitId);
8624
8757
  return result;
8625
8758
  } finally {
8626
8759
  this._applyingPaste = false;
@@ -8844,7 +8977,11 @@ let DocClipboardService = class DocClipboardService extends Disposable {
8844
8977
  this._clipboardHooks.push(hook);
8845
8978
  return toDisposable(() => {
8846
8979
  const index = this._clipboardHooks.indexOf(hook);
8847
- if (index > -1) this._clipboardHooks.splice(index, 1);
8980
+ if (index > -1) {
8981
+ this._clipboardHooks.splice(index, 1);
8982
+ const state = this._pasteOptions$.value;
8983
+ if (state && !this.isPasteOptionsEnabled(state.unitId)) this.dismissPasteOptions();
8984
+ }
8848
8985
  });
8849
8986
  }
8850
8987
  _applyCopyDocDataHooks(doc, sourceDocuments) {
@@ -11550,31 +11687,6 @@ const DocCreateTableOperation = {
11550
11687
  }
11551
11688
  };
11552
11689
 
11553
- //#endregion
11554
- //#region src/commands/operations/doc-cursor.operation.ts
11555
- /**
11556
- * The operation to move cursor in the current document.
11557
- */
11558
- const MoveCursorOperation = {
11559
- id: "doc.operation.move-cursor",
11560
- type: CommandType.OPERATION,
11561
- handler: (accessor, params) => {
11562
- if (!params) return false;
11563
- return true;
11564
- }
11565
- };
11566
- /**
11567
- * The operation to move selection in the current document.
11568
- */
11569
- const MoveSelectionOperation = {
11570
- id: "doc.operation.move-selection",
11571
- type: CommandType.OPERATION,
11572
- handler: (accessor, params) => {
11573
- if (!params) return false;
11574
- return true;
11575
- }
11576
- };
11577
-
11578
11690
  //#endregion
11579
11691
  //#region src/config/config.ts
11580
11692
  const DOCS_UI_PLUGIN_CONFIG_KEY = "docs-ui.config";
@@ -13790,6 +13902,10 @@ let DocRenderController = class DocRenderController extends RxDisposable {
13790
13902
  } finally {
13791
13903
  this._docLayoutExecutorService.recordHydrationDuration(this._context.unitId, Tools.now() - hydrationStartedAt);
13792
13904
  }
13905
+ this._textSelectionManagerService.refreshSelection({
13906
+ unitId: this._context.unitId,
13907
+ subUnitId: this._context.unitId
13908
+ }, false);
13793
13909
  this._markDocumentRenderDirty();
13794
13910
  }
13795
13911
  }
@@ -14277,6 +14393,8 @@ function getHeaderFooterTarget(viewModel, editArea, segmentPage, page) {
14277
14393
  * limitations under the License.
14278
14394
  */
14279
14395
  const COMPONENT_DOC_HEADER_FOOTER_PANEL = "COMPONENT_DOC_HEADER_FOOTER_PANEL";
14396
+ const DOC_HEADER_FOOTER_RIBBON_TAB = "docs-ui.ribbon.header-footer";
14397
+ const DOC_HEADER_FOOTER_RIBBON_CONTROL = "DocHeaderFooterRibbonControl";
14280
14398
 
14281
14399
  //#endregion
14282
14400
  //#region src/commands/operations/doc-header-footer-panel.operation.ts
@@ -14334,8 +14452,8 @@ const CoreHeaderFooterCommand = {
14334
14452
  let resolvedCreateType = createType;
14335
14453
  if (headerFooterProps != null) Object.keys(headerFooterProps).forEach((key) => {
14336
14454
  const value = headerFooterProps[key];
14337
- if (resolvedCreateType == null && key === "useFirstPageHeaderFooter" && value === BooleanNumber.TRUE && !headerFooterConfig.firstPageHeaderId) resolvedCreateType = editArea === DocumentEditArea.HEADER ? HeaderFooterType.FIRST_PAGE_HEADER : HeaderFooterType.FIRST_PAGE_FOOTER;
14338
- else if (resolvedCreateType == null && key === "evenAndOddHeaders" && value === BooleanNumber.TRUE && !headerFooterConfig.evenPageHeaderId) resolvedCreateType = editArea === DocumentEditArea.HEADER ? HeaderFooterType.EVEN_PAGE_HEADER : HeaderFooterType.EVEN_PAGE_FOOTER;
14455
+ if (resolvedCreateType == null && key === "useFirstPageHeaderFooter" && value === BooleanNumber.TRUE && !(editArea === DocumentEditArea.HEADER ? headerFooterConfig.firstPageHeaderId : headerFooterConfig.firstPageFooterId)) resolvedCreateType = editArea === DocumentEditArea.HEADER ? HeaderFooterType.FIRST_PAGE_HEADER : HeaderFooterType.FIRST_PAGE_FOOTER;
14456
+ else if (resolvedCreateType == null && key === "evenAndOddHeaders" && value === BooleanNumber.TRUE && !(editArea === DocumentEditArea.HEADER ? headerFooterConfig.evenPageHeaderId : headerFooterConfig.evenPageFooterId)) resolvedCreateType = editArea === DocumentEditArea.HEADER ? HeaderFooterType.EVEN_PAGE_HEADER : HeaderFooterType.EVEN_PAGE_FOOTER;
14339
14457
  });
14340
14458
  return commandService.syncExecuteCommand(CreateHeaderFooterCommand.id, {
14341
14459
  unitId,
@@ -14350,8 +14468,8 @@ const CoreHeaderFooterCommand = {
14350
14468
  const OpenHeaderFooterPanelCommand = {
14351
14469
  id: "doc.command.open-header-footer-panel",
14352
14470
  type: CommandType.COMMAND,
14353
- handler: async (accessor, _params) => {
14354
- var _skeleton$getSkeleton;
14471
+ handler: async (accessor, params) => {
14472
+ var _skeleton$getSkeleton, _docDataModel$getSelf;
14355
14473
  const commandService = accessor.get(ICommandService);
14356
14474
  const instanceService = accessor.get(IUniverInstanceService);
14357
14475
  const renderManagerService = accessor.get(IRenderManagerService);
@@ -14368,8 +14486,9 @@ const OpenHeaderFooterPanelCommand = {
14368
14486
  const currentPage = selectionRenderService.getSegmentPage();
14369
14487
  const pageNumber = currentPage >= 0 && currentPage < pages.length ? currentPage : 0;
14370
14488
  const page = pages[pageNumber];
14371
- viewModel.setEditArea(DocumentEditArea.HEADER);
14372
- const { createType, headerFooterId, sectionId } = getHeaderFooterTarget(viewModel, DocumentEditArea.HEADER, pageNumber, page);
14489
+ const editArea = (params === null || params === void 0 ? void 0 : params.editArea) ?? DocumentEditArea.HEADER;
14490
+ viewModel.setEditArea(editArea);
14491
+ const { createType, headerFooterId, sectionId } = getHeaderFooterTarget(viewModel, editArea, pageNumber, page);
14373
14492
  selectionRenderService.setSegmentPage(pageNumber);
14374
14493
  if (createType != null) {
14375
14494
  const segmentId = generateRandomId(6);
@@ -14386,6 +14505,21 @@ const OpenHeaderFooterPanelCommand = {
14386
14505
  return false;
14387
14506
  }
14388
14507
  } else if (headerFooterId != null) selectionRenderService.setSegment(headerFooterId);
14508
+ const segmentId = selectionRenderService.getSegment();
14509
+ const segmentSnapshot = (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getSnapshot();
14510
+ if (!segmentSnapshot) return false;
14511
+ const offset = findFirstCursorOffset(segmentSnapshot);
14512
+ accessor.get(DocSelectionManagerService).replaceDocRanges([{
14513
+ startOffset: offset,
14514
+ endOffset: offset,
14515
+ collapsed: true,
14516
+ segmentId,
14517
+ segmentPage: pageNumber
14518
+ }], {
14519
+ unitId,
14520
+ subUnitId: unitId
14521
+ });
14522
+ selectionRenderService.focus();
14389
14523
  return commandService.executeCommand(SidebarDocHeaderFooterPanelOperation.id, { value: "open" });
14390
14524
  }
14391
14525
  };
@@ -14428,7 +14562,254 @@ const CloseHeaderFooterCommand = {
14428
14562
  endOffset: offset
14429
14563
  }]);
14430
14564
  });
14431
- commandService.executeCommand(SidebarDocHeaderFooterPanelOperation.id, { value: "close" });
14565
+ await commandService.executeCommand(SidebarDocHeaderFooterPanelOperation.id, { value: "close" });
14566
+ return true;
14567
+ }
14568
+ };
14569
+
14570
+ //#endregion
14571
+ //#region src/utils/date-time-field.ts
14572
+ function createDateTimeField(format, locale, date) {
14573
+ const options = format === "time" ? {
14574
+ hour: "2-digit",
14575
+ minute: "2-digit",
14576
+ second: "2-digit",
14577
+ hourCycle: "h23"
14578
+ } : {
14579
+ year: "numeric",
14580
+ month: format === "long" ? "long" : "2-digit",
14581
+ day: "2-digit"
14582
+ };
14583
+ const formatter = new Intl.DateTimeFormat(locale, {
14584
+ ...options,
14585
+ calendar: "gregory",
14586
+ numberingSystem: "latn"
14587
+ });
14588
+ const parts = formatter.formatToParts(date);
14589
+ const tokens = {
14590
+ year: "yyyy",
14591
+ month: format === "long" ? "MMMM" : "MM",
14592
+ day: "dd",
14593
+ hour: "HH",
14594
+ minute: "mm",
14595
+ second: "ss"
14596
+ };
14597
+ const mask = parts.map((part) => tokens[part.type] ?? `'${part.value.replace(/'/g, "''")}'`).join("");
14598
+ const fieldType = format === "time" ? "TIME" : "DATE";
14599
+ return {
14600
+ fieldType,
14601
+ instruction: `${fieldType} \\@ "${mask}"`,
14602
+ cachedResult: formatter.format(date)
14603
+ };
14604
+ }
14605
+ function resolveDateTimeField(instruction, locale, date) {
14606
+ try {
14607
+ Intl.getCanonicalLocales(locale);
14608
+ } catch {
14609
+ return;
14610
+ }
14611
+ for (const format of [
14612
+ "short",
14613
+ "long",
14614
+ "time"
14615
+ ]) {
14616
+ const field = createDateTimeField(format, locale, date);
14617
+ if (field.instruction === instruction) return field.cachedResult;
14618
+ }
14619
+ }
14620
+
14621
+ //#endregion
14622
+ //#region src/commands/commands/insert-header-footer-field.command.ts
14623
+ const InsertHeaderFooterFieldCommand = {
14624
+ id: "doc.command.insert-header-footer-field",
14625
+ type: CommandType.COMMAND,
14626
+ handler(accessor, params) {
14627
+ var _snapshot$headers, _snapshot$footers, _model$getSelfOrHeade, _body$customRanges;
14628
+ if (!params || ![
14629
+ "PAGE",
14630
+ "NUMPAGES",
14631
+ "DATE",
14632
+ "TIME"
14633
+ ].includes(params.fieldType)) return false;
14634
+ const model = accessor.get(IUniverInstanceService).getUnit(params.unitId, UniverInstanceType.UNIVER_DOC);
14635
+ const active = accessor.get(DocSelectionManagerService).getActiveTextRange();
14636
+ const selection = params.selection ?? active;
14637
+ const segmentId = params.segmentId ?? (active === null || active === void 0 ? void 0 : active.segmentId);
14638
+ const snapshot = model === null || model === void 0 ? void 0 : model.getSnapshot();
14639
+ if (!model || (snapshot === null || snapshot === void 0 ? void 0 : snapshot.disabled) || !selection || !segmentId || !(snapshot === null || snapshot === void 0 || (_snapshot$headers = snapshot.headers) === null || _snapshot$headers === void 0 ? void 0 : _snapshot$headers[segmentId]) && !(snapshot === null || snapshot === void 0 || (_snapshot$footers = snapshot.footers) === null || _snapshot$footers === void 0 ? void 0 : _snapshot$footers[segmentId])) return false;
14640
+ const body = (_model$getSelfOrHeade = model.getSelfOrHeaderFooterModel(segmentId)) === null || _model$getSelfOrHeade === void 0 ? void 0 : _model$getSelfOrHeade.getBody();
14641
+ if (!body || params.expectedDataStream != null && params.expectedDataStream !== body.dataStream || !Number.isInteger(selection.startOffset) || !Number.isInteger(selection.endOffset) || selection.startOffset < 0 || selection.endOffset < selection.startOffset || selection.endOffset > body.dataStream.length - 2) return false;
14642
+ if (!canEditDocumentTargets(accessor.get(IPermissionService), params.unitId, getDocumentEditTargetObjectIds(model, segmentId, selection))) return false;
14643
+ if ((_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.some((range) => {
14644
+ var _range$properties;
14645
+ return range.rangeType === CustomRangeType.FIELD && ((_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.locked) === BooleanNumber.TRUE && selection.startOffset <= range.endIndex && selection.endOffset > range.startIndex;
14646
+ })) return false;
14647
+ const locale = LOCALE_META[accessor.get(LocaleService).getCurrentLocale()].tag;
14648
+ let properties;
14649
+ if (params.fieldType === "DATE" || params.fieldType === "TIME") {
14650
+ const format = params.format ?? (params.fieldType === "TIME" ? "time" : "short");
14651
+ if (![
14652
+ "short",
14653
+ "long",
14654
+ "time"
14655
+ ].includes(format)) return false;
14656
+ properties = createDateTimeField(format, locale, /* @__PURE__ */ new Date());
14657
+ } else {
14658
+ var _accessor$get$getRend, _skeleton$getSkeleton;
14659
+ const skeleton = (_accessor$get$getRend = accessor.get(IRenderManagerService).getRenderUnitById(params.unitId)) === null || _accessor$get$getRend === void 0 ? void 0 : _accessor$get$getRend.with(DocSkeletonManagerService).getSkeleton();
14660
+ const pages = skeleton === null || skeleton === void 0 || (_skeleton$getSkeleton = skeleton.getSkeletonData()) === null || _skeleton$getSkeleton === void 0 ? void 0 : _skeleton$getSkeleton.pages;
14661
+ if (!(pages === null || pages === void 0 ? void 0 : pages.length)) return false;
14662
+ const pageIndex = params.segmentPage ?? (active === null || active === void 0 ? void 0 : active.segmentPage) ?? 0;
14663
+ const page = pages[Math.max(0, pageIndex)];
14664
+ if (!page) return false;
14665
+ properties = {
14666
+ fieldType: params.fieldType,
14667
+ instruction: params.fieldType,
14668
+ cachedResult: String(params.fieldType === "PAGE" ? page.pageNumber : (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getCompletedPageCount()) ?? "…")
14669
+ };
14670
+ }
14671
+ const automatic = params.automatic !== false || params.fieldType === "PAGE" || params.fieldType === "NUMPAGES";
14672
+ const dataStream = automatic ? `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${properties.cachedResult}${DataStreamTreeTokenType.CUSTOM_RANGE_END}` : properties.cachedResult;
14673
+ const style = accessor.get(DocMenuStyleService);
14674
+ const textRun = getTextRunForSelection(body, selection, style.getDefaultStyle(), style.getStyleCache(), false);
14675
+ return accessor.get(ICommandService).syncExecuteCommand(InsertTextCommand.id, {
14676
+ unitId: params.unitId,
14677
+ segmentId,
14678
+ range: selection,
14679
+ debounce: false,
14680
+ body: {
14681
+ dataStream,
14682
+ textRuns: [{
14683
+ ...textRun,
14684
+ ts: {
14685
+ ...textRun.ts,
14686
+ lang: locale
14687
+ },
14688
+ st: 0,
14689
+ ed: dataStream.length
14690
+ }],
14691
+ customRanges: automatic ? [{
14692
+ startIndex: 0,
14693
+ endIndex: dataStream.length - 1,
14694
+ rangeId: generateRandomId(),
14695
+ rangeType: CustomRangeType.FIELD,
14696
+ wholeEntity: false,
14697
+ properties: {
14698
+ ...properties,
14699
+ sourceKind: "complex"
14700
+ }
14701
+ }] : []
14702
+ },
14703
+ textRanges: [{
14704
+ ...selection,
14705
+ segmentId,
14706
+ segmentPage: params.segmentPage ?? (active === null || active === void 0 ? void 0 : active.segmentPage),
14707
+ startOffset: selection.startOffset + dataStream.length,
14708
+ endOffset: selection.startOffset + dataStream.length,
14709
+ collapsed: true
14710
+ }]
14711
+ });
14712
+ }
14713
+ };
14714
+
14715
+ //#endregion
14716
+ //#region src/commands/commands/refresh-header-footer-fields.command.ts
14717
+ const RefreshHeaderFooterFieldsCommand = {
14718
+ id: "doc.command.refresh-header-footer-fields",
14719
+ type: CommandType.COMMAND,
14720
+ handler(accessor, params) {
14721
+ if (!params) return false;
14722
+ const model = accessor.get(IUniverInstanceService).getUnit(params.unitId, UniverInstanceType.UNIVER_DOC);
14723
+ const snapshot = model === null || model === void 0 ? void 0 : model.getSnapshot();
14724
+ if (!model || !snapshot || snapshot.disabled) return false;
14725
+ const permissions = accessor.get(IPermissionService);
14726
+ const locale = LOCALE_META[accessor.get(LocaleService).getCurrentLocale()].tag;
14727
+ const now = /* @__PURE__ */ new Date();
14728
+ const selections = accessor.get(DocSelectionManagerService).getTextRanges({
14729
+ unitId: params.unitId,
14730
+ subUnitId: params.unitId
14731
+ }) ?? [];
14732
+ let actions = null;
14733
+ for (const [segmentId, segment] of Object.entries({
14734
+ "": { body: snapshot.body },
14735
+ ...snapshot.headers,
14736
+ ...snapshot.footers
14737
+ })) {
14738
+ if (!segment.body) continue;
14739
+ const textX = refreshDateTimeFields(segment.body, locale, now, (field) => (!params.selectionOnly || selections.some((selection) => (selection.segmentId ?? "") === segmentId && selection.startOffset <= field.endIndex && selection.endOffset > field.startIndex)) && canEditDocumentTargets(permissions, params.unitId, getDocumentEditTargetObjectIds(model, segmentId, {
14740
+ startOffset: field.startIndex,
14741
+ endOffset: field.endIndex + 1
14742
+ })));
14743
+ if (textX.length) actions = JSONX.compose(actions, JSONX.getInstance().editOp(textX, getRichTextEditPath(model, segmentId)));
14744
+ }
14745
+ if (JSONX.isNoop(actions)) return true;
14746
+ if (!params.onOpen) accessor.get(DocStateChangeManagerService).flushPendingChanges(params.unitId);
14747
+ return Boolean(accessor.get(ICommandService).syncExecuteCommand(RichTextEditingMutation.id, {
14748
+ unitId: params.unitId,
14749
+ actions,
14750
+ textRanges: transformDocumentTextRanges(actions, [...selections]),
14751
+ noHistory: params.onOpen === true,
14752
+ debounce: false,
14753
+ trigger: RefreshHeaderFooterFieldsCommand.id
14754
+ }));
14755
+ }
14756
+ };
14757
+ const UpdateSelectedDocFieldsCommand = {
14758
+ id: "doc.command.update-selected-fields",
14759
+ type: CommandType.COMMAND,
14760
+ handler(accessor) {
14761
+ const model = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
14762
+ if (!model) return false;
14763
+ return accessor.get(ICommandService).syncExecuteCommand(RefreshHeaderFooterFieldsCommand.id, {
14764
+ unitId: model.getUnitId(),
14765
+ selectionOnly: true
14766
+ });
14767
+ }
14768
+ };
14769
+ function refreshDateTimeFields(body, locale, date, canEdit) {
14770
+ const textX = new TextX();
14771
+ let cursor = 0;
14772
+ const ranges = [...body.customRanges ?? []].sort((a, b) => a.startIndex - b.startIndex);
14773
+ for (const field of ranges) {
14774
+ var _body$textRuns, _run$ts;
14775
+ const properties = field.properties;
14776
+ if (field.rangeType !== CustomRangeType.FIELD || (properties === null || properties === void 0 ? void 0 : properties.locked) === BooleanNumber.TRUE || (properties === null || properties === void 0 ? void 0 : properties.fieldType) !== "DATE" && (properties === null || properties === void 0 ? void 0 : properties.fieldType) !== "TIME" || !canEdit(field) || ranges.some((range) => range !== field && range.startIndex > field.startIndex && range.endIndex < field.endIndex)) continue;
14777
+ const start = field.startIndex;
14778
+ const run = (_body$textRuns = body.textRuns) === null || _body$textRuns === void 0 ? void 0 : _body$textRuns.find((run) => run.st <= start + 1 && run.ed > start + 1);
14779
+ const value = resolveDateTimeField(properties.instruction, (run === null || run === void 0 || (_run$ts = run.ts) === null || _run$ts === void 0 ? void 0 : _run$ts.lang) ?? locale, date);
14780
+ if (value == null || start < cursor || body.dataStream.slice(start + 1, field.endIndex) === value && properties.cachedResult === value) continue;
14781
+ const dataStream = `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${value}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`;
14782
+ textX.retain(start - cursor).delete(field.endIndex - start + 1).insert(dataStream.length, {
14783
+ dataStream,
14784
+ textRuns: run ? [{
14785
+ ...run,
14786
+ st: 0,
14787
+ ed: dataStream.length
14788
+ }] : [],
14789
+ customRanges: [{
14790
+ ...field,
14791
+ startIndex: 0,
14792
+ endIndex: dataStream.length - 1,
14793
+ properties: {
14794
+ ...properties,
14795
+ cachedResult: value
14796
+ }
14797
+ }]
14798
+ });
14799
+ cursor = field.endIndex + 1;
14800
+ }
14801
+ return textX.serialize();
14802
+ }
14803
+
14804
+ //#endregion
14805
+ //#region src/commands/operations/doc-header-footer-ribbon.operation.ts
14806
+ const DocHeaderFooterRibbonOperation = {
14807
+ id: SidebarDocHeaderFooterPanelOperation.id,
14808
+ type: SidebarDocHeaderFooterPanelOperation.type,
14809
+ handler(accessor, params) {
14810
+ const ribbon = accessor.get(IRibbonService);
14811
+ if ((params === null || params === void 0 ? void 0 : params.value) === "open") ribbon.showContextualTab(DOC_HEADER_FOOTER_RIBBON_TAB, { activate: true });
14812
+ else ribbon.hideContextualTab(DOC_HEADER_FOOTER_RIBBON_TAB);
14432
14813
  return true;
14433
14814
  }
14434
14815
  };
@@ -15057,8 +15438,12 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
15057
15438
  }
15058
15439
  _initPointer() {
15059
15440
  let preCursor = CURSOR_TYPE.TEXT;
15441
+ let pointing = false;
15060
15442
  this.disposeWithMe(this.hoverCustomRanges$.subscribe((ranges) => {
15061
- if (ranges.length) {
15443
+ const nextPointing = ranges.some(({ range }) => range.rangeType !== CustomRangeType.FIELD);
15444
+ if (nextPointing === pointing) return;
15445
+ pointing = nextPointing;
15446
+ if (pointing) {
15062
15447
  preCursor = this._context.scene.getCursor();
15063
15448
  this._context.scene.setCursor(CURSOR_TYPE.POINTER);
15064
15449
  } else this._context.scene.setCursor(preCursor);
@@ -15181,6 +15566,10 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
15181
15566
  this._buildBulletBounds();
15182
15567
  return [...this._bulletBounds];
15183
15568
  }
15569
+ getCustomRangeBounds() {
15570
+ this._buildCustomRangeBounds();
15571
+ return [...this._customRangeBounds];
15572
+ }
15184
15573
  getListContextMenuBulletByOffset(offsetX, offsetY) {
15185
15574
  const point = transformOffset2Bound(offsetX, offsetY, this._context.scene);
15186
15575
  return this._calcActiveBullet(point) ?? this._calcActiveListParagraph(point);
@@ -15726,132 +16115,50 @@ const OpenDocPermissionPanelOperation = {
15726
16115
  };
15727
16116
 
15728
16117
  //#endregion
15729
- //#region src/controllers/doc-paragraph-setting.controller.ts
15730
- /**
15731
- * Copyright 2023-present DreamNum Co., Ltd.
15732
- *
15733
- * Licensed under the Apache License, Version 2.0 (the "License");
15734
- * you may not use this file except in compliance with the License.
15735
- * You may obtain a copy of the License at
15736
- *
15737
- * http://www.apache.org/licenses/LICENSE-2.0
15738
- *
15739
- * Unless required by applicable law or agreed to in writing, software
15740
- * distributed under the License is distributed on an "AS IS" BASIS,
15741
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15742
- * See the License for the specific language governing permissions and
15743
- * limitations under the License.
15744
- */
15745
- const paragraphSettingIndexKey$1 = "doc_ui_paragraph-setting-panel";
15746
- let DocParagraphSettingController = class DocParagraphSettingController extends Disposable {
15747
- constructor(_commandService, _sidebarService) {
15748
- super();
15749
- this._commandService = _commandService;
15750
- this._sidebarService = _sidebarService;
15751
- _defineProperty(this, "_id", void 0);
15752
- }
15753
- openPanel() {
15754
- const props = {
15755
- header: { title: "docs-ui.doc.slider.paragraphSetting" },
15756
- id: this._id,
15757
- children: { label: paragraphSettingIndexKey$1 },
15758
- width: 300
15759
- };
15760
- this._sidebarService.open(props);
15761
- }
15762
- closePanel() {
15763
- this._sidebarService.close(this._id);
15764
- }
15765
- };
15766
- DocParagraphSettingController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, Inject(ISidebarService))], DocParagraphSettingController);
15767
-
15768
- //#endregion
15769
- //#region src/commands/operations/doc-paragraph-setting-panel.operation.ts
15770
- const DocParagraphSettingPanelOperation = {
15771
- id: "sidebar.operation.doc-paragraph-setting-panel",
15772
- type: CommandType.OPERATION,
15773
- handler: (accessor) => {
15774
- accessor.get(DocParagraphSettingController).openPanel();
15775
- return true;
15776
- }
15777
- };
15778
-
15779
- //#endregion
15780
- //#region src/views/section-setting/component-name.ts
15781
- /**
15782
- * Copyright 2023-present DreamNum Co., Ltd.
15783
- *
15784
- * Licensed under the Apache License, Version 2.0 (the "License");
15785
- * you may not use this file except in compliance with the License.
15786
- * You may obtain a copy of the License at
15787
- *
15788
- * http://www.apache.org/licenses/LICENSE-2.0
15789
- *
15790
- * Unless required by applicable law or agreed to in writing, software
15791
- * distributed under the License is distributed on an "AS IS" BASIS,
15792
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15793
- * See the License for the specific language governing permissions and
15794
- * limitations under the License.
15795
- */
15796
- const DOC_SECTION_SETTING_COMPONENT = "doc_ui_section-setting-panel";
15797
-
15798
- //#endregion
15799
- //#region src/controllers/doc-section-setting.controller.ts
15800
- /**
15801
- * Copyright 2023-present DreamNum Co., Ltd.
15802
- *
15803
- * Licensed under the Apache License, Version 2.0 (the "License");
15804
- * you may not use this file except in compliance with the License.
15805
- * You may obtain a copy of the License at
15806
- *
15807
- * http://www.apache.org/licenses/LICENSE-2.0
15808
- *
15809
- * Unless required by applicable law or agreed to in writing, software
15810
- * distributed under the License is distributed on an "AS IS" BASIS,
15811
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15812
- * See the License for the specific language governing permissions and
15813
- * limitations under the License.
15814
- */
15815
- let DocSectionSettingController = class DocSectionSettingController extends Disposable {
15816
- constructor(_sidebarService, _selectionManager) {
15817
- super();
15818
- this._sidebarService = _sidebarService;
15819
- this._selectionManager = _selectionManager;
15820
- _defineProperty(this, "_panelId", "DocSectionSetting");
15821
- }
15822
- openPanel() {
15823
- this._sidebarService.open({
15824
- header: { title: "docs-ui.doc.slider.sectionSetting" },
15825
- id: this._panelId,
15826
- children: { label: DOC_SECTION_SETTING_COMPONENT },
15827
- width: 300
15828
- });
15829
- }
15830
- closePanel() {
15831
- this._sidebarService.close(this._panelId);
15832
- }
15833
- navigateToSectionEnd(unitId, sectionStart, sectionEnd) {
15834
- const params = {
15835
- unitId,
15836
- subUnitId: unitId
15837
- };
15838
- const cursorOffset = Math.max(sectionStart, sectionEnd - 1);
15839
- this._selectionManager.replaceDocRanges([{
15840
- startOffset: cursorOffset,
15841
- endOffset: cursorOffset
15842
- }], params, true, { shouldFocus: false });
15843
- }
15844
- };
15845
- DocSectionSettingController = __decorate([__decorateParam(0, Inject(ISidebarService)), __decorateParam(1, Inject(DocSelectionManagerService))], DocSectionSettingController);
15846
-
15847
- //#endregion
15848
- //#region src/commands/operations/doc-section-setting-panel.operation.ts
15849
- const DocSectionSettingPanelOperation = {
15850
- id: "sidebar.operation.doc-section-setting-panel",
15851
- type: CommandType.OPERATION,
15852
- handler: (accessor) => {
15853
- accessor.get(DocSectionSettingController).openPanel();
15854
- return true;
16118
+ //#region src/commands/commands/insert-special-character.command.ts
16119
+ const InsertSpecialCharacterCommand = {
16120
+ id: "doc.command.insert-special-character",
16121
+ type: CommandType.COMMAND,
16122
+ handler: (accessor, params) => {
16123
+ var _docDataModel$getSelf, _getEditorRuntimeConf;
16124
+ if (!(params === null || params === void 0 ? void 0 : params.value)) return false;
16125
+ const commandService = accessor.get(ICommandService);
16126
+ const docSelectionManagerService = accessor.get(DocSelectionManagerService);
16127
+ const univerInstanceService = accessor.get(IUniverInstanceService);
16128
+ const docMenuStyleService = accessor.get(DocMenuStyleService);
16129
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
16130
+ const activeRange = docSelectionManagerService.getActiveTextRange();
16131
+ if (!docDataModel || !activeRange) return false;
16132
+ const { segmentId } = activeRange;
16133
+ const originBody = (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getBody();
16134
+ if (!originBody) return false;
16135
+ const { value } = params;
16136
+ const curTextRun = getTextRunForSelection(originBody, activeRange, docMenuStyleService.getDefaultStyle(), docMenuStyleService.getStyleCache(), false, ((_getEditorRuntimeConf = getEditorRuntimeConfig(docDataModel)) === null || _getEditorRuntimeConf === void 0 ? void 0 : _getEditorRuntimeConf.inheritParagraphStartStyle) === true);
16137
+ const curCustomRange = getCustomRangeAtPosition(originBody.customRanges ?? [], activeRange.endOffset);
16138
+ const curCustomDecorations = getCustomDecorationAtPosition(originBody.customDecorations ?? [], activeRange.endOffset);
16139
+ return commandService.executeCommand(InsertTextCommand.id, {
16140
+ unitId: docDataModel.getUnitId(),
16141
+ body: {
16142
+ dataStream: value,
16143
+ textRuns: [{
16144
+ ...curTextRun,
16145
+ st: 0,
16146
+ ed: value.length
16147
+ }],
16148
+ customRanges: curCustomRange ? [{
16149
+ ...curCustomRange,
16150
+ startIndex: 0,
16151
+ endIndex: value.length - 1
16152
+ }] : [],
16153
+ customDecorations: curCustomDecorations.map((customDecoration) => ({
16154
+ ...customDecoration,
16155
+ startIndex: 0,
16156
+ endIndex: value.length - 1
16157
+ }))
16158
+ },
16159
+ range: activeRange,
16160
+ segmentId
16161
+ });
15855
16162
  }
15856
16163
  };
15857
16164
 
@@ -16285,54 +16592,6 @@ const DocOpenPageSettingCommand = {
16285
16592
  }
16286
16593
  };
16287
16594
 
16288
- //#endregion
16289
- //#region src/commands/commands/insert-special-character.command.ts
16290
- const InsertSpecialCharacterCommand = {
16291
- id: "doc.command.insert-special-character",
16292
- type: CommandType.COMMAND,
16293
- handler: (accessor, params) => {
16294
- var _docDataModel$getSelf, _getEditorRuntimeConf;
16295
- if (!(params === null || params === void 0 ? void 0 : params.value)) return false;
16296
- const commandService = accessor.get(ICommandService);
16297
- const docSelectionManagerService = accessor.get(DocSelectionManagerService);
16298
- const univerInstanceService = accessor.get(IUniverInstanceService);
16299
- const docMenuStyleService = accessor.get(DocMenuStyleService);
16300
- const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
16301
- const activeRange = docSelectionManagerService.getActiveTextRange();
16302
- if (!docDataModel || !activeRange) return false;
16303
- const { segmentId } = activeRange;
16304
- const originBody = (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getBody();
16305
- if (!originBody) return false;
16306
- const { value } = params;
16307
- const curTextRun = getTextRunForSelection(originBody, activeRange, docMenuStyleService.getDefaultStyle(), docMenuStyleService.getStyleCache(), false, ((_getEditorRuntimeConf = getEditorRuntimeConfig(docDataModel)) === null || _getEditorRuntimeConf === void 0 ? void 0 : _getEditorRuntimeConf.inheritParagraphStartStyle) === true);
16308
- const curCustomRange = getCustomRangeAtPosition(originBody.customRanges ?? [], activeRange.endOffset);
16309
- const curCustomDecorations = getCustomDecorationAtPosition(originBody.customDecorations ?? [], activeRange.endOffset);
16310
- return commandService.executeCommand(InsertTextCommand.id, {
16311
- unitId: docDataModel.getUnitId(),
16312
- body: {
16313
- dataStream: value,
16314
- textRuns: [{
16315
- ...curTextRun,
16316
- st: 0,
16317
- ed: value.length
16318
- }],
16319
- customRanges: curCustomRange ? [{
16320
- ...curCustomRange,
16321
- startIndex: 0,
16322
- endIndex: value.length - 1
16323
- }] : [],
16324
- customDecorations: curCustomDecorations.map((customDecoration) => ({
16325
- ...customDecoration,
16326
- startIndex: 0,
16327
- endIndex: value.length - 1
16328
- }))
16329
- },
16330
- range: activeRange,
16331
- segmentId
16332
- });
16333
- }
16334
- };
16335
-
16336
16595
  //#endregion
16337
16596
  //#region src/views/const.ts
16338
16597
  /**
@@ -17672,22 +17931,226 @@ function getParagraphStyleAtCursor(accessor) {
17672
17931
  if (startOffset > prevIndex && startOffset <= startIndex) return paragraph;
17673
17932
  prevIndex = startIndex;
17674
17933
  }
17675
- return null;
17676
- }
17677
- function isInjectorDisposedError(error) {
17678
- if (!(error instanceof Error)) return false;
17679
- return error.name === "InjectorAlreadyDisposedError" || error.message.includes("Injector cannot be accessed after it was disposed");
17680
- }
17681
- function PageSettingMenuItemFactory(accessor) {
17682
- return {
17683
- id: DocOpenPageSettingCommand.id,
17684
- type: MenuItemType.BUTTON,
17685
- icon: "DocSettingIcon",
17686
- tooltip: "docs-ui.toolbar.pageSetup",
17687
- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),
17688
- disabled$: disableMenuWithoutDocumentEditPermission(accessor)
17689
- };
17690
- }
17934
+ return null;
17935
+ }
17936
+ function isInjectorDisposedError(error) {
17937
+ if (!(error instanceof Error)) return false;
17938
+ return error.name === "InjectorAlreadyDisposedError" || error.message.includes("Injector cannot be accessed after it was disposed");
17939
+ }
17940
+ function PageSettingMenuItemFactory(accessor) {
17941
+ return {
17942
+ id: DocOpenPageSettingCommand.id,
17943
+ type: MenuItemType.BUTTON,
17944
+ icon: "DocSettingIcon",
17945
+ tooltip: "docs-ui.toolbar.pageSetup",
17946
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),
17947
+ disabled$: disableMenuWithoutDocumentEditPermission(accessor)
17948
+ };
17949
+ }
17950
+
17951
+ //#endregion
17952
+ //#region src/menu/header-footer-ribbon.ts
17953
+ const headerFooterRibbonSchema = {
17954
+ [ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.FORMAT]: { [UpdateSelectedDocFieldsCommand.id]: {
17955
+ order: 1,
17956
+ menuItemFactory: (accessor) => {
17957
+ const instances = accessor.get(IUniverInstanceService);
17958
+ const selections = accessor.get(DocSelectionManagerService);
17959
+ return {
17960
+ id: UpdateSelectedDocFieldsCommand.id,
17961
+ type: MenuItemType.BUTTON,
17962
+ title: "docs-ui.headerFooter.refreshFields",
17963
+ disabled$: disableMenuWithoutDocumentUnitPermission(accessor, UnitAction.Edit),
17964
+ hidden$: combineLatest([instances.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), selections.textSelection$.pipe(startWith(null))]).pipe(map(([model]) => !model || !(selections.getTextRanges({
17965
+ unitId: model.getUnitId(),
17966
+ subUnitId: model.getUnitId()
17967
+ }) ?? []).some((selection) => {
17968
+ var _model$getSelfOrHeade;
17969
+ return (_model$getSelfOrHeade = model.getSelfOrHeaderFooterModel(selection.segmentId)) === null || _model$getSelfOrHeade === void 0 || (_model$getSelfOrHeade = _model$getSelfOrHeade.getBody()) === null || _model$getSelfOrHeade === void 0 || (_model$getSelfOrHeade = _model$getSelfOrHeade.customRanges) === null || _model$getSelfOrHeade === void 0 ? void 0 : _model$getSelfOrHeade.some((field) => field.rangeType === CustomRangeType.FIELD && selection.startOffset <= field.endIndex && selection.endOffset > field.startIndex);
17970
+ })))
17971
+ };
17972
+ }
17973
+ } } },
17974
+ [MenuManagerPosition.RIBBON]: { [DOC_HEADER_FOOTER_RIBBON_TAB]: {
17975
+ order: 90,
17976
+ title: "docs-ui.toolbar.headerFooter",
17977
+ contextual: true,
17978
+ ...Object.fromEntries([
17979
+ "insertion",
17980
+ "navigation",
17981
+ "options",
17982
+ "position"
17983
+ ].map((kind, order) => [`${DOC_HEADER_FOOTER_RIBBON_TAB}.${kind}`, {
17984
+ order,
17985
+ [`${DOC_HEADER_FOOTER_RIBBON_CONTROL}.${kind}`]: {
17986
+ order: 0,
17987
+ gridLayout: {
17988
+ row: 1,
17989
+ column: 1,
17990
+ rowSpan: 2
17991
+ },
17992
+ menuItemFactory: () => ({
17993
+ id: `${DOC_HEADER_FOOTER_RIBBON_CONTROL}.${kind}`,
17994
+ type: MenuItemType.BUTTON,
17995
+ label: {
17996
+ name: DOC_HEADER_FOOTER_RIBBON_CONTROL,
17997
+ hoverable: false,
17998
+ props: { kind }
17999
+ }
18000
+ })
18001
+ }
18002
+ }])),
18003
+ "docs-ui.headerFooter.close": {
18004
+ order: 5,
18005
+ [CloseHeaderFooterCommand.id]: {
18006
+ order: 0,
18007
+ gridLayout: {
18008
+ row: 1,
18009
+ column: 1,
18010
+ rowSpan: 2,
18011
+ showLabel: true
18012
+ },
18013
+ menuItemFactory: () => ({
18014
+ id: CloseHeaderFooterCommand.id,
18015
+ type: MenuItemType.BUTTON,
18016
+ icon: "CloseIcon",
18017
+ title: "docs-ui.headerFooter.closeHeaderFooter",
18018
+ tooltip: "docs-ui.headerFooter.closeHeaderFooter"
18019
+ })
18020
+ }
18021
+ }
18022
+ } }
18023
+ };
18024
+
18025
+ //#endregion
18026
+ //#region src/controllers/doc-paragraph-setting.controller.ts
18027
+ /**
18028
+ * Copyright 2023-present DreamNum Co., Ltd.
18029
+ *
18030
+ * Licensed under the Apache License, Version 2.0 (the "License");
18031
+ * you may not use this file except in compliance with the License.
18032
+ * You may obtain a copy of the License at
18033
+ *
18034
+ * http://www.apache.org/licenses/LICENSE-2.0
18035
+ *
18036
+ * Unless required by applicable law or agreed to in writing, software
18037
+ * distributed under the License is distributed on an "AS IS" BASIS,
18038
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18039
+ * See the License for the specific language governing permissions and
18040
+ * limitations under the License.
18041
+ */
18042
+ const paragraphSettingIndexKey$1 = "doc_ui_paragraph-setting-panel";
18043
+ let DocParagraphSettingController = class DocParagraphSettingController extends Disposable {
18044
+ constructor(_commandService, _sidebarService) {
18045
+ super();
18046
+ this._commandService = _commandService;
18047
+ this._sidebarService = _sidebarService;
18048
+ _defineProperty(this, "_id", void 0);
18049
+ }
18050
+ openPanel() {
18051
+ const props = {
18052
+ header: { title: "docs-ui.doc.slider.paragraphSetting" },
18053
+ id: this._id,
18054
+ children: { label: paragraphSettingIndexKey$1 },
18055
+ width: 300
18056
+ };
18057
+ this._sidebarService.open(props);
18058
+ }
18059
+ closePanel() {
18060
+ this._sidebarService.close(this._id);
18061
+ }
18062
+ };
18063
+ DocParagraphSettingController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, Inject(ISidebarService))], DocParagraphSettingController);
18064
+
18065
+ //#endregion
18066
+ //#region src/commands/operations/doc-paragraph-setting-panel.operation.ts
18067
+ const DocParagraphSettingPanelOperation = {
18068
+ id: "sidebar.operation.doc-paragraph-setting-panel",
18069
+ type: CommandType.OPERATION,
18070
+ handler: (accessor) => {
18071
+ accessor.get(DocParagraphSettingController).openPanel();
18072
+ return true;
18073
+ }
18074
+ };
18075
+
18076
+ //#endregion
18077
+ //#region src/views/section-setting/component-name.ts
18078
+ /**
18079
+ * Copyright 2023-present DreamNum Co., Ltd.
18080
+ *
18081
+ * Licensed under the Apache License, Version 2.0 (the "License");
18082
+ * you may not use this file except in compliance with the License.
18083
+ * You may obtain a copy of the License at
18084
+ *
18085
+ * http://www.apache.org/licenses/LICENSE-2.0
18086
+ *
18087
+ * Unless required by applicable law or agreed to in writing, software
18088
+ * distributed under the License is distributed on an "AS IS" BASIS,
18089
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18090
+ * See the License for the specific language governing permissions and
18091
+ * limitations under the License.
18092
+ */
18093
+ const DOC_SECTION_SETTING_COMPONENT = "doc_ui_section-setting-panel";
18094
+
18095
+ //#endregion
18096
+ //#region src/controllers/doc-section-setting.controller.ts
18097
+ /**
18098
+ * Copyright 2023-present DreamNum Co., Ltd.
18099
+ *
18100
+ * Licensed under the Apache License, Version 2.0 (the "License");
18101
+ * you may not use this file except in compliance with the License.
18102
+ * You may obtain a copy of the License at
18103
+ *
18104
+ * http://www.apache.org/licenses/LICENSE-2.0
18105
+ *
18106
+ * Unless required by applicable law or agreed to in writing, software
18107
+ * distributed under the License is distributed on an "AS IS" BASIS,
18108
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18109
+ * See the License for the specific language governing permissions and
18110
+ * limitations under the License.
18111
+ */
18112
+ let DocSectionSettingController = class DocSectionSettingController extends Disposable {
18113
+ constructor(_sidebarService, _selectionManager) {
18114
+ super();
18115
+ this._sidebarService = _sidebarService;
18116
+ this._selectionManager = _selectionManager;
18117
+ _defineProperty(this, "_panelId", "DocSectionSetting");
18118
+ }
18119
+ openPanel() {
18120
+ this._sidebarService.open({
18121
+ header: { title: "docs-ui.doc.slider.sectionSetting" },
18122
+ id: this._panelId,
18123
+ children: { label: DOC_SECTION_SETTING_COMPONENT },
18124
+ width: 300
18125
+ });
18126
+ }
18127
+ closePanel() {
18128
+ this._sidebarService.close(this._panelId);
18129
+ }
18130
+ navigateToSectionEnd(unitId, sectionStart, sectionEnd) {
18131
+ const params = {
18132
+ unitId,
18133
+ subUnitId: unitId
18134
+ };
18135
+ const cursorOffset = Math.max(sectionStart, sectionEnd - 1);
18136
+ this._selectionManager.replaceDocRanges([{
18137
+ startOffset: cursorOffset,
18138
+ endOffset: cursorOffset
18139
+ }], params, true, { shouldFocus: false });
18140
+ }
18141
+ };
18142
+ DocSectionSettingController = __decorate([__decorateParam(0, Inject(ISidebarService)), __decorateParam(1, Inject(DocSelectionManagerService))], DocSectionSettingController);
18143
+
18144
+ //#endregion
18145
+ //#region src/commands/operations/doc-section-setting-panel.operation.ts
18146
+ const DocSectionSettingPanelOperation = {
18147
+ id: "sidebar.operation.doc-section-setting-panel",
18148
+ type: CommandType.OPERATION,
18149
+ handler: (accessor) => {
18150
+ accessor.get(DocSectionSettingController).openPanel();
18151
+ return true;
18152
+ }
18153
+ };
17691
18154
 
17692
18155
  //#endregion
17693
18156
  //#region src/menu/context-menu.ts
@@ -17957,13 +18420,20 @@ function PasteSpecialMenuFactory(accessor) {
17957
18420
  id: DocPasteSpecialCommand.id,
17958
18421
  type: MenuItemType.SELECTOR,
17959
18422
  icon: "DocPasteOptionsIcon",
17960
- title: "docs-ui.pasteOptions.title",
17961
- tooltip: "docs-ui.pasteOptions.title",
18423
+ title: "docs-ui.pasteOptions.special",
18424
+ tooltip: "docs-ui.pasteOptions.special",
17962
18425
  selections: DOC_PASTE_OPTIONS.map((option) => ({ ...option })),
17963
18426
  disabled$: disableMenuWithoutDocumentUnitPermission(accessor, UnitAction.Edit),
17964
18427
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
17965
18428
  };
17966
18429
  }
18430
+ function PasteRibbonMenuFactory(accessor) {
18431
+ return {
18432
+ ...PasteSpecialMenuFactory(accessor),
18433
+ title: "docs-ui.rightClick.paste",
18434
+ hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), accessor.get(IContextService).subscribeContextValue$(FOCUSING_SHAPE_TEXT_EDITOR).pipe(startWith(false))]).pipe(map(([hidden, editing]) => hidden || editing))
18435
+ };
18436
+ }
17967
18437
 
17968
18438
  //#endregion
17969
18439
  //#region src/views/paragraph-menu/theme-color.ts
@@ -18566,28 +19036,26 @@ const floatToolbarMenuSchema = { [FLOAT_TOOLBAR_MENU_POSITION]: { [FLOAT_TEXT_ST
18566
19036
  } } };
18567
19037
  const menuSchema = {
18568
19038
  ...floatToolbarMenuSchema,
18569
- [RibbonStartGroup.OTHERS]: {
18570
- [DocPasteSpecialCommand.id]: {
18571
- order: -1,
18572
- gridLayout: {
18573
- row: 1,
18574
- column: 2,
18575
- rowSpan: 2,
18576
- showLabel: true
18577
- },
18578
- menuItemFactory: PasteSpecialMenuFactory
19039
+ [RibbonStartGroup.HISTORY]: { [DocPasteSpecialCommand.id]: {
19040
+ order: 4,
19041
+ gridLayout: {
19042
+ row: 1,
19043
+ column: 3,
19044
+ rowSpan: 2,
19045
+ showLabel: true
18579
19046
  },
18580
- [OpenDocPermissionPanelOperation.id]: {
18581
- order: 0,
18582
- gridLayout: {
18583
- row: 1,
18584
- column: 1,
18585
- rowSpan: 2,
18586
- showLabel: true
18587
- },
18588
- menuItemFactory: DocPermissionMenuItemFactory
18589
- }
18590
- },
19047
+ menuItemFactory: PasteRibbonMenuFactory
19048
+ } },
19049
+ [RibbonStartGroup.OTHERS]: { [OpenDocPermissionPanelOperation.id]: {
19050
+ order: 0,
19051
+ gridLayout: {
19052
+ row: 1,
19053
+ column: 1,
19054
+ rowSpan: 2,
19055
+ showLabel: true
19056
+ },
19057
+ menuItemFactory: DocPermissionMenuItemFactory
19058
+ } },
18591
19059
  [RibbonStartGroup.FORMAT]: {
18592
19060
  [SetInlineFormatBoldCommand.id]: {
18593
19061
  order: 0,
@@ -18835,16 +19303,18 @@ const menuSchema = {
18835
19303
  [DocPasteCommand.id]: {
18836
19304
  order: 2,
18837
19305
  menuItemFactory: PasteMenuFactory
18838
- },
19306
+ }
19307
+ },
19308
+ [ContextMenuGroup.FORMAT]: {
18839
19309
  [DocPasteSpecialCommand.id]: {
18840
- order: 3,
19310
+ order: -1,
18841
19311
  menuItemFactory: PasteSpecialMenuFactory
19312
+ },
19313
+ [DeleteLeftCommand.id]: {
19314
+ order: 0,
19315
+ menuItemFactory: DeleteMenuFactory
18842
19316
  }
18843
19317
  },
18844
- [ContextMenuGroup.FORMAT]: { [DeleteLeftCommand.id]: {
18845
- order: 0,
18846
- menuItemFactory: DeleteMenuFactory
18847
- } },
18848
19318
  [ContextMenuGroup.LAYOUT]: {
18849
19319
  [DocParagraphSettingPanelOperation.id]: {
18850
19320
  order: 0,
@@ -19439,6 +19909,9 @@ const menuSchema = {
19439
19909
 
19440
19910
  //#endregion
19441
19911
  //#region src/shortcuts/utils.ts
19912
+ function whenTextEditorFocused(contextService) {
19913
+ return contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !contextService.getContextValue(FOCUSING_COMMON_DRAWINGS) && (contextService.getContextValue(FOCUSING_DOC) || contextService.getContextValue(EDITOR_ACTIVATED) || contextService.getContextValue(FOCUSING_FX_BAR_EDITOR));
19914
+ }
19442
19915
  function whenDocAndEditorFocused(contextService) {
19443
19916
  return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
19444
19917
  }
@@ -19453,6 +19926,11 @@ const TabShortCut = {
19453
19926
  binding: KeyCode.TAB,
19454
19927
  preconditions: whenDocAndEditorFocused
19455
19928
  };
19929
+ const UpdateDocFieldsShortcut = {
19930
+ id: UpdateSelectedDocFieldsCommand.id,
19931
+ binding: KeyCode.F9,
19932
+ preconditions: whenDocAndEditorFocused
19933
+ };
19456
19934
  const ShiftTabShortCut = {
19457
19935
  id: TabCommand.id,
19458
19936
  binding: KeyCode.TAB | MetaKeys.SHIFT,
@@ -20462,21 +20940,6 @@ function DocSideMenuContent() {
20462
20940
 
20463
20941
  //#endregion
20464
20942
  //#region src/controllers/ui.controller.ts
20465
- /**
20466
- * Copyright 2023-present DreamNum Co., Ltd.
20467
- *
20468
- * Licensed under the Apache License, Version 2.0 (the "License");
20469
- * you may not use this file except in compliance with the License.
20470
- * You may obtain a copy of the License at
20471
- *
20472
- * http://www.apache.org/licenses/LICENSE-2.0
20473
- *
20474
- * Unless required by applicable law or agreed to in writing, software
20475
- * distributed under the License is distributed on an "AS IS" BASIS,
20476
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20477
- * See the License for the specific language governing permissions and
20478
- * limitations under the License.
20479
- */
20480
20943
  let DocUIController = class DocUIController extends Disposable {
20481
20944
  constructor(_injector, _commandService, _layoutService, _menuManagerService, _uiPartsService, _univerInstanceService, _shortcutService, _configService, _embedInteractionBoundaryService, _embedRuntimeFocusCoordinator) {
20482
20945
  super();
@@ -20498,6 +20961,7 @@ let DocUIController = class DocUIController extends Disposable {
20498
20961
  _initMenus() {
20499
20962
  this._menuManagerService.appendRootMenu(floatToolbarMenuSchema);
20500
20963
  this._menuManagerService.mergeMenu(menuSchema);
20964
+ this._menuManagerService.mergeMenu(headerFooterRibbonSchema);
20501
20965
  }
20502
20966
  _initShortCut() {
20503
20967
  [
@@ -20513,7 +20977,8 @@ let DocUIController = class DocUIController extends Disposable {
20513
20977
  AlignLeftShortCut,
20514
20978
  OrderListShortCut,
20515
20979
  BulletListShortCut,
20516
- TabShortCut
20980
+ TabShortCut,
20981
+ UpdateDocFieldsShortcut
20517
20982
  ].forEach((shortcut) => {
20518
20983
  this.disposeWithMe(this._shortcutService.registerShortcut(shortcut));
20519
20984
  });
@@ -20522,6 +20987,7 @@ let DocUIController = class DocUIController extends Disposable {
20522
20987
  this._initMenus();
20523
20988
  this._initFocusHandler();
20524
20989
  this._initCommands();
20990
+ this._initDateTimeFields();
20525
20991
  this._initUiParts();
20526
20992
  this._initShortCut();
20527
20993
  }
@@ -20530,10 +20996,25 @@ let DocUIController = class DocUIController extends Disposable {
20530
20996
  OpenDocPermissionPanelOperation,
20531
20997
  OpenDocParagraphPermissionOperation,
20532
20998
  CoreHeaderFooterCommand,
20999
+ InsertHeaderFooterFieldCommand,
21000
+ RefreshHeaderFooterFieldsCommand,
21001
+ UpdateSelectedDocFieldsCommand,
20533
21002
  OpenHeaderFooterPanelCommand,
20534
- SidebarDocHeaderFooterPanelOperation
21003
+ DocHeaderFooterRibbonOperation
20535
21004
  ].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
20536
21005
  }
21006
+ _initDateTimeFields() {
21007
+ const refreshed = /* @__PURE__ */ new WeakSet();
21008
+ this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).subscribe((model) => {
21009
+ if (model && !refreshed.has(model)) {
21010
+ refreshed.add(model);
21011
+ this._commandService.syncExecuteCommand(RefreshHeaderFooterFieldsCommand.id, {
21012
+ unitId: model.getUnitId(),
21013
+ onOpen: true
21014
+ });
21015
+ }
21016
+ }));
21017
+ }
20537
21018
  _initFocusHandler() {
20538
21019
  this.disposeWithMe(this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_DOC, (unitId) => {
20539
21020
  if (this._shouldPreserveEmbedFocus(unitId)) return;
@@ -20831,7 +21312,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
20831
21312
  //#endregion
20832
21313
  //#region package.json
20833
21314
  var name = "@univerjs/docs-ui";
20834
- var version = "1.0.2";
21315
+ var version = "1.0.4";
20835
21316
 
20836
21317
  //#endregion
20837
21318
  //#region src/commands/commands/doc-paragraph-setting.command.ts
@@ -21078,8 +21559,8 @@ var HeaderFooterContentCover = class extends BaseObject {
21078
21559
  right: pageLeft + page.pageWidth,
21079
21560
  bottom: pageTop + page.pageHeight
21080
21561
  });
21081
- const header = (_data$skeHeaders$get = data.skeHeaders.get(page.headerId)) === null || _data$skeHeaders$get === void 0 ? void 0 : _data$skeHeaders$get.get(page.pageWidth);
21082
- const footer = (_data$skeFooters$get = data.skeFooters.get(page.footerId)) === null || _data$skeFooters$get === void 0 ? void 0 : _data$skeFooters$get.get(page.pageWidth);
21562
+ const header = (_data$skeHeaders$get = data.skeHeaders.get(page.headerId)) === null || _data$skeHeaders$get === void 0 ? void 0 : _data$skeHeaders$get.get(page.headerLayoutKey ?? page.pageWidth);
21563
+ const footer = (_data$skeFooters$get = data.skeFooters.get(page.footerId)) === null || _data$skeFooters$get === void 0 ? void 0 : _data$skeFooters$get.get(page.footerLayoutKey ?? page.pageWidth);
21083
21564
  const local = [];
21084
21565
  if (header) this._collectTextAndTables(header, pageLeft + page.marginLeft, pageTop + header.marginTop, local);
21085
21566
  if (footer) this._collectTextAndTables(footer, pageLeft + page.marginLeft, pageTop + page.pageHeight - footer.height - footer.marginBottom, local);
@@ -21537,10 +22018,11 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
21537
22018
  const body = (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(normalizedSegmentId)) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getBody();
21538
22019
  if (body == null) return;
21539
22020
  const dataStreamLength = body.dataStream.length ?? Number.POSITIVE_INFINITY;
21540
- const customRanges = docDataModel.getCustomRanges() ?? [];
22021
+ const customRanges = body.customRanges ?? [];
21541
22022
  if (granularity !== "character") {
21542
22023
  const nextOffset = this._getCursorOffsetByGranularity(skeleton, focusOffset, direction, granularity, normalizedSegmentId, normalizedSegmentPage, dataStreamLength, body.dataStream);
21543
22024
  if (nextOffset == null || nextOffset === focusOffset) return;
22025
+ if (this._deferUnmaterializedCursorMove(docDataModel, skeleton, nextOffset, normalizedSegmentId, () => this._handleShiftMoveSelection(direction, granularity))) return;
21544
22026
  const normalizedNextOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, nextOffset, direction, normalizedSegmentId, normalizedSegmentPage);
21545
22027
  if (normalizedNextOffset == null || normalizedNextOffset === focusOffset) return;
21546
22028
  this._textSelectionManagerService.replaceDocRanges([{
@@ -21608,7 +22090,7 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
21608
22090
  const body = (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(normalizedSegmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.getBody();
21609
22091
  if (body == null) return;
21610
22092
  const dataStreamLength = body.dataStream.length ?? Number.POSITIVE_INFINITY;
21611
- const customRanges = docDataModel.getCustomRanges() ?? [];
22093
+ const customRanges = body.customRanges ?? [];
21612
22094
  if (granularity !== "character") {
21613
22095
  let cursorOffset;
21614
22096
  if (!activeRange.collapsed || allRanges.length > 1) {
@@ -22231,26 +22713,33 @@ function DocPasteOptions() {
22231
22713
  const commandService = useDependency(ICommandService);
22232
22714
  const localeService = useDependency(LocaleService);
22233
22715
  const layoutService = useDependency(ILayoutService);
22716
+ const editorService = useDependency(IEditorService);
22234
22717
  const state = useObservable(clipboard.pasteOptions$, null);
22235
22718
  const [busy, setBusy] = useState(false);
22236
22719
  const [open, setOpen] = useState(false);
22720
+ const focusEditor = () => {
22721
+ const editor = state && clipboard.isPasteOptionsEnabled(state.unitId) && editorService.getEditor(state.unitId);
22722
+ if (editor) editor.focus();
22723
+ else layoutService.focus();
22724
+ };
22237
22725
  const changeMode = async (value) => {
22238
22726
  setBusy(true);
22239
22727
  try {
22240
22728
  await commandService.executeCommand(DocChangePasteModeCommand.id, { value });
22241
22729
  } finally {
22242
22730
  setBusy(false);
22243
- layoutService.focus();
22731
+ focusEditor();
22244
22732
  }
22245
22733
  };
22246
22734
  if (!state) return null;
22247
22735
  return /* @__PURE__ */ jsx(DropdownMenu, {
22736
+ "data-u-editor-interaction-boundary": "true",
22248
22737
  align: "start",
22249
22738
  open,
22250
22739
  onOpenChange: setOpen,
22251
22740
  onCloseAutoFocus: (event) => {
22252
22741
  event.preventDefault();
22253
- layoutService.focus();
22742
+ focusEditor();
22254
22743
  },
22255
22744
  onEscapeKeyDown: () => clipboard.dismissPasteOptions(),
22256
22745
  items: DOC_PASTE_OPTIONS.map((option) => ({
@@ -22262,6 +22751,7 @@ function DocPasteOptions() {
22262
22751
  onSelect: () => changeMode(option.value)
22263
22752
  })),
22264
22753
  children: /* @__PURE__ */ jsxs(Button, {
22754
+ "data-u-editor-interaction-boundary": "true",
22265
22755
  size: "small",
22266
22756
  disabled: busy,
22267
22757
  "aria-label": localeService.t("docs-ui.pasteOptions.title"),
@@ -22270,7 +22760,7 @@ function DocPasteOptions() {
22270
22760
  onKeyDown: (event) => {
22271
22761
  if (event.key === "Escape") {
22272
22762
  clipboard.dismissPasteOptions();
22273
- layoutService.focus();
22763
+ focusEditor();
22274
22764
  }
22275
22765
  },
22276
22766
  className: "univer-shadow-sm",
@@ -22529,28 +23019,37 @@ function useHeaderFooterOptions(unitId) {
22529
23019
  page
22530
23020
  };
22531
23021
  };
22532
- const [options, setOptions] = useState(() => {
22533
- var _getCurrentSectionCon;
22534
- const config = (_getCurrentSectionCon = getCurrentSectionContext()) === null || _getCurrentSectionCon === void 0 ? void 0 : _getCurrentSectionCon.config;
22535
- return {
22536
- marginHeader: (config === null || config === void 0 ? void 0 : config.marginHeader) ?? 0,
22537
- marginFooter: (config === null || config === void 0 ? void 0 : config.marginFooter) ?? 0,
22538
- useFirstPageHeaderFooter: (config === null || config === void 0 ? void 0 : config.useFirstPageHeaderFooter) ?? BooleanNumber.FALSE,
22539
- evenAndOddHeaders: (config === null || config === void 0 ? void 0 : config.evenAndOddHeaders) ?? BooleanNumber.FALSE
23022
+ const [, refresh] = useReducer((revision) => revision + 1, 0);
23023
+ useEffect(() => {
23024
+ const commandListener = commandService.onCommandExecuted((command) => {
23025
+ var _command$params;
23026
+ if (command.id === RichTextEditingMutation.id && ((_command$params = command.params) === null || _command$params === void 0 ? void 0 : _command$params.unitId) === unitId) refresh();
23027
+ });
23028
+ const segmentListener = docSelectionRenderService.segmentContext$.subscribe(() => refresh());
23029
+ return () => {
23030
+ commandListener.dispose();
23031
+ segmentListener.unsubscribe();
22540
23032
  };
22541
- });
23033
+ }, [
23034
+ commandService,
23035
+ docSelectionRenderService,
23036
+ unitId
23037
+ ]);
22542
23038
  const sectionContext = getCurrentSectionContext();
23039
+ const config = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config;
23040
+ const options = {
23041
+ marginHeader: (config === null || config === void 0 ? void 0 : config.marginHeader) ?? 0,
23042
+ marginFooter: (config === null || config === void 0 ? void 0 : config.marginFooter) ?? 0,
23043
+ useFirstPageHeaderFooter: (config === null || config === void 0 ? void 0 : config.useFirstPageHeaderFooter) ?? BooleanNumber.FALSE,
23044
+ evenAndOddHeaders: (config === null || config === void 0 ? void 0 : config.evenAndOddHeaders) ?? BooleanNumber.FALSE
23045
+ };
22543
23046
  const headerFooterKind = ((_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";
22544
23047
  const variant = getHeaderFooterVariant((sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config) ?? {}, docSelectionRenderService.getSegmentPage(), sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.page);
22545
23048
  const referenceKey = getSectionHeaderFooterReferenceKey(headerFooterKind, variant);
22546
23049
  const canLinkToPrevious = ((sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.sectionIndex) ?? -1) > 0;
22547
- const [linkedToPrevious, setLinkedToPrevious] = useState(canLinkToPrevious && !(sectionContext === null || sectionContext === void 0 || (_sectionContext$secti = sectionContext.section) === null || _sectionContext$secti === void 0 ? void 0 : _sectionContext$secti[referenceKey]));
22548
- const handleCheckboxChange = (val, type) => {
23050
+ const linkedToPrevious = canLinkToPrevious && !(sectionContext === null || sectionContext === void 0 || (_sectionContext$secti = sectionContext.section) === null || _sectionContext$secti === void 0 ? void 0 : _sectionContext$secti[referenceKey]);
23051
+ const handleCheckboxChange = async (val, type) => {
22549
23052
  var _renderManagerService3;
22550
- setOptions((prev) => ({
22551
- ...prev,
22552
- [type]: val ? BooleanNumber.TRUE : BooleanNumber.FALSE
22553
- }));
22554
23053
  const sectionContext = getCurrentSectionContext();
22555
23054
  const documentStyle = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config;
22556
23055
  const docSkeletonManagerService = (_renderManagerService3 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService);
@@ -22575,7 +23074,7 @@ function useHeaderFooterOptions(unitId) {
22575
23074
  if (needCreateHeaderFooter) {
22576
23075
  const segmentId = generateRandomId(6);
22577
23076
  if (needChangeSegmentId) docSelectionRenderService.setSegment(segmentId);
22578
- commandService.executeCommand(CoreHeaderFooterCommandId, {
23077
+ await commandService.executeCommand(CoreHeaderFooterCommandId, {
22579
23078
  unitId,
22580
23079
  segmentId,
22581
23080
  headerFooterProps: { [type]: val ? BooleanNumber.TRUE : BooleanNumber.FALSE },
@@ -22589,7 +23088,7 @@ function useHeaderFooterOptions(unitId) {
22589
23088
  [type]: val ? BooleanNumber.TRUE : BooleanNumber.FALSE
22590
23089
  }, editArea, segmentPageIndex, sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.page);
22591
23090
  if (needFocusSegmentId && needFocusSegmentId !== prevSegmentId) docSelectionRenderService.setSegment(needFocusSegmentId);
22592
- commandService.executeCommand(CoreHeaderFooterCommandId, {
23091
+ await commandService.executeCommand(CoreHeaderFooterCommandId, {
22593
23092
  unitId,
22594
23093
  headerFooterProps: { [type]: val ? BooleanNumber.TRUE : BooleanNumber.FALSE },
22595
23094
  sectionId: sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.sectionId
@@ -22598,21 +23097,16 @@ function useHeaderFooterOptions(unitId) {
22598
23097
  layoutService.focus();
22599
23098
  };
22600
23099
  const handleMarginChange = async (val, type) => {
22601
- var _getCurrentSectionCon2;
22602
- setOptions((prev) => ({
22603
- ...prev,
22604
- [type]: val
22605
- }));
23100
+ var _getCurrentSectionCon;
22606
23101
  await commandService.executeCommand(CoreHeaderFooterCommandId, {
22607
23102
  unitId,
22608
23103
  headerFooterProps: { [type]: val },
22609
- sectionId: (_getCurrentSectionCon2 = getCurrentSectionContext()) === null || _getCurrentSectionCon2 === void 0 ? void 0 : _getCurrentSectionCon2.sectionId
23104
+ sectionId: (_getCurrentSectionCon = getCurrentSectionContext()) === null || _getCurrentSectionCon === void 0 ? void 0 : _getCurrentSectionCon.sectionId
22610
23105
  });
22611
- docSelectionRenderService.removeAllRanges();
22612
23106
  docSelectionRenderService.blur();
22613
23107
  };
22614
23108
  const closeHeaderFooter = () => {
22615
- commandService.executeCommand(CloseHeaderFooterCommand.id, { unitId });
23109
+ return commandService.executeCommand(CloseHeaderFooterCommand.id, { unitId });
22616
23110
  };
22617
23111
  const handleLinkToPreviousChange = async (linked) => {
22618
23112
  var _renderManagerService4;
@@ -22631,7 +23125,6 @@ function useHeaderFooterOptions(unitId) {
22631
23125
  linkedToPrevious: linked,
22632
23126
  ...linked ? {} : { segmentId }
22633
23127
  })) return;
22634
- setLinkedToPrevious(linked);
22635
23128
  docSelectionRenderService.setSegment(linked ? previousSegmentId ?? "" : segmentId);
22636
23129
  layoutService.focus();
22637
23130
  };
@@ -24114,25 +24607,30 @@ const mobileMenuSchema = {
24114
24607
  menuItemFactory: SelectAllMenuFactory
24115
24608
  }
24116
24609
  } },
24117
- [DOC_CARET_MENU_ID]: { [ContextMenuGroup.QUICK]: {
24118
- quickLayout: "tile",
24119
- [DocPasteCommand.id]: {
24120
- order: 0,
24121
- menuItemFactory: PasteMenuFactory
24122
- },
24123
- [DocPasteSpecialCommand.id]: {
24124
- order: .5,
24125
- menuItemFactory: PasteSpecialMenuFactory
24610
+ [DOC_CARET_MENU_ID]: {
24611
+ [ContextMenuGroup.QUICK]: {
24612
+ quickLayout: "tile",
24613
+ [DocPasteCommand.id]: {
24614
+ order: 0,
24615
+ menuItemFactory: PasteMenuFactory
24616
+ },
24617
+ [DocSelectWordCommand.id]: {
24618
+ order: 1,
24619
+ menuItemFactory: SelectWordMenuFactory
24620
+ },
24621
+ [DocSelectAllCommand.id]: {
24622
+ order: 2,
24623
+ menuItemFactory: SelectAllMenuFactory
24624
+ }
24126
24625
  },
24127
- [DocSelectWordCommand.id]: {
24626
+ [ContextMenuGroup.FORMAT]: {
24128
24627
  order: 1,
24129
- menuItemFactory: SelectWordMenuFactory
24130
- },
24131
- [DocSelectAllCommand.id]: {
24132
- order: 2,
24133
- menuItemFactory: SelectAllMenuFactory
24628
+ [DocPasteSpecialCommand.id]: {
24629
+ order: 0,
24630
+ menuItemFactory: PasteSpecialMenuFactory
24631
+ }
24134
24632
  }
24135
- } }
24633
+ }
24136
24634
  };
24137
24635
 
24138
24636
  //#endregion
@@ -25328,9 +25826,9 @@ let DocPasteOptionsRenderController = class DocPasteOptionsRenderController exte
25328
25826
  this._context = _context;
25329
25827
  this._clipboard = _clipboard;
25330
25828
  _defineProperty(this, "_popup", void 0);
25331
- if (isInternalEditorID(_context.unitId)) return;
25332
25829
  const mobile = contextService.getContextValue(MOBILE_UI_MODE) === true;
25333
25830
  this.disposeWithMe(selection.onKeydown$.subscribe(({ event }) => {
25831
+ if (!this._clipboard.isPasteOptionsEnabled(this._context.unitId)) return;
25334
25832
  const key = event;
25335
25833
  if ((key.ctrlKey || key.metaKey) && key.shiftKey && key.key.toLowerCase() === "v") this._clipboard.setNextPasteMode("text");
25336
25834
  else if (![
@@ -25343,12 +25841,17 @@ let DocPasteOptionsRenderController = class DocPasteOptionsRenderController exte
25343
25841
  this._clipboard.dismissPasteOptions();
25344
25842
  }
25345
25843
  }));
25346
- this.disposeWithMe(selection.onInputBefore$.subscribe(() => this._clipboard.dismissPasteOptions()));
25844
+ this.disposeWithMe(selection.onInputBefore$.subscribe(() => {
25845
+ if (this._clipboard.isPasteOptionsEnabled(this._context.unitId)) this._clipboard.dismissPasteOptions();
25846
+ }));
25347
25847
  this.disposeWithMe(selection.onPointerDown$.subscribe(() => {
25848
+ if (!this._clipboard.isPasteOptionsEnabled(this._context.unitId)) return;
25348
25849
  this._clipboard.setNextPasteMode("source");
25349
25850
  if (!mobile) this._clipboard.dismissPasteOptions();
25350
25851
  }));
25351
- this.disposeWithMe(selection.onBlur$.subscribe(() => this._clipboard.setNextPasteMode("source")));
25852
+ this.disposeWithMe(selection.onBlur$.subscribe(() => {
25853
+ if (this._clipboard.isPasteOptionsEnabled(this._context.unitId)) this._clipboard.setNextPasteMode("source");
25854
+ }));
25352
25855
  this.disposeWithMe(this._clipboard.pasteOptions$.subscribe((state) => {
25353
25856
  var _this$_popup;
25354
25857
  (_this$_popup = this._popup) === null || _this$_popup === void 0 || _this$_popup.dispose();
@@ -25368,7 +25871,7 @@ let DocPasteOptionsRenderController = class DocPasteOptionsRenderController exte
25368
25871
  this.disposeWithMe(() => {
25369
25872
  var _this$_popup2;
25370
25873
  (_this$_popup2 = this._popup) === null || _this$_popup2 === void 0 || _this$_popup2.dispose();
25371
- this._clipboard.dismissPasteOptions();
25874
+ if (this._popup) this._clipboard.dismissPasteOptions();
25372
25875
  });
25373
25876
  }
25374
25877
  };
@@ -26405,8 +26908,8 @@ var DocPrintInterceptorService = class extends Disposable {
26405
26908
  const page = data.pages[pageIndex];
26406
26909
  if (!page) return drawingIds;
26407
26910
  collectPageDrawingIds(page, drawingIds);
26408
- const header = (_data$skeHeaders$get = data.skeHeaders.get(page.headerId)) === null || _data$skeHeaders$get === void 0 ? void 0 : _data$skeHeaders$get.get(page.pageWidth);
26409
- const footer = (_data$skeFooters$get = data.skeFooters.get(page.footerId)) === null || _data$skeFooters$get === void 0 ? void 0 : _data$skeFooters$get.get(page.pageWidth);
26911
+ const header = (_data$skeHeaders$get = data.skeHeaders.get(page.headerId)) === null || _data$skeHeaders$get === void 0 ? void 0 : _data$skeHeaders$get.get(page.headerLayoutKey ?? page.pageWidth);
26912
+ const footer = (_data$skeFooters$get = data.skeFooters.get(page.footerId)) === null || _data$skeFooters$get === void 0 ? void 0 : _data$skeFooters$get.get(page.footerLayoutKey ?? page.pageWidth);
26410
26913
  if (header) collectPageDrawingIds(header, drawingIds);
26411
26914
  if (footer) collectPageDrawingIds(footer, drawingIds);
26412
26915
  return drawingIds;
@@ -27407,6 +27910,319 @@ UniverDocsMobileUIPlugin = __decorate([
27407
27910
  __decorateParam(4, IConfigService)
27408
27911
  ], UniverDocsMobileUIPlugin);
27409
27912
 
27913
+ //#endregion
27914
+ //#region src/views/header-footer/panel/DocHeaderFooterFields.tsx
27915
+ function DocHeaderFooterFields({ unitId, disabled }) {
27916
+ const localeService = useDependency(LocaleService);
27917
+ useObservable(localeService.currentLocale$);
27918
+ const commands = useDependency(ICommandService);
27919
+ const layout = useDependency(ILayoutService);
27920
+ const shortcuts = useDependency(IShortcutService);
27921
+ const selections = useDependency(DocSelectionManagerService);
27922
+ const instances = useDependency(IUniverInstanceService);
27923
+ const [target, setTarget] = useState(null);
27924
+ const [format, setFormat] = useState("short");
27925
+ const [automatic, setAutomatic] = useState(true);
27926
+ const [error, setError] = useState(false);
27927
+ const [previewDate, setPreviewDate] = useState(() => /* @__PURE__ */ new Date());
27928
+ const locale = LOCALE_META[localeService.getCurrentLocale()].tag;
27929
+ const dialogOpen = target !== null;
27930
+ const dialogFocusRef = useRef(null);
27931
+ useEffect(() => {
27932
+ var _instances$getFocused;
27933
+ if (dialogOpen) return;
27934
+ const focus = dialogFocusRef.current;
27935
+ dialogFocusRef.current = null;
27936
+ if ((focus === null || focus === void 0 ? void 0 : focus.unitId) === unitId && instances.getUnit(unitId) && ((_instances$getFocused = instances.getFocusedUnit()) === null || _instances$getFocused === void 0 ? void 0 : _instances$getFocused.getUnitId()) === focus.focusedUnitId) layout.focus(unitId);
27937
+ }, [
27938
+ dialogOpen,
27939
+ instances,
27940
+ layout,
27941
+ unitId
27942
+ ]);
27943
+ useEffect(() => {
27944
+ if (!dialogOpen) return;
27945
+ const escape = shortcuts.forceEscape();
27946
+ return () => escape.dispose();
27947
+ }, [dialogOpen, shortcuts]);
27948
+ function restoreFocus(event) {
27949
+ event.preventDefault();
27950
+ layout.focus(unitId);
27951
+ }
27952
+ function openDateTime() {
27953
+ var _instances$getUnit, _instances$getFocused2;
27954
+ const selection = selections.getActiveTextRange();
27955
+ const body = (_instances$getUnit = instances.getUnit(unitId)) === null || _instances$getUnit === void 0 || (_instances$getUnit = _instances$getUnit.getSelfOrHeaderFooterModel(selection === null || selection === void 0 ? void 0 : selection.segmentId)) === null || _instances$getUnit === void 0 ? void 0 : _instances$getUnit.getBody();
27956
+ if (!(selection === null || selection === void 0 ? void 0 : selection.segmentId) || !body) return;
27957
+ dialogFocusRef.current = {
27958
+ unitId,
27959
+ focusedUnitId: (_instances$getFocused2 = instances.getFocusedUnit()) === null || _instances$getFocused2 === void 0 ? void 0 : _instances$getFocused2.getUnitId()
27960
+ };
27961
+ setTarget({
27962
+ unitId,
27963
+ selection: { ...selection },
27964
+ segmentId: selection.segmentId,
27965
+ segmentPage: selection.segmentPage,
27966
+ expectedDataStream: body.dataStream
27967
+ });
27968
+ setPreviewDate(/* @__PURE__ */ new Date());
27969
+ setError(false);
27970
+ }
27971
+ async function insertDateTime() {
27972
+ if (!target) return;
27973
+ if (await commands.executeCommand(InsertHeaderFooterFieldCommand.id, {
27974
+ ...target,
27975
+ fieldType: format === "time" ? "TIME" : "DATE",
27976
+ format,
27977
+ automatic
27978
+ })) setTarget(null);
27979
+ else setError(true);
27980
+ }
27981
+ return /* @__PURE__ */ jsxs("div", {
27982
+ className: "univer-flex univer-flex-col univer-gap-1 univer-text-xs",
27983
+ children: [
27984
+ /* @__PURE__ */ jsx(DropdownMenu, {
27985
+ onCloseAutoFocus: restoreFocus,
27986
+ disabled,
27987
+ items: [
27988
+ {
27989
+ type: "item",
27990
+ children: localeService.t("docs-ui.headerFooter.currentPage"),
27991
+ onSelect: () => commands.executeCommand(InsertHeaderFooterFieldCommand.id, {
27992
+ unitId,
27993
+ fieldType: "PAGE"
27994
+ })
27995
+ },
27996
+ {
27997
+ type: "item",
27998
+ children: localeService.t("docs-ui.headerFooter.totalPages"),
27999
+ onSelect: () => commands.executeCommand(InsertHeaderFooterFieldCommand.id, {
28000
+ unitId,
28001
+ fieldType: "NUMPAGES"
28002
+ })
28003
+ },
28004
+ { type: "separator" },
28005
+ {
28006
+ type: "item",
28007
+ children: localeService.t("docs-ui.headerFooter.refreshFields"),
28008
+ onSelect: () => commands.executeCommand(RefreshHeaderFooterFieldsCommand.id, { unitId })
28009
+ }
28010
+ ],
28011
+ children: /* @__PURE__ */ jsxs(Button, {
28012
+ className: "univer-justify-start",
28013
+ "data-u-command": InsertHeaderFooterFieldCommand.id,
28014
+ size: "small",
28015
+ variant: "text",
28016
+ disabled,
28017
+ onMouseDown: (event) => event.preventDefault(),
28018
+ children: [
28019
+ /* @__PURE__ */ jsx(NumberIcon, { "aria-hidden": "true" }),
28020
+ /* @__PURE__ */ jsx("span", {
28021
+ className: "univer-flex-1 univer-text-start",
28022
+ children: localeService.t("docs-ui.headerFooter.pageNumber")
28023
+ }),
28024
+ /* @__PURE__ */ jsx(MoreDownIcon, { "aria-hidden": "true" })
28025
+ ]
28026
+ })
28027
+ }),
28028
+ /* @__PURE__ */ jsxs(Button, {
28029
+ className: "univer-justify-start",
28030
+ "data-u-command": InsertHeaderFooterFieldCommand.id,
28031
+ size: "small",
28032
+ variant: "text",
28033
+ disabled,
28034
+ onMouseDown: (event) => event.preventDefault(),
28035
+ onClick: openDateTime,
28036
+ children: [/* @__PURE__ */ jsx(CalendarIcon, { "aria-hidden": "true" }), localeService.t("docs-ui.headerFooter.dateTime")]
28037
+ }),
28038
+ /* @__PURE__ */ jsx(Dialog, {
28039
+ open: dialogOpen,
28040
+ width: 360,
28041
+ title: localeService.t("docs-ui.headerFooter.dateTime"),
28042
+ showOk: true,
28043
+ showCancel: true,
28044
+ onClose: () => setTarget(null),
28045
+ onCancel: () => setTarget(null),
28046
+ onOk: insertDateTime,
28047
+ children: /* @__PURE__ */ jsxs("div", {
28048
+ className: "univer-flex univer-flex-col univer-gap-4",
28049
+ children: [
28050
+ /* @__PURE__ */ jsx(DropdownMenu, {
28051
+ align: "start",
28052
+ className: "univer-w-[--radix-popper-anchor-width]",
28053
+ items: [{
28054
+ type: "radio",
28055
+ value: format,
28056
+ hideIndicator: true,
28057
+ onSelect: (value) => setFormat(value),
28058
+ options: [
28059
+ "short",
28060
+ "long",
28061
+ "time"
28062
+ ].map((value) => ({
28063
+ value,
28064
+ label: createDateTimeField(value, locale, previewDate).cachedResult
28065
+ }))
28066
+ }],
28067
+ children: /* @__PURE__ */ jsxs(Button, {
28068
+ "aria-label": localeService.t("docs-ui.headerFooter.dateTime"),
28069
+ className: selectClassName,
28070
+ "data-u-comp": "select",
28071
+ children: [/* @__PURE__ */ jsx("span", {
28072
+ className: "univer-flex-1 univer-truncate univer-text-start",
28073
+ children: createDateTimeField(format, locale, previewDate).cachedResult
28074
+ }), /* @__PURE__ */ jsx(MoreDownIcon, { "aria-hidden": "true" })]
28075
+ })
28076
+ }),
28077
+ /* @__PURE__ */ jsx(Checkbox, {
28078
+ checked: automatic,
28079
+ onChange: (value) => setAutomatic(Boolean(value)),
28080
+ children: localeService.t("docs-ui.headerFooter.updateAutomatically")
28081
+ }),
28082
+ error && /* @__PURE__ */ jsx("p", {
28083
+ role: "alert",
28084
+ children: localeService.t("docs-ui.headerFooter.insertFailed")
28085
+ })
28086
+ ]
28087
+ })
28088
+ })
28089
+ ]
28090
+ });
28091
+ }
28092
+
28093
+ //#endregion
28094
+ //#region src/views/header-footer/panel/DocHeaderFooterRibbonControl.tsx
28095
+ function DocHeaderFooterRibbonControl(props) {
28096
+ const instances = useDependency(IUniverInstanceService);
28097
+ const localeService = useDependency(LocaleService);
28098
+ useObservable(localeService.currentLocale$);
28099
+ const document = useObservable(() => instances.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), void 0, false, [instances]);
28100
+ const containerRef = useRef(null);
28101
+ const [compact, setCompact] = useState(false);
28102
+ const { kind } = props;
28103
+ useEffect(() => {
28104
+ var _containerRef$current;
28105
+ const toolbar = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.closest("[role=\"toolbar\"]");
28106
+ if (!toolbar || kind === "insertion") return;
28107
+ const thresholds = {
28108
+ position: 1100,
28109
+ options: 900,
28110
+ navigation: 650
28111
+ };
28112
+ const resize = () => setCompact(toolbar.getBoundingClientRect().width < thresholds[kind]);
28113
+ const observer = new ResizeObserver(resize);
28114
+ observer.observe(toolbar);
28115
+ return () => observer.disconnect();
28116
+ }, [kind, document]);
28117
+ if (!document) return null;
28118
+ const content = /* @__PURE__ */ jsx(HeaderFooterRibbonControl, {
28119
+ ...props,
28120
+ unitId: document.getUnitId()
28121
+ }, document.getUnitId());
28122
+ return /* @__PURE__ */ jsx("div", {
28123
+ ref: containerRef,
28124
+ "data-u-command": OpenHeaderFooterPanelCommand.id,
28125
+ className: "univer-flex univer-items-center univer-whitespace-nowrap",
28126
+ children: compact && kind !== "insertion" ? /* @__PURE__ */ jsx(DropdownMenu, {
28127
+ items: [{
28128
+ type: "custom",
28129
+ className: "univer-p-2",
28130
+ children: content
28131
+ }],
28132
+ children: /* @__PURE__ */ jsx(Button, {
28133
+ "data-u-command": OpenHeaderFooterPanelCommand.id,
28134
+ size: "small",
28135
+ variant: "text",
28136
+ onMouseDown: (event) => event.preventDefault(),
28137
+ children: localeService.t(`docs-ui.headerFooter.${kind}`)
28138
+ })
28139
+ }) : content
28140
+ });
28141
+ }
28142
+ function HeaderFooterRibbonControl({ kind, unitId }) {
28143
+ var _instances$getUnit, _renders$getRenderUni;
28144
+ const localeService = useDependency(LocaleService);
28145
+ const commandService = useDependency(ICommandService);
28146
+ const renders = useDependency(IRenderManagerService);
28147
+ const permissionService = useDependency(IPermissionService);
28148
+ useObservable(permissionService.permissionPointUpdate$);
28149
+ const instances = useDependency(IUniverInstanceService);
28150
+ const disabled = Boolean((_instances$getUnit = instances.getUnit(unitId)) === null || _instances$getUnit === void 0 ? void 0 : _instances$getUnit.getSnapshot().disabled) || !getDocumentPermissionValue(permissionService, unitId, unitId, UnitAction.Edit);
28151
+ const { canLinkToPrevious, linkedToPrevious, options, handleLinkToPreviousChange, handleCheckboxChange, handleMarginChange } = useHeaderFooterOptions(unitId);
28152
+ const area = (_renders$getRenderUni = renders.getRenderUnitById(unitId)) === null || _renders$getRenderUni === void 0 ? void 0 : _renders$getRenderUni.with(DocSkeletonManagerService).getViewModel().getEditArea();
28153
+ if (kind === "insertion") return /* @__PURE__ */ jsx(DocHeaderFooterFields, {
28154
+ unitId,
28155
+ disabled
28156
+ });
28157
+ if (kind === "navigation") return /* @__PURE__ */ jsxs("div", {
28158
+ className: "univer-grid univer-grid-cols-[auto_auto] univer-items-center univer-gap-x-2 univer-gap-y-1 univer-text-start univer-text-xs",
28159
+ children: [
28160
+ /* @__PURE__ */ jsx(Button, {
28161
+ "data-u-command": OpenHeaderFooterPanelCommand.id,
28162
+ size: "small",
28163
+ variant: "text",
28164
+ disabled: disabled || area === DocumentEditArea.HEADER,
28165
+ onMouseDown: (event) => event.preventDefault(),
28166
+ onClick: () => commandService.executeCommand(OpenHeaderFooterPanelCommand.id, { editArea: DocumentEditArea.HEADER }),
28167
+ children: localeService.t("docs-ui.headerFooter.goToHeader")
28168
+ }),
28169
+ /* @__PURE__ */ jsx(Checkbox, {
28170
+ disabled: disabled || !canLinkToPrevious,
28171
+ checked: linkedToPrevious,
28172
+ onChange: (value) => handleLinkToPreviousChange(Boolean(value)),
28173
+ children: localeService.t("docs-ui.headerFooter.linkToPrevious")
28174
+ }),
28175
+ /* @__PURE__ */ jsx(Button, {
28176
+ "data-u-command": OpenHeaderFooterPanelCommand.id,
28177
+ size: "small",
28178
+ variant: "text",
28179
+ disabled: disabled || area === DocumentEditArea.FOOTER,
28180
+ onMouseDown: (event) => event.preventDefault(),
28181
+ onClick: () => commandService.executeCommand(OpenHeaderFooterPanelCommand.id, { editArea: DocumentEditArea.FOOTER }),
28182
+ children: localeService.t("docs-ui.headerFooter.goToFooter")
28183
+ })
28184
+ ]
28185
+ });
28186
+ if (kind === "options") return /* @__PURE__ */ jsxs("div", {
28187
+ className: "univer-flex univer-flex-col univer-gap-2 univer-text-start univer-text-xs",
28188
+ children: [/* @__PURE__ */ jsx(Checkbox, {
28189
+ disabled,
28190
+ checked: options.useFirstPageHeaderFooter === BooleanNumber.TRUE,
28191
+ onChange: (value) => handleCheckboxChange(Boolean(value), "useFirstPageHeaderFooter"),
28192
+ children: localeService.t("docs-ui.headerFooter.firstPageCheckBox")
28193
+ }), /* @__PURE__ */ jsx(Checkbox, {
28194
+ disabled,
28195
+ checked: options.evenAndOddHeaders === BooleanNumber.TRUE,
28196
+ onChange: (value) => handleCheckboxChange(Boolean(value), "evenAndOddHeaders"),
28197
+ children: localeService.t("docs-ui.headerFooter.oddEvenCheckBox")
28198
+ })]
28199
+ });
28200
+ return /* @__PURE__ */ jsxs("div", {
28201
+ className: "univer-flex univer-flex-col univer-gap-1 univer-text-start univer-text-xs",
28202
+ children: [/* @__PURE__ */ jsxs("label", {
28203
+ className: "univer-grid univer-grid-cols-[1fr_5rem] univer-items-center univer-gap-x-2",
28204
+ children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-ui.headerFooter.headerTopMargin") }), /* @__PURE__ */ jsx(InputNumber, {
28205
+ disabled,
28206
+ min: 0,
28207
+ max: 200,
28208
+ precision: 1,
28209
+ value: options.marginHeader,
28210
+ onChange: (value) => handleMarginChange(value ?? 0, "marginHeader")
28211
+ })]
28212
+ }), /* @__PURE__ */ jsxs("label", {
28213
+ className: "univer-grid univer-grid-cols-[1fr_5rem] univer-items-center univer-gap-x-2",
28214
+ children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-ui.headerFooter.footerBottomMargin") }), /* @__PURE__ */ jsx(InputNumber, {
28215
+ disabled,
28216
+ min: 0,
28217
+ max: 200,
28218
+ precision: 1,
28219
+ value: options.marginFooter,
28220
+ onChange: (value) => handleMarginChange(value ?? 0, "marginFooter")
28221
+ })]
28222
+ })]
28223
+ });
28224
+ }
28225
+
27410
28226
  //#endregion
27411
28227
  //#region src/views/paragraph-menu/component-keys.ts
27412
28228
  /**
@@ -29202,6 +30018,7 @@ let ComponentsController = class ComponentsController extends Disposable {
29202
30018
  BoldIcon,
29203
30019
  CopyDoubleIcon,
29204
30020
  ColumnIcon,
30021
+ CloseIcon,
29205
30022
  CutIcon,
29206
30023
  DeleteColumnDoubleIcon,
29207
30024
  DeleteIcon,
@@ -29280,7 +30097,8 @@ let ComponentsController = class ComponentsController extends Disposable {
29280
30097
  }));
29281
30098
  }
29282
30099
  _registerComponents() {
29283
- if (!this._componentManager.get("COMPONENT_DOC_HEADER_FOOTER_PANEL")) this.disposeWithMe(this._componentManager.register(COMPONENT_DOC_HEADER_FOOTER_PANEL, DocHeaderFooterPanel));
30100
+ this.disposeWithMe(this._componentManager.register(DOC_HEADER_FOOTER_RIBBON_CONTROL, DocHeaderFooterRibbonControl));
30101
+ if (!this._componentManager.hasDefault("COMPONENT_DOC_HEADER_FOOTER_PANEL")) this.disposeWithMe(this._componentManager.register(COMPONENT_DOC_HEADER_FOOTER_PANEL, DocHeaderFooterPanel));
29284
30102
  this.disposeWithMe(this._componentManager.register(paragraphSettingIndexKey, ParagraphSettingIndex));
29285
30103
  this.disposeWithMe(this._componentManager.register(DOC_SECTION_SETTING_COMPONENT, SectionSettingIndex));
29286
30104
  [
@@ -29298,6 +30116,43 @@ let ComponentsController = class ComponentsController extends Disposable {
29298
30116
  };
29299
30117
  ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
29300
30118
 
30119
+ //#endregion
30120
+ //#region src/controllers/doc-header-footer-ribbon.controller.ts
30121
+ let DocHeaderFooterRibbonController = class DocHeaderFooterRibbonController extends Disposable {
30122
+ constructor(_context, skeletonManager, _instanceService, _ribbonService, _renderManager) {
30123
+ super();
30124
+ this._context = _context;
30125
+ this._instanceService = _instanceService;
30126
+ this._ribbonService = _ribbonService;
30127
+ this._renderManager = _renderManager;
30128
+ _defineProperty(this, "_visible", false);
30129
+ this.disposeWithMe(combineLatest([skeletonManager.getViewModel().editAreaChange$, this._instanceService.focused$]).pipe(map(([area, focused]) => focused === this._context.unitId && this._context.unit.getDocumentStyle().documentFlavor === DocumentFlavor.TRADITIONAL && (area === DocumentEditArea.HEADER || area === DocumentEditArea.FOOTER)), distinctUntilChanged()).subscribe((visible) => {
30130
+ if (visible === this._visible) return;
30131
+ this._visible = visible;
30132
+ if (visible) this._ribbonService.showContextualTab(DOC_HEADER_FOOTER_RIBBON_TAB, { activate: true });
30133
+ else if (!this._focusedDocumentEditsHeaderFooter()) this._ribbonService.hideContextualTab(DOC_HEADER_FOOTER_RIBBON_TAB);
30134
+ }));
30135
+ }
30136
+ _focusedDocumentEditsHeaderFooter() {
30137
+ var _this$_renderManager$;
30138
+ const focused = this._instanceService.getFocusedUnit();
30139
+ if (!focused || focused.type !== UniverInstanceType.UNIVER_DOC || focused.getUnitId() === this._context.unitId) return false;
30140
+ const manager = (_this$_renderManager$ = this._renderManager.getRenderUnitById(focused.getUnitId())) === null || _this$_renderManager$ === void 0 ? void 0 : _this$_renderManager$.with(DocSkeletonManagerService);
30141
+ const area = manager === null || manager === void 0 ? void 0 : manager.getViewModel().getEditArea();
30142
+ return (area === DocumentEditArea.HEADER || area === DocumentEditArea.FOOTER) && (manager === null || manager === void 0 ? void 0 : manager.getViewModel().getDataModel().getDocumentStyle().documentFlavor) === DocumentFlavor.TRADITIONAL;
30143
+ }
30144
+ dispose() {
30145
+ if (this._visible && !this._focusedDocumentEditsHeaderFooter()) this._ribbonService.hideContextualTab(DOC_HEADER_FOOTER_RIBBON_TAB);
30146
+ super.dispose();
30147
+ }
30148
+ };
30149
+ DocHeaderFooterRibbonController = __decorate([
30150
+ __decorateParam(1, Inject(DocSkeletonManagerService)),
30151
+ __decorateParam(2, IUniverInstanceService),
30152
+ __decorateParam(3, IRibbonService),
30153
+ __decorateParam(4, IRenderManagerService)
30154
+ ], DocHeaderFooterRibbonController);
30155
+
29301
30156
  //#endregion
29302
30157
  //#region src/controllers/format-painter.controller.ts
29303
30158
  let DocFormatPainterController = class DocFormatPainterController extends Disposable {
@@ -29365,6 +30220,83 @@ DocFormatPainterController = __decorate([
29365
30220
  __decorateParam(7, ICommandService)
29366
30221
  ], DocFormatPainterController);
29367
30222
 
30223
+ //#endregion
30224
+ //#region src/controllers/render-controllers/doc-field.render-controller.ts
30225
+ let DocFieldRenderController = class DocFieldRenderController extends Disposable {
30226
+ constructor(_context, _events, _selections, theme, _instances) {
30227
+ super();
30228
+ this._context = _context;
30229
+ this._events = _events;
30230
+ this._selections = _selections;
30231
+ this._instances = _instances;
30232
+ _defineProperty(this, "_hovered", /* @__PURE__ */ new Set());
30233
+ _defineProperty(this, "_shade", "");
30234
+ const documents = this._context.mainComponent;
30235
+ this.disposeWithMe(theme.currentTheme$.subscribe(() => {
30236
+ this._shade = theme.getColorFromTheme("gray.200");
30237
+ documents.makeDirty(true);
30238
+ }));
30239
+ this.disposeWithMe(this._events.hoverCustomRanges$.subscribe((ranges) => {
30240
+ this._hovered = new Set(ranges.filter(({ range }) => range.rangeType === CustomRangeType.FIELD).map(({ range, segmentId, segmentPageIndex }) => `${segmentId ?? ""}:${segmentPageIndex}:${range.rangeId}`));
30241
+ documents.makeDirty(true);
30242
+ }));
30243
+ this.disposeWithMe(this._selections.textSelection$.subscribe(({ unitId }) => {
30244
+ if (unitId === this._context.unitId) documents.makeDirty(true);
30245
+ }));
30246
+ this.disposeWithMe(this._instances.focused$.subscribe(() => documents.makeDirty(true)));
30247
+ this.disposeWithMe(documents.getSkeleton().getViewModel().editAreaChange$.subscribe(() => documents.makeDirty(true)));
30248
+ this.disposeWithMe(documents.pageRender$.subscribe((config) => this._drawFields(config)));
30249
+ }
30250
+ _drawFields({ page, pageLeft, pageTop, ctx }) {
30251
+ var _this$_instances$getF;
30252
+ if (((_this$_instances$getF = this._instances.getFocusedUnit()) === null || _this$_instances$getF === void 0 ? void 0 : _this$_instances$getF.getUnitId()) !== this._context.unitId) return;
30253
+ const active = this._getActiveFields();
30254
+ if (!active.size) return;
30255
+ const documents = this._context.mainComponent;
30256
+ const skeleton = documents.getSkeleton();
30257
+ const pageIndex = skeleton.getSkeletonData().pages.indexOf(page);
30258
+ const { docsLeft, docsTop } = documents.getOffsetConfig();
30259
+ const area = skeleton.getViewModel().getEditArea();
30260
+ const snapshot = this._context.unit.getSnapshot();
30261
+ const activeSegments = area === DocumentEditArea.HEADER ? snapshot.headers : snapshot.footers;
30262
+ ctx.save();
30263
+ ctx.beginPath();
30264
+ ctx.rect(pageLeft, pageTop, page.pageWidth, page.pageHeight);
30265
+ ctx.clip();
30266
+ ctx.fillStyle = this._shade;
30267
+ ctx.globalAlpha *= .45;
30268
+ for (const { customRange: field, segmentId, segmentPageIndex, rects } of this._events.getCustomRangeBounds()) {
30269
+ if (field.rangeType !== CustomRangeType.FIELD) continue;
30270
+ if (segmentId) {
30271
+ if (area === DocumentEditArea.BODY || segmentPageIndex !== pageIndex || !(activeSegments === null || activeSegments === void 0 ? void 0 : activeSegments[segmentId])) continue;
30272
+ } else if (area !== DocumentEditArea.BODY) continue;
30273
+ if (!active.has(`${segmentId ?? ""}:${segmentPageIndex}:${field.rangeId}`)) continue;
30274
+ for (const rect of rects) ctx.fillRect(rect.left - docsLeft, rect.top - docsTop, rect.right - rect.left, rect.bottom - rect.top);
30275
+ }
30276
+ ctx.restore();
30277
+ }
30278
+ _getActiveFields() {
30279
+ const active = new Set(this._hovered);
30280
+ const selections = this._selections.getTextRanges({
30281
+ unitId: this._context.unitId,
30282
+ subUnitId: this._context.unitId
30283
+ }) ?? [];
30284
+ for (const selection of selections) {
30285
+ var _this$_context$unit$g;
30286
+ const segmentId = selection.segmentId ?? "";
30287
+ const fields = ((_this$_context$unit$g = this._context.unit.getSelfOrHeaderFooterModel(segmentId)) === null || _this$_context$unit$g === void 0 || (_this$_context$unit$g = _this$_context$unit$g.getBody()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.customRanges) ?? [];
30288
+ for (const field of fields) if (field.rangeType === CustomRangeType.FIELD && selection.startOffset <= field.endIndex && selection.endOffset > field.startIndex) active.add(`${segmentId}:${segmentId ? selection.segmentPage : -1}:${field.rangeId}`);
30289
+ }
30290
+ return active;
30291
+ }
30292
+ };
30293
+ DocFieldRenderController = __decorate([
30294
+ __decorateParam(1, Inject(DocEventManagerService)),
30295
+ __decorateParam(2, Inject(DocSelectionManagerService)),
30296
+ __decorateParam(3, Inject(ThemeService)),
30297
+ __decorateParam(4, IUniverInstanceService)
30298
+ ], DocFieldRenderController);
30299
+
29368
30300
  //#endregion
29369
30301
  //#region src/controllers/render-controllers/doc-selection-render.controller.ts
29370
30302
  let DocSelectionRenderController = class DocSelectionRenderController extends Disposable {
@@ -29689,6 +30621,32 @@ const CloseHeaderFooterShortcut = {
29689
30621
  preconditions: whenDocAndEditorFocused,
29690
30622
  binding: KeyCode.ESC
29691
30623
  };
30624
+ const DeleteWordLeftShortcut = {
30625
+ id: DeleteLeftCommand.id,
30626
+ preconditions: whenTextEditorFocused,
30627
+ binding: KeyCode.BACKSPACE | MetaKeys.CTRL_COMMAND,
30628
+ mac: KeyCode.BACKSPACE | MetaKeys.ALT,
30629
+ staticParameters: { granularity: "word" }
30630
+ };
30631
+ const DeleteWordRightShortcut = {
30632
+ id: DeleteRightCommand.id,
30633
+ preconditions: whenTextEditorFocused,
30634
+ mac: KeyCode.DELETE | MetaKeys.ALT,
30635
+ staticParameters: { granularity: "word" }
30636
+ };
30637
+ const DeleteLineStartShortcut = {
30638
+ id: DeleteLeftCommand.id,
30639
+ preconditions: whenTextEditorFocused,
30640
+ mac: KeyCode.BACKSPACE | MetaKeys.CTRL_COMMAND,
30641
+ staticParameters: { granularity: "line" }
30642
+ };
30643
+ const DeleteLineEndShortcut = {
30644
+ id: DeleteRightCommand.id,
30645
+ preconditions: whenTextEditorFocused,
30646
+ binding: KeyCode.DELETE | MetaKeys.CTRL_COMMAND,
30647
+ mac: KeyCode.DELETE | MetaKeys.MAC_CTRL,
30648
+ staticParameters: { granularity: "line" }
30649
+ };
29692
30650
 
29693
30651
  //#endregion
29694
30652
  //#region src/shortcuts/cursor.shortcut.ts
@@ -29699,7 +30657,7 @@ function moveCursorShortcut(direction, granularity, binding, mac = binding, win
29699
30657
  mac,
29700
30658
  win,
29701
30659
  linux,
29702
- preconditions: whenDocAndEditorFocused,
30660
+ preconditions: whenTextEditorFocused,
29703
30661
  staticParameters: {
29704
30662
  direction,
29705
30663
  granularity
@@ -29713,7 +30671,7 @@ function moveSelectionShortcut(direction, granularity, binding, mac = binding, w
29713
30671
  mac,
29714
30672
  win,
29715
30673
  linux,
29716
- preconditions: whenDocAndEditorFocused,
30674
+ preconditions: whenTextEditorFocused,
29717
30675
  staticParameters: {
29718
30676
  direction,
29719
30677
  granularity
@@ -29976,6 +30934,10 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends Plugin {
29976
30934
  MoveSelectionWordRightShortcut,
29977
30935
  SelectAllShortcut,
29978
30936
  DeleteLeftShortcut,
30937
+ DeleteWordLeftShortcut,
30938
+ DeleteWordRightShortcut,
30939
+ DeleteLineStartShortcut,
30940
+ DeleteLineEndShortcut,
29979
30941
  DeleteRightShortcut,
29980
30942
  CloseHeaderFooterShortcut,
29981
30943
  BreakLineShortcut,
@@ -30052,10 +31014,12 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends Plugin {
30052
31014
  _initRenderModules() {
30053
31015
  [
30054
31016
  [DocEventManagerService],
31017
+ [DocFieldRenderController],
30055
31018
  [DocFloatMenuService],
30056
31019
  [DocPasteOptionsRenderController],
30057
31020
  [DocParagraphMenuService],
30058
31021
  [DocHeaderFooterController],
31022
+ [DocHeaderFooterRibbonController],
30059
31023
  [DocResizeRenderController],
30060
31024
  [DocParagraphPlaceholderRenderController],
30061
31025
  [DocContextMenuRenderController],
@@ -31160,4 +32124,4 @@ function MobileRichTextEditor(props) {
31160
32124
  }
31161
32125
 
31162
32126
  //#endregion
31163
- export { AfterSpaceCommand, AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignMenuItemFactory, AlignOperationCommand, AlignRightCommand, BackgroundColorSelectorMenuItemFactory, BoldMenuItemFactory, BreakLineCommand, BulletListCommand, BulletListTypePicker, 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, DocContextualRibbonService, DocCopyCommand, DocCreateTableOperation, DocCutCommand, DocEventManagerService, DocFloatMenuService, DocHtmlExportService, DocIMEInputManagerService, DocLayoutInteractionService, DocMobileElementMenuService, 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, MOBILE_DOC_ELEMENT_MENU, MergeTwoParagraphCommand, MobileDocElementMenu, MobileRichTextEditor, MobileRichTextToolbar, MoveCursorOperation, MoveDocBlockCommand, MoveSelectionOperation, NORMAL_TEXT_SELECTION_PLUGIN_NAME, NodePositionConvertToCursor, NodePositionConvertToRectRange, OrderListCommand, OrderListTypePicker, ParagraphMenuInsertBelowSubmenuItemFactory, LarkPastePlugin as PastePluginLark, UniverPastePlugin as PastePluginUniver, WordPastePlugin as PastePluginWord, QuickListCommand, RectRange, ReplaceSelectionCommand, ReplaceSnapshotCommand, ReplaceTextRunsCommand, ResetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextColorCommand, RichTextEditor, SetDocInputStyleCommand, 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, UniverDocsMobileUIPlugin, UniverDocsUIPlugin, VIEWPORT_KEY, addCustomDecorationBySelectionFactory, addCustomDecorationFactory, buildMoveDocBlockActions, calcDocFitToWidthScale, calcDocRangePositions, captureTextFormat, collectDocsTableLikeEmbedChildUnitIds, convertBodyToHtml, convertClipboardHtmlToDocumentData, convertClipboardRtfToPlainText, convertPositionsToRectRanges, createDefaultDocsTableLikeCustomBlockBleedViewport, createDocsCustomBlockSizeRefreshScheduler, createEditorUndoRedoKeyboardConfig, deleteCustomDecorationFactory, disableMenuWhenHeaderFooterEditing, disableMenuWithoutDocumentUnitPermission, drawDocCustomRangeChrome, executeEditorUndoRedoCommand, findDocRangeNodePositions, 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, removeClipboardHtmlImages, resolveDocCustomRangeChromeTheme, resolveDocFitBaseWidth, resolveDocViewScale, resolveDocsCustomBlockRenderViewport, resolveDocsTableLikeCustomBlockBleedViewport, resolveDocsTableLikeCustomBlockContentHeight, resolveDocsTableLikeCustomBlockContentWidth, scrollDocsTableLikeCustomBlockLive, shouldRefreshDocsCustomBlockSizeForCommand, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, whenDocAndEditorFocused };
32127
+ export { AfterSpaceCommand, AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignMenuItemFactory, AlignOperationCommand, AlignRightCommand, BackgroundColorSelectorMenuItemFactory, BoldMenuItemFactory, BreakLineCommand, BulletListCommand, BulletListTypePicker, 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, DocContextualRibbonService, DocCopyCommand, DocCreateTableOperation, DocCutCommand, DocEventManagerService, DocFloatMenuService, DocHtmlExportService, DocIMEInputManagerService, DocLayoutInteractionService, DocMobileElementMenuService, 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, MOBILE_DOC_ELEMENT_MENU, MergeTwoParagraphCommand, MobileDocElementMenu, MobileRichTextEditor, MobileRichTextToolbar, MoveCursorOperation, MoveDocBlockCommand, MoveSelectionOperation, NORMAL_TEXT_SELECTION_PLUGIN_NAME, NodePositionConvertToCursor, NodePositionConvertToRectRange, OrderListCommand, OrderListTypePicker, ParagraphMenuInsertBelowSubmenuItemFactory, LarkPastePlugin as PastePluginLark, UniverPastePlugin as PastePluginUniver, WordPastePlugin as PastePluginWord, QuickListCommand, RectRange, ReplaceSelectionCommand, ReplaceSnapshotCommand, ReplaceTextRunsCommand, ResetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextColorCommand, RichTextEditor, SetDocInputStyleCommand, 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, UniverDocsMobileUIPlugin, UniverDocsUIPlugin, VIEWPORT_KEY, addCustomDecorationBySelectionFactory, addCustomDecorationFactory, buildMoveDocBlockActions, calcDocFitToWidthScale, calcDocRangePositions, captureTextFormat, collectDocsTableLikeEmbedChildUnitIds, convertBodyToHtml, convertClipboardHtmlToDocumentData, convertClipboardRtfToPlainText, convertPositionsToRectRanges, createDefaultDocsTableLikeCustomBlockBleedViewport, createDocsCustomBlockSizeRefreshScheduler, createEditorUndoRedoKeyboardConfig, deleteCustomDecorationFactory, disableMenuWhenHeaderFooterEditing, disableMenuWithoutDocumentUnitPermission, drawDocCustomRangeChrome, executeEditorUndoRedoCommand, findDocRangeNodePositions, genTableSource, generateParagraphs, getAnchorBounding, getCanvasOffsetByEngine, getCommandSkeleton, getCursorWhenDelete, getCutActionsFromDocRanges, getDocBlockRangeMenuId, getDocObjectById, getEditorRuntimeConfig, getEmptyTableCell, getEmptyTableRow, getLineBounding, getListMarkerFallbackBound, getListParagraphContextMenuHit, getOneTextSelectionRange, getStyleInTextRange, getTableColumn, getTextRangeFromCharIndex, hasParagraphInTable, hideMenuWhenSelectionInBlockRange, isInSameTableCell, isTextRangeInAnyBlockRange, isValidRectRange, neoGetDocObject, normalizeDocFitToWidthOptions, registerEditorRuntimeConfig, removeClipboardHtmlImages, resolveDocCustomRangeChromeTheme, resolveDocFitBaseWidth, resolveDocViewScale, resolveDocsCustomBlockRenderViewport, resolveDocsTableLikeCustomBlockBleedViewport, resolveDocsTableLikeCustomBlockContentHeight, resolveDocsTableLikeCustomBlockContentWidth, scrollDocsTableLikeCustomBlockLive, shouldRefreshDocsCustomBlockSizeForCommand, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, whenDocAndEditorFocused };