@univerjs/docs-ui 1.0.4 → 1.2.0
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.
- package/README.md +45 -0
- package/lib/cjs/index.js +937 -296
- package/lib/cjs/locale/ar-SA.js +6 -0
- package/lib/cjs/locale/ca-ES.js +6 -0
- package/lib/cjs/locale/de-DE.js +6 -0
- package/lib/cjs/locale/en-US.js +6 -0
- package/lib/cjs/locale/es-ES.js +6 -0
- package/lib/cjs/locale/fa-IR.js +6 -0
- package/lib/cjs/locale/fr-FR.js +6 -0
- package/lib/cjs/locale/id-ID.js +6 -0
- package/lib/cjs/locale/it-IT.js +6 -0
- package/lib/cjs/locale/ja-JP.js +6 -0
- package/lib/cjs/locale/ko-KR.js +6 -0
- package/lib/cjs/locale/pl-PL.js +6 -0
- package/lib/cjs/locale/pt-BR.js +6 -0
- package/lib/cjs/locale/ru-RU.js +6 -0
- package/lib/cjs/locale/sk-SK.js +6 -0
- package/lib/cjs/locale/vi-VN.js +6 -0
- package/lib/cjs/locale/zh-CN.js +6 -0
- package/lib/cjs/locale/zh-HK.js +6 -0
- package/lib/cjs/locale/zh-TW.js +6 -0
- package/lib/es/index.js +918 -283
- package/lib/es/locale/ar-SA.js +6 -0
- package/lib/es/locale/ca-ES.js +6 -0
- package/lib/es/locale/de-DE.js +6 -0
- package/lib/es/locale/en-US.js +6 -0
- package/lib/es/locale/es-ES.js +6 -0
- package/lib/es/locale/fa-IR.js +6 -0
- package/lib/es/locale/fr-FR.js +6 -0
- package/lib/es/locale/id-ID.js +6 -0
- package/lib/es/locale/it-IT.js +6 -0
- package/lib/es/locale/ja-JP.js +6 -0
- package/lib/es/locale/ko-KR.js +6 -0
- package/lib/es/locale/pl-PL.js +6 -0
- package/lib/es/locale/pt-BR.js +6 -0
- package/lib/es/locale/ru-RU.js +6 -0
- package/lib/es/locale/sk-SK.js +6 -0
- package/lib/es/locale/vi-VN.js +6 -0
- package/lib/es/locale/zh-CN.js +6 -0
- package/lib/es/locale/zh-HK.js +6 -0
- package/lib/es/locale/zh-TW.js +6 -0
- package/lib/index.css +41 -82
- package/lib/index.js +918 -283
- package/lib/locale/ar-SA.js +6 -0
- package/lib/locale/ca-ES.js +6 -0
- package/lib/locale/de-DE.js +6 -0
- package/lib/locale/en-US.js +6 -0
- package/lib/locale/es-ES.js +6 -0
- package/lib/locale/fa-IR.js +6 -0
- package/lib/locale/fr-FR.js +6 -0
- package/lib/locale/id-ID.js +6 -0
- package/lib/locale/it-IT.js +6 -0
- package/lib/locale/ja-JP.js +6 -0
- package/lib/locale/ko-KR.js +6 -0
- package/lib/locale/pl-PL.js +6 -0
- package/lib/locale/pt-BR.js +6 -0
- package/lib/locale/ru-RU.js +6 -0
- package/lib/locale/sk-SK.js +6 -0
- package/lib/locale/vi-VN.js +6 -0
- package/lib/locale/zh-CN.js +6 -0
- package/lib/locale/zh-HK.js +6 -0
- package/lib/locale/zh-TW.js +6 -0
- package/lib/types/config/config.d.ts +5 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/en-US.d.ts +6 -0
- package/lib/types/menu/display.menu.d.ts +21 -0
- package/lib/types/plugin.d.ts +1 -1
- package/lib/types/services/clipboard/clipboard.service.d.ts +1 -1
- package/lib/types/services/doc-heading-collapse.service.d.ts +38 -0
- package/lib/types/services/doc-paragraph-menu.service.d.ts +12 -3
- package/lib/types/services/doc-popup-manager.service.d.ts +4 -1
- package/lib/types/services/doc-zoom.d.ts +4 -1
- package/lib/types/views/ParagraphMenu.d.ts +2 -2
- package/lib/types/views/doc-side-menu-layout.d.ts +17 -0
- package/lib/types/views/heading-collapse-shape.d.ts +38 -0
- package/lib/types/views/paragraph-setting/hook/utils.d.ts +2 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +16 -16
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -15
package/lib/es/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
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";
|
|
2
|
+
import { CreateHeaderFooterCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocHistoryAction, DocInterceptorService, DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutSessionStatus, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentPermissionCommand, SetHeadingCollapsedCommand, 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
|
-
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, Dialog, Dropdown, DropdownMenu, InputNumber, MessageType, MobileSelect, Popup, Select, Separator, Tooltip, borderClassName, clsx, resetButtonClassName, scrollbarClassName, selectClassName, useMobileKeyboardViewportLayout } from "@univerjs/design";
|
|
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";
|
|
4
|
+
import { BaseObject, CURSOR_TYPE, DRAWING_OBJECT_UPPER_LAYER_INDEX, DeviceInputEventType, DocBackground, DocumentEditArea, DocumentSkeletonPageType, DocumentViewModel, 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, Dialog, Dropdown, DropdownMenu, InputNumber, MessageType, MobileColorPicker, MobileDropdown, MobileSelect, Popup, Select, Separator, Tooltip, borderClassName, clsx, resetButtonClassName, scrollbarClassName, selectClassName, useMobileKeyboardViewportLayout } from "@univerjs/design";
|
|
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, RibbonViewGroup, SYMBOL_PICKER_COMPONENT, Slider, ToggleFullscreenOperation, 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
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, 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";
|
|
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, InsertBelowDoubleIcon, 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, ZoomInIcon } from "@univerjs/icons";
|
|
13
13
|
import { getDrawingShapeKeyByDrawingSearch } from "@univerjs/drawing";
|
|
14
14
|
|
|
15
15
|
//#region src/basics/docs-view-key.ts
|
|
@@ -242,7 +242,7 @@ function getCustomDecorationAtPosition(customDecorations, position) {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
//#endregion
|
|
245
|
-
//#region \0@oxc-project+runtime@0.
|
|
245
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
246
246
|
function _typeof(o) {
|
|
247
247
|
"@babel/helpers - typeof";
|
|
248
248
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -253,7 +253,7 @@ function _typeof(o) {
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
//#endregion
|
|
256
|
-
//#region \0@oxc-project+runtime@0.
|
|
256
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
257
257
|
function toPrimitive(t, r) {
|
|
258
258
|
if ("object" != _typeof(t) || !t) return t;
|
|
259
259
|
var e = t[Symbol.toPrimitive];
|
|
@@ -266,14 +266,14 @@ function toPrimitive(t, r) {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
//#endregion
|
|
269
|
-
//#region \0@oxc-project+runtime@0.
|
|
269
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
270
270
|
function toPropertyKey(t) {
|
|
271
271
|
var i = toPrimitive(t, "string");
|
|
272
272
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
//#endregion
|
|
276
|
-
//#region \0@oxc-project+runtime@0.
|
|
276
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
277
277
|
function _defineProperty(e, r, t) {
|
|
278
278
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
279
279
|
value: t,
|
|
@@ -284,7 +284,7 @@ function _defineProperty(e, r, t) {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
//#endregion
|
|
287
|
-
//#region \0@oxc-project+runtime@0.
|
|
287
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
288
288
|
function __decorateParam(paramIndex, decorator) {
|
|
289
289
|
return function(target, key) {
|
|
290
290
|
decorator(target, key, paramIndex);
|
|
@@ -292,7 +292,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
//#endregion
|
|
295
|
-
//#region \0@oxc-project+runtime@0.
|
|
295
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
296
296
|
function __decorate(decorators, target, key, desc) {
|
|
297
297
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
298
298
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -408,8 +408,8 @@ let DocMenuStyleService = class DocMenuStyleService extends Disposable {
|
|
|
408
408
|
}));
|
|
409
409
|
}
|
|
410
410
|
_listenDocRangeChange() {
|
|
411
|
-
this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(() => {
|
|
412
|
-
this._clearStyleCache();
|
|
411
|
+
this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe(({ options }) => {
|
|
412
|
+
if (!(options === null || options === void 0 ? void 0 : options.preserveInputStyle)) this._clearStyleCache();
|
|
413
413
|
}));
|
|
414
414
|
}
|
|
415
415
|
getStyleCache() {
|
|
@@ -493,15 +493,34 @@ const BreakLineCommand = {
|
|
|
493
493
|
const { horizontalLine, insertionMode = "split-paragraph" } = params ?? {};
|
|
494
494
|
const { segmentId } = activeTextRange;
|
|
495
495
|
const docDataModel = (params === null || params === void 0 ? void 0 : params.unitId) ? univerInstanceService.getUnit(params.unitId, UniverInstanceType.UNIVER_DOC) : univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
496
|
-
|
|
496
|
+
let originBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId ?? "")) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getBody();
|
|
497
497
|
if (docDataModel == null || originBody == null) return false;
|
|
498
498
|
const unitId = docDataModel.getUnitId();
|
|
499
499
|
const { startOffset, endOffset } = activeTextRange;
|
|
500
500
|
const paragraphs = originBody.paragraphs ?? [];
|
|
501
501
|
const isBareStructuralGap = isTopLevelStructuralGap(originBody.dataStream, startOffset) && originBody.dataStream[startOffset] !== DataStreamTreeTokenType.PARAGRAPH;
|
|
502
502
|
const insertsAtStructuralGap = insertionMode === "insert-gap" || isBareStructuralGap;
|
|
503
|
-
|
|
503
|
+
let prevParagraph = insertsAtStructuralGap ? void 0 : paragraphs.find((p) => p.startIndex >= startOffset);
|
|
504
504
|
if (!prevParagraph && !insertsAtStructuralGap) return false;
|
|
505
|
+
if (!segmentId && (prevParagraph === null || prevParagraph === void 0 ? void 0 : prevParagraph.headingCollapsed) && docDataModel.getSnapshot().documentStyle.documentFlavor === DocumentFlavor.MODERN) {
|
|
506
|
+
const paragraphId = prevParagraph.paragraphId;
|
|
507
|
+
const viewModel = new DocumentViewModel(docDataModel);
|
|
508
|
+
try {
|
|
509
|
+
if (viewModel.getHeadingSections().some((section) => section.paragraphId === paragraphId)) {
|
|
510
|
+
var _originBody$paragraph;
|
|
511
|
+
if (!commandService.syncExecuteCommand(SetHeadingCollapsedCommand.id, {
|
|
512
|
+
unitId,
|
|
513
|
+
paragraphId,
|
|
514
|
+
collapsed: false
|
|
515
|
+
})) return false;
|
|
516
|
+
originBody = docDataModel.getBody();
|
|
517
|
+
prevParagraph = originBody === null || originBody === void 0 || (_originBody$paragraph = originBody.paragraphs) === null || _originBody$paragraph === void 0 ? void 0 : _originBody$paragraph.find((paragraph) => paragraph.startIndex >= startOffset);
|
|
518
|
+
if (!originBody || !prevParagraph) return false;
|
|
519
|
+
}
|
|
520
|
+
} finally {
|
|
521
|
+
viewModel.dispose();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
505
524
|
const isAtParagraphEnd = startOffset === (prevParagraph === null || prevParagraph === void 0 ? void 0 : prevParagraph.startIndex);
|
|
506
525
|
const prevParagraphIndex = prevParagraph === null || prevParagraph === void 0 ? void 0 : prevParagraph.startIndex;
|
|
507
526
|
const defaultTextStyle = docMenuStyleService.getDefaultStyle();
|
|
@@ -2839,7 +2858,7 @@ function getTextRangeFromCharIndex(startOffset, endOffset, scene, document, skel
|
|
|
2839
2858
|
function getRectRangeFromCharIndex(startOffset, endOffset, scene, document, skeleton, style, segmentId, segmentPage) {
|
|
2840
2859
|
const startNodePosition = skeleton.findNodePositionByCharIndex(startOffset, true, segmentId, segmentPage);
|
|
2841
2860
|
const endNodePosition = skeleton.findNodePositionByCharIndex(endOffset, true, segmentId, segmentPage);
|
|
2842
|
-
if (startNodePosition == null || endNodePosition == null) return;
|
|
2861
|
+
if (startNodePosition == null || endNodePosition == null || startNodePosition.path.indexOf("cells") === -1 || endNodePosition.path.indexOf("cells") === -1) return;
|
|
2843
2862
|
return new RectRange(scene, document, skeleton, startNodePosition, endNodePosition, style, segmentId, segmentPage);
|
|
2844
2863
|
}
|
|
2845
2864
|
function getRangeListFromCharIndex(startOffset, endOffset, scene, document, skeleton, style, segmentId, segmentPage) {
|
|
@@ -3430,7 +3449,12 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
|
|
|
3430
3449
|
this._addRectRanges(rectRanges);
|
|
3431
3450
|
};
|
|
3432
3451
|
for (const range of ranges) {
|
|
3433
|
-
const {
|
|
3452
|
+
const { rangeType } = range;
|
|
3453
|
+
let { startOffset, endOffset, startNodePosition, endNodePosition } = range;
|
|
3454
|
+
if (rangeType !== DOC_RANGE_TYPE.RECT && range.direction === RANGE_DIRECTION.BACKWARD && startOffset < endOffset) {
|
|
3455
|
+
[startOffset, endOffset] = [endOffset, startOffset];
|
|
3456
|
+
[startNodePosition, endNodePosition] = [endNodePosition, startNodePosition];
|
|
3457
|
+
}
|
|
3434
3458
|
const rangeStyle = range.style ?? style;
|
|
3435
3459
|
if (rangeType !== DOC_RANGE_TYPE.RECT && startOffset === endOffset) {
|
|
3436
3460
|
const textRange = cursorConvertToTextRange(scene, {
|
|
@@ -6228,6 +6252,14 @@ const DeleteLeftCommand = {
|
|
|
6228
6252
|
const { segmentId, style, segmentPage } = activeRange;
|
|
6229
6253
|
const body = (_docDataModel$getSelf3 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf3 === void 0 ? void 0 : _docDataModel$getSelf3.getBody();
|
|
6230
6254
|
if (body == null) return false;
|
|
6255
|
+
if (activeRange.collapsed && !segmentId) {
|
|
6256
|
+
const hidden = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel().getCollapsedHeadingAtOffset(activeRange.startOffset - 1);
|
|
6257
|
+
if (hidden) return commandService.executeCommand(SetHeadingCollapsedCommand.id, {
|
|
6258
|
+
unitId,
|
|
6259
|
+
paragraphId: hidden.paragraphId,
|
|
6260
|
+
collapsed: false
|
|
6261
|
+
});
|
|
6262
|
+
}
|
|
6231
6263
|
const originalLength = body.dataStream.length;
|
|
6232
6264
|
const typingStyle = captureDeletedTypingStyle(accessor, docDataModel, body, activeRange);
|
|
6233
6265
|
const actualRange = activeRange;
|
|
@@ -6386,6 +6418,14 @@ const DeleteRightCommand = {
|
|
|
6386
6418
|
const { segmentId, style, segmentPage } = activeRange;
|
|
6387
6419
|
const body = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf5 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf5 === void 0 ? void 0 : _docDataModel$getSelf5.getBody();
|
|
6388
6420
|
if (!docDataModel || !body) return false;
|
|
6421
|
+
if (activeRange.collapsed && !segmentId) {
|
|
6422
|
+
const hidden = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel().getCollapsedHeadingAtOffset(activeRange.startOffset + 1);
|
|
6423
|
+
if (hidden) return commandService.executeCommand(SetHeadingCollapsedCommand.id, {
|
|
6424
|
+
unitId: docDataModel.getUnitId(),
|
|
6425
|
+
paragraphId: hidden.paragraphId,
|
|
6426
|
+
collapsed: false
|
|
6427
|
+
});
|
|
6428
|
+
}
|
|
6389
6429
|
const actualRange = activeRange;
|
|
6390
6430
|
const { startOffset, endOffset, collapsed } = actualRange;
|
|
6391
6431
|
if (collapsed && shouldResetEmptyCenteredParagraphAlignment(accessor, docDataModel)) {
|
|
@@ -8533,23 +8573,39 @@ function getTableClipboardBodySlice(body, range) {
|
|
|
8533
8573
|
return getTableCellContentClipboardBodySlice(body, startOffset, endOffset);
|
|
8534
8574
|
}
|
|
8535
8575
|
function getTableCellContentClipboardBodySlice(body, start, end) {
|
|
8536
|
-
var _bodySlice$textRuns, _bodySlice$
|
|
8576
|
+
var _bodySlice$textRuns, _bodySlice$docxExport;
|
|
8537
8577
|
const bodySlice = getBodySlice(body, start, end + 2);
|
|
8538
|
-
|
|
8578
|
+
const prefix = DataStreamTreeTokenType.TABLE_START + DataStreamTreeTokenType.TABLE_ROW_START + DataStreamTreeTokenType.TABLE_CELL_START;
|
|
8579
|
+
bodySlice.dataStream = prefix + bodySlice.dataStream + DataStreamTreeTokenType.TABLE_CELL_END + DataStreamTreeTokenType.TABLE_ROW_END + DataStreamTreeTokenType.TABLE_END;
|
|
8580
|
+
const offset = prefix.length;
|
|
8539
8581
|
(_bodySlice$textRuns = bodySlice.textRuns) === null || _bodySlice$textRuns === void 0 || _bodySlice$textRuns.forEach((textRun) => {
|
|
8540
|
-
|
|
8541
|
-
textRun.
|
|
8542
|
-
textRun.ed = ed + 3;
|
|
8582
|
+
textRun.st += offset;
|
|
8583
|
+
textRun.ed += offset;
|
|
8543
8584
|
});
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8585
|
+
[
|
|
8586
|
+
bodySlice.paragraphs,
|
|
8587
|
+
bodySlice.sectionBreaks,
|
|
8588
|
+
bodySlice.customBlocks,
|
|
8589
|
+
bodySlice.docxRawCustomBlocks,
|
|
8590
|
+
bodySlice.docxRawBlocks
|
|
8591
|
+
].forEach((items) => items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
8592
|
+
item.startIndex += offset;
|
|
8593
|
+
}));
|
|
8594
|
+
[
|
|
8595
|
+
bodySlice.tables,
|
|
8596
|
+
bodySlice.columnGroups,
|
|
8597
|
+
bodySlice.blockRanges,
|
|
8598
|
+
bodySlice.customRanges,
|
|
8599
|
+
bodySlice.customDecorations
|
|
8600
|
+
].forEach((ranges) => ranges === null || ranges === void 0 ? void 0 : ranges.forEach((range) => {
|
|
8601
|
+
range.startIndex += offset;
|
|
8602
|
+
range.endIndex += offset;
|
|
8603
|
+
}));
|
|
8604
|
+
(_bodySlice$docxExport = bodySlice.docxExportExcludedRanges) === null || _bodySlice$docxExport === void 0 || _bodySlice$docxExport.forEach((range) => {
|
|
8605
|
+
range.start += offset;
|
|
8606
|
+
range.end += offset;
|
|
8552
8607
|
});
|
|
8608
|
+
if (bodySlice.renderedPageBreaks) bodySlice.renderedPageBreaks = bodySlice.renderedPageBreaks.map((index) => index + offset);
|
|
8553
8609
|
return bodySlice;
|
|
8554
8610
|
}
|
|
8555
8611
|
const IDocClipboardService = createIdentifier("doc.clipboard-service");
|
|
@@ -8731,13 +8787,21 @@ let DocClipboardService = class DocClipboardService extends Disposable {
|
|
|
8731
8787
|
this.dismissPasteOptions();
|
|
8732
8788
|
const unitId = payload.unitId ?? this._getCurrentDocumentUnitId();
|
|
8733
8789
|
if (!unitId || !this._canEditTargets(unitId)) return false;
|
|
8734
|
-
|
|
8790
|
+
const isCommentEditor = isCommentEditorID(unitId);
|
|
8791
|
+
if (!cachedSource && !payload.html && !payload.text && !payload.internalJson && (isCommentEditor || !payload.files.length)) return false;
|
|
8735
8792
|
const generation = this._pasteGeneration;
|
|
8736
|
-
const mode = unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY ? "text" : payload.mode ?? "source";
|
|
8793
|
+
const mode = isCommentEditor || unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY ? "text" : payload.mode ?? "source";
|
|
8737
8794
|
const style = this._getPasteStyle(unitId);
|
|
8738
|
-
const source = await this._preparePaste(payload, mode, cachedSource);
|
|
8795
|
+
const source = await (isCommentEditor && payload.text !== void 0 ? { body: { dataStream: payload.text } } : this._preparePaste(payload, mode, cachedSource));
|
|
8739
8796
|
if (generation !== this._pasteGeneration || !this._canEditTargets(unitId)) return false;
|
|
8740
|
-
let doc
|
|
8797
|
+
let doc;
|
|
8798
|
+
if (isCommentEditor) {
|
|
8799
|
+
const text = payload.text ?? getClipboardPlainText(source);
|
|
8800
|
+
if (!text) return false;
|
|
8801
|
+
const body = BuildTextUtils.transform.fromPlainText(text);
|
|
8802
|
+
delete body.customRanges;
|
|
8803
|
+
doc = { body };
|
|
8804
|
+
} else doc = applyDocPasteMode(source, mode, style, payload.text);
|
|
8741
8805
|
if (unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
8742
8806
|
doc = {
|
|
8743
8807
|
...source,
|
|
@@ -11701,7 +11765,6 @@ const DEFAULT_DOC_FIT_TO_WIDTH_OPTIONS = {
|
|
|
11701
11765
|
align: "center"
|
|
11702
11766
|
};
|
|
11703
11767
|
const defaultPluginConfig = {
|
|
11704
|
-
toc: false,
|
|
11705
11768
|
footer: true,
|
|
11706
11769
|
wordCount: true,
|
|
11707
11770
|
placeholder: true,
|
|
@@ -12131,6 +12194,7 @@ function getLineFontFamily(line) {
|
|
|
12131
12194
|
function drawParagraphPlaceholders(ctx, placeholders, color = PLACEHOLDER_COLOR) {
|
|
12132
12195
|
ctx.save();
|
|
12133
12196
|
ctx.fillStyle = color;
|
|
12197
|
+
ctx.globalAlpha *= .5;
|
|
12134
12198
|
ctx.textBaseline = "alphabetic";
|
|
12135
12199
|
for (const placeholder of placeholders) {
|
|
12136
12200
|
const clipLeft = placeholder.clipLeft ?? placeholder.x;
|
|
@@ -12754,12 +12818,35 @@ var DocLayoutInteractionService = class extends Disposable {
|
|
|
12754
12818
|
//#region src/services/doc-zoom.ts
|
|
12755
12819
|
const DEFAULT_DOC_ZOOM_RATIO = 1;
|
|
12756
12820
|
const DEFAULT_MODERN_DOC_ZOOM_RATIO = 1;
|
|
12821
|
+
const DOC_ZOOM_SHORTCUTS = [
|
|
12822
|
+
50,
|
|
12823
|
+
80,
|
|
12824
|
+
100,
|
|
12825
|
+
130,
|
|
12826
|
+
150,
|
|
12827
|
+
170,
|
|
12828
|
+
200,
|
|
12829
|
+
400
|
|
12830
|
+
];
|
|
12757
12831
|
function getDocEffectiveZoomRatio(documentModel) {
|
|
12758
12832
|
var _documentModel$getSet, _documentModel$getSna;
|
|
12759
12833
|
const zoomRatio = (_documentModel$getSet = documentModel.getSettings()) === null || _documentModel$getSet === void 0 ? void 0 : _documentModel$getSet.zoomRatio;
|
|
12760
12834
|
if (zoomRatio != null) return zoomRatio;
|
|
12761
12835
|
return ((_documentModel$getSna = documentModel.getSnapshot().documentStyle) === null || _documentModel$getSna === void 0 ? void 0 : _documentModel$getSna.documentFlavor) === DocumentFlavor.MODERN ? 1 : DEFAULT_DOC_ZOOM_RATIO;
|
|
12762
12836
|
}
|
|
12837
|
+
function getDocZoomRatio$(commandService, instanceService) {
|
|
12838
|
+
return instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(switchMap((documentModel) => {
|
|
12839
|
+
if (!documentModel) return of(100);
|
|
12840
|
+
return new Observable((subscriber) => {
|
|
12841
|
+
const update = () => subscriber.next(Math.round(getDocEffectiveZoomRatio(documentModel) * 100));
|
|
12842
|
+
const disposable = commandService.onCommandExecuted((command) => {
|
|
12843
|
+
if (command.id === SetDocZoomRatioOperation.id && command.params.unitId === documentModel.getUnitId()) update();
|
|
12844
|
+
});
|
|
12845
|
+
update();
|
|
12846
|
+
return () => disposable.dispose();
|
|
12847
|
+
});
|
|
12848
|
+
}), distinctUntilChanged());
|
|
12849
|
+
}
|
|
12763
12850
|
|
|
12764
12851
|
//#endregion
|
|
12765
12852
|
//#region src/services/doc-view-scale.ts
|
|
@@ -13409,11 +13496,13 @@ function doesDocMutationRequireLayout(actions, drawings) {
|
|
|
13409
13496
|
if (!sawComponent || !drawingOnly) return true;
|
|
13410
13497
|
if (transitions.size === 0) return false;
|
|
13411
13498
|
for (const [drawingId, transition] of transitions) {
|
|
13412
|
-
var
|
|
13413
|
-
const
|
|
13499
|
+
var _currentDrawing$docTr, _currentDrawing$docTr2;
|
|
13500
|
+
const currentDrawing = drawings === null || drawings === void 0 ? void 0 : drawings[drawingId];
|
|
13501
|
+
const currentLayoutType = currentDrawing === null || currentDrawing === void 0 ? void 0 : currentDrawing.layoutType;
|
|
13414
13502
|
const before = transition.before ?? currentLayoutType;
|
|
13415
13503
|
const after = transition.after ?? currentLayoutType;
|
|
13416
13504
|
if (before == null || after == null || before !== PositionedObjectLayoutType.WRAP_NONE || after !== PositionedObjectLayoutType.WRAP_NONE) return true;
|
|
13505
|
+
if ((currentDrawing === null || currentDrawing === void 0 || (_currentDrawing$docTr = currentDrawing.docTransform) === null || _currentDrawing$docTr === void 0 ? void 0 : _currentDrawing$docTr.positionH.relativeFrom) !== ObjectRelativeFromH.PAGE || (currentDrawing === null || currentDrawing === void 0 || (_currentDrawing$docTr2 = currentDrawing.docTransform) === null || _currentDrawing$docTr2 === void 0 ? void 0 : _currentDrawing$docTr2.positionV.relativeFrom) !== ObjectRelativeFromV.PAGE) return true;
|
|
13417
13506
|
}
|
|
13418
13507
|
return false;
|
|
13419
13508
|
}
|
|
@@ -13606,9 +13695,13 @@ let DocRenderController = class DocRenderController extends RxDisposable {
|
|
|
13606
13695
|
const interactionAnchor = priorityAnchorBelongsToMutation ? options.anchor : options.priorityAnchor ?? options.anchor;
|
|
13607
13696
|
let interactionViewportAnchor = priorityAnchorBelongsToMutation ? null : this._captureViewportAnchor(skeleton, options.priorityAnchor, options.invalidation);
|
|
13608
13697
|
const foregroundEndOffset = this._resolveContinuousForegroundEndOffset(skeleton, options.invalidation);
|
|
13698
|
+
const viewport = this._context.scene.getViewport("viewMain");
|
|
13699
|
+
const docsComponent = this._context.mainComponent;
|
|
13700
|
+
const minimumPublicationHeight = this._context.unit.documentStyle.documentFlavor === DocumentFlavor.MODERN && viewport != null && docsComponent instanceof Documents ? Math.max(0, viewport.calcViewportInfo().viewBound.bottom - docsComponent.getOffsetConfig().docsTop) : void 0;
|
|
13609
13701
|
this._layoutCoordinator.schedule(skeleton, {
|
|
13610
13702
|
...options,
|
|
13611
13703
|
anchor: interactionAnchor,
|
|
13704
|
+
...minimumPublicationHeight != null && Number.isFinite(minimumPublicationHeight) && minimumPublicationHeight > 0 ? { minimumPublicationHeight } : {},
|
|
13612
13705
|
...foregroundEndOffset == null ? {} : { foregroundEndOffset },
|
|
13613
13706
|
preserveInteractionWindow: interactionAnchor != null && interactionAnchor !== options.anchor,
|
|
13614
13707
|
reuseUnaffectedTail: false
|
|
@@ -14968,7 +15061,8 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
|
|
|
14968
15061
|
const updatePosition = () => {
|
|
14969
15062
|
try {
|
|
14970
15063
|
const newPosition = calc();
|
|
14971
|
-
|
|
15064
|
+
const previous = position$.value;
|
|
15065
|
+
if (newPosition && (newPosition.left !== previous.left || newPosition.right !== previous.right || newPosition.top !== previous.top || newPosition.bottom !== previous.bottom)) position$.next(newPosition);
|
|
14972
15066
|
} catch {}
|
|
14973
15067
|
};
|
|
14974
15068
|
disposable.add(this._commandService.onCommandExecuted((commandInfo) => {
|
|
@@ -15024,6 +15118,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
|
|
|
15024
15118
|
disposable.add(currentRender.scene.onTransformChange$.subscribeEvent(() => {
|
|
15025
15119
|
updatePositions();
|
|
15026
15120
|
}));
|
|
15121
|
+
if (currentRender.mainComponent) disposable.add(currentRender.mainComponent.onTransformChange$.subscribeEvent(updatePositions));
|
|
15027
15122
|
return {
|
|
15028
15123
|
positions,
|
|
15029
15124
|
positions$,
|
|
@@ -15035,14 +15130,18 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
|
|
|
15035
15130
|
if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
|
|
15036
15131
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
15037
15132
|
const popupManagerService = this._resolvePopupManagerService(popupInjector);
|
|
15038
|
-
const { position, position$, disposable } = this._createRectPositionObserver(rect, currentRender);
|
|
15133
|
+
const { position, position$, disposable, updatePosition } = this._createRectPositionObserver(rect, currentRender);
|
|
15134
|
+
if (popup.positionChanges$) disposable.add(popup.positionChanges$.subscribe(updatePosition));
|
|
15039
15135
|
const id = popupManagerService.addPopup({
|
|
15040
15136
|
...popup,
|
|
15041
15137
|
unitId,
|
|
15042
15138
|
subUnitId: "default",
|
|
15043
15139
|
connectorInjector: popupInjector,
|
|
15044
15140
|
anchorRect: position,
|
|
15045
|
-
anchorRect$: position
|
|
15141
|
+
anchorRect$: position$.pipe(throttleTime(0, animationFrameScheduler, {
|
|
15142
|
+
leading: true,
|
|
15143
|
+
trailing: true
|
|
15144
|
+
})),
|
|
15046
15145
|
canvasElement: currentRender.engine.getCanvasElement()
|
|
15047
15146
|
});
|
|
15048
15147
|
const popupActivity = popup.requiresStableLayout === false ? null : this._beginPopupActivity(unitId);
|
|
@@ -15074,7 +15173,10 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
|
|
|
15074
15173
|
subUnitId: "default",
|
|
15075
15174
|
connectorInjector: popupInjector,
|
|
15076
15175
|
anchorRect: position,
|
|
15077
|
-
anchorRect$: position
|
|
15176
|
+
anchorRect$: position$.pipe(throttleTime(0, animationFrameScheduler, {
|
|
15177
|
+
leading: true,
|
|
15178
|
+
trailing: true
|
|
15179
|
+
})),
|
|
15078
15180
|
canvasElement: currentRender.engine.getCanvasElement()
|
|
15079
15181
|
});
|
|
15080
15182
|
const popupActivity = popup.requiresStableLayout === false ? null : this._beginPopupActivity(unitId);
|
|
@@ -15116,7 +15218,11 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
|
|
|
15116
15218
|
}
|
|
15117
15219
|
return direction.includes("top") ? bounds[0] : bounds[bounds.length - 1];
|
|
15118
15220
|
};
|
|
15119
|
-
const
|
|
15221
|
+
const popupBounds$ = bounds$.pipe(throttleTime(0, animationFrameScheduler, {
|
|
15222
|
+
leading: true,
|
|
15223
|
+
trailing: true
|
|
15224
|
+
}));
|
|
15225
|
+
const position$ = popupBounds$.pipe(filter((bounds) => bounds.length > 0), map(getAnchor));
|
|
15120
15226
|
let id;
|
|
15121
15227
|
let popupActivity = null;
|
|
15122
15228
|
const removePopup = () => {
|
|
@@ -15141,7 +15247,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
|
|
|
15141
15247
|
anchorRect: getAnchor(bounds),
|
|
15142
15248
|
anchorRect$: position$,
|
|
15143
15249
|
excludeRects: bounds,
|
|
15144
|
-
excludeRects$:
|
|
15250
|
+
excludeRects$: popupBounds$,
|
|
15145
15251
|
direction: [
|
|
15146
15252
|
"top",
|
|
15147
15253
|
"bottom",
|
|
@@ -15450,6 +15556,12 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
|
|
|
15450
15556
|
}));
|
|
15451
15557
|
}
|
|
15452
15558
|
_initResetDirty() {
|
|
15559
|
+
this.disposeWithMe(this._documents.onTransformChange$.subscribeEvent(() => {
|
|
15560
|
+
this._customRangeDirty = true;
|
|
15561
|
+
this._bulletDirty = true;
|
|
15562
|
+
this._paragraphDirty = true;
|
|
15563
|
+
this._tableBoundsDirty = true;
|
|
15564
|
+
}));
|
|
15453
15565
|
this.disposeWithMe(this._skeleton.dirty$.subscribe(() => {
|
|
15454
15566
|
this._customRangeDirty = true;
|
|
15455
15567
|
this._bulletDirty = true;
|
|
@@ -15941,6 +16053,9 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
|
|
|
15941
16053
|
return (_this$_tableCellBound2 = this._tableCellBounds.get(tableId)) === null || _this$_tableCellBound2 === void 0 ? void 0 : _this$_tableCellBound2.find((bound) => bound.rowIndex === rowIndex && bound.colIndex === colIndex && (pageIndex == null || bound.pageIndex === pageIndex));
|
|
15942
16054
|
}
|
|
15943
16055
|
findParagraphBoundByIndex(index) {
|
|
16056
|
+
this._buildParagraphBounds();
|
|
16057
|
+
const paragraph = this._paragraphBounds.get(index);
|
|
16058
|
+
if (paragraph) return paragraph;
|
|
15944
16059
|
this._buildTableBounds();
|
|
15945
16060
|
this._buildTableCellsForDocumentRange(index, index);
|
|
15946
16061
|
let tableParagraph = this._tableParagraphBoundsByIndex.get(index);
|
|
@@ -15952,9 +16067,6 @@ let DocEventManagerService = class DocEventManagerService extends Disposable {
|
|
|
15952
16067
|
if (tableParagraph) return tableParagraph;
|
|
15953
16068
|
}
|
|
15954
16069
|
if (tableParagraph) return tableParagraph;
|
|
15955
|
-
this._buildParagraphBounds();
|
|
15956
|
-
const paragraph = this._paragraphBounds.get(index);
|
|
15957
|
-
if (paragraph) return paragraph;
|
|
15958
16070
|
}
|
|
15959
16071
|
findParagraphBoundsInRange(startIndex, endIndex) {
|
|
15960
16072
|
this._buildTableBounds();
|
|
@@ -18435,6 +18547,46 @@ function PasteRibbonMenuFactory(accessor) {
|
|
|
18435
18547
|
};
|
|
18436
18548
|
}
|
|
18437
18549
|
|
|
18550
|
+
//#endregion
|
|
18551
|
+
//#region src/menu/display.menu.ts
|
|
18552
|
+
const DOC_ZOOM_RATIO_MENU_ID = "doc.menu.zoom-ratio";
|
|
18553
|
+
function DocZoomRatioMenuItemFactory(accessor) {
|
|
18554
|
+
const commandService = accessor.get(ICommandService);
|
|
18555
|
+
const instanceService = accessor.get(IUniverInstanceService);
|
|
18556
|
+
return {
|
|
18557
|
+
id: DOC_ZOOM_RATIO_MENU_ID,
|
|
18558
|
+
type: MenuItemType.SELECTOR,
|
|
18559
|
+
icon: "ZoomInIcon",
|
|
18560
|
+
tooltip: "docs-ui.toolbar.zoom",
|
|
18561
|
+
selectionsCommandId: SetDocZoomRatioOperation.id,
|
|
18562
|
+
selections: DOC_ZOOM_SHORTCUTS.map((value) => ({
|
|
18563
|
+
value,
|
|
18564
|
+
label: `${value}%`,
|
|
18565
|
+
params: () => {
|
|
18566
|
+
var _instanceService$getC;
|
|
18567
|
+
return {
|
|
18568
|
+
unitId: (_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId(),
|
|
18569
|
+
zoomRatio: value / 100
|
|
18570
|
+
};
|
|
18571
|
+
}
|
|
18572
|
+
})),
|
|
18573
|
+
value$: getDocZoomRatio$(commandService, instanceService),
|
|
18574
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
|
|
18575
|
+
};
|
|
18576
|
+
}
|
|
18577
|
+
function DocFullscreenMenuItemFactory(accessor) {
|
|
18578
|
+
const root = accessor.get(ILayoutService).rootContainerElement;
|
|
18579
|
+
const fullscreen$ = root ? merge$1(of(null), fromEvent(root.ownerDocument, "fullscreenchange")).pipe(map(() => root.ownerDocument.fullscreenElement === root), distinctUntilChanged()) : of(false);
|
|
18580
|
+
return {
|
|
18581
|
+
id: ToggleFullscreenOperation.id,
|
|
18582
|
+
type: MenuItemType.BUTTON,
|
|
18583
|
+
tooltip: "docs-ui.toolbar.fullscreen",
|
|
18584
|
+
icon: fullscreen$.pipe(map((fullscreen) => fullscreen ? "ShrinkIcon" : "ExpandIcon")),
|
|
18585
|
+
activated$: fullscreen$,
|
|
18586
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
|
|
18587
|
+
};
|
|
18588
|
+
}
|
|
18589
|
+
|
|
18438
18590
|
//#endregion
|
|
18439
18591
|
//#region src/views/paragraph-menu/theme-color.ts
|
|
18440
18592
|
function getHighlightBackgroundColor(themeService, index) {
|
|
@@ -18843,7 +18995,7 @@ function ParagraphMenuInsertBelowSubmenuItemFactory(accessor) {
|
|
|
18843
18995
|
return {
|
|
18844
18996
|
id: DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID,
|
|
18845
18997
|
type: MenuItemType.SUBITEMS,
|
|
18846
|
-
icon: "
|
|
18998
|
+
icon: "InsertBelowDoubleIcon",
|
|
18847
18999
|
title: "docs-ui.rightClick.insertBellow",
|
|
18848
19000
|
tooltip: "docs-ui.rightClick.insertBellow",
|
|
18849
19001
|
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
|
|
@@ -19061,7 +19213,8 @@ const menuSchema = {
|
|
|
19061
19213
|
order: 0,
|
|
19062
19214
|
gridLayout: {
|
|
19063
19215
|
row: 2,
|
|
19064
|
-
column: 1
|
|
19216
|
+
column: 1,
|
|
19217
|
+
width: 44
|
|
19065
19218
|
},
|
|
19066
19219
|
menuItemFactory: BoldMenuItemFactory
|
|
19067
19220
|
},
|
|
@@ -19069,7 +19222,8 @@ const menuSchema = {
|
|
|
19069
19222
|
order: 1,
|
|
19070
19223
|
gridLayout: {
|
|
19071
19224
|
row: 2,
|
|
19072
|
-
column: 2
|
|
19225
|
+
column: 2,
|
|
19226
|
+
width: 44
|
|
19073
19227
|
},
|
|
19074
19228
|
menuItemFactory: ItalicMenuItemFactory
|
|
19075
19229
|
},
|
|
@@ -19077,7 +19231,8 @@ const menuSchema = {
|
|
|
19077
19231
|
order: 2,
|
|
19078
19232
|
gridLayout: {
|
|
19079
19233
|
row: 2,
|
|
19080
|
-
column: 3
|
|
19234
|
+
column: 3,
|
|
19235
|
+
width: 44
|
|
19081
19236
|
},
|
|
19082
19237
|
menuItemFactory: UnderlineMenuItemFactory
|
|
19083
19238
|
},
|
|
@@ -19085,7 +19240,8 @@ const menuSchema = {
|
|
|
19085
19240
|
order: 3,
|
|
19086
19241
|
gridLayout: {
|
|
19087
19242
|
row: 2,
|
|
19088
|
-
column: 4
|
|
19243
|
+
column: 4,
|
|
19244
|
+
width: 44
|
|
19089
19245
|
},
|
|
19090
19246
|
menuItemFactory: StrikeThroughMenuItemFactory
|
|
19091
19247
|
},
|
|
@@ -19093,7 +19249,8 @@ const menuSchema = {
|
|
|
19093
19249
|
order: 4,
|
|
19094
19250
|
gridLayout: {
|
|
19095
19251
|
row: 2,
|
|
19096
|
-
column:
|
|
19252
|
+
column: 6,
|
|
19253
|
+
width: 44
|
|
19097
19254
|
},
|
|
19098
19255
|
menuItemFactory: SubscriptMenuItemFactory
|
|
19099
19256
|
},
|
|
@@ -19101,7 +19258,8 @@ const menuSchema = {
|
|
|
19101
19258
|
order: 5,
|
|
19102
19259
|
gridLayout: {
|
|
19103
19260
|
row: 2,
|
|
19104
|
-
column:
|
|
19261
|
+
column: 5,
|
|
19262
|
+
width: 44
|
|
19105
19263
|
},
|
|
19106
19264
|
menuItemFactory: SuperscriptMenuItemFactory
|
|
19107
19265
|
},
|
|
@@ -19111,7 +19269,7 @@ const menuSchema = {
|
|
|
19111
19269
|
row: 1,
|
|
19112
19270
|
column: 1,
|
|
19113
19271
|
columnSpan: 2,
|
|
19114
|
-
width:
|
|
19272
|
+
width: 96
|
|
19115
19273
|
},
|
|
19116
19274
|
menuItemFactory: HeadingSelectorMenuItemFactory
|
|
19117
19275
|
},
|
|
@@ -19120,7 +19278,8 @@ const menuSchema = {
|
|
|
19120
19278
|
gridLayout: {
|
|
19121
19279
|
row: 1,
|
|
19122
19280
|
column: 7,
|
|
19123
|
-
|
|
19281
|
+
columnSpan: 2,
|
|
19282
|
+
width: 96
|
|
19124
19283
|
},
|
|
19125
19284
|
menuItemFactory: FontSizeSelectorMenuItemFactory
|
|
19126
19285
|
},
|
|
@@ -19130,7 +19289,7 @@ const menuSchema = {
|
|
|
19130
19289
|
row: 1,
|
|
19131
19290
|
column: 3,
|
|
19132
19291
|
columnSpan: 4,
|
|
19133
|
-
width:
|
|
19292
|
+
width: 200
|
|
19134
19293
|
},
|
|
19135
19294
|
menuItemFactory: FontFamilySelectorMenuItemFactory
|
|
19136
19295
|
},
|
|
@@ -19138,7 +19297,8 @@ const menuSchema = {
|
|
|
19138
19297
|
order: 8,
|
|
19139
19298
|
gridLayout: {
|
|
19140
19299
|
row: 2,
|
|
19141
|
-
column:
|
|
19300
|
+
column: 8,
|
|
19301
|
+
width: 44
|
|
19142
19302
|
},
|
|
19143
19303
|
menuItemFactory: TextColorSelectorMenuItemFactory,
|
|
19144
19304
|
[ResetInlineFormatTextColorCommand.id]: {
|
|
@@ -19150,7 +19310,8 @@ const menuSchema = {
|
|
|
19150
19310
|
order: 9,
|
|
19151
19311
|
gridLayout: {
|
|
19152
19312
|
row: 2,
|
|
19153
|
-
column:
|
|
19313
|
+
column: 7,
|
|
19314
|
+
width: 44
|
|
19154
19315
|
},
|
|
19155
19316
|
menuItemFactory: BackgroundColorSelectorMenuItemFactory,
|
|
19156
19317
|
[ResetInlineFormatTextBackgroundColorCommand.id]: {
|
|
@@ -19201,16 +19362,6 @@ const menuSchema = {
|
|
|
19201
19362
|
showLabel: true
|
|
19202
19363
|
},
|
|
19203
19364
|
menuItemFactory: HeaderFooterMenuItemFactory
|
|
19204
|
-
},
|
|
19205
|
-
[DocOpenPageSettingCommand.id]: {
|
|
19206
|
-
order: 12,
|
|
19207
|
-
gridLayout: {
|
|
19208
|
-
row: 1,
|
|
19209
|
-
column: 4,
|
|
19210
|
-
rowSpan: 2,
|
|
19211
|
-
showLabel: true
|
|
19212
|
-
},
|
|
19213
|
-
menuItemFactory: PageSettingMenuItemFactory
|
|
19214
19365
|
}
|
|
19215
19366
|
},
|
|
19216
19367
|
[RibbonInsertGroup.MEDIA]: {
|
|
@@ -19285,6 +19436,34 @@ const menuSchema = {
|
|
|
19285
19436
|
menuItemFactory: SymbolPickerMenuItemFactory
|
|
19286
19437
|
}
|
|
19287
19438
|
},
|
|
19439
|
+
[RibbonViewGroup.DISPLAY]: {
|
|
19440
|
+
[DocOpenPageSettingCommand.id]: {
|
|
19441
|
+
order: 0,
|
|
19442
|
+
gridLayout: {
|
|
19443
|
+
row: 1,
|
|
19444
|
+
column: 1,
|
|
19445
|
+
rowSpan: 2,
|
|
19446
|
+
showLabel: true
|
|
19447
|
+
},
|
|
19448
|
+
menuItemFactory: PageSettingMenuItemFactory
|
|
19449
|
+
},
|
|
19450
|
+
[DOC_ZOOM_RATIO_MENU_ID]: {
|
|
19451
|
+
order: 1,
|
|
19452
|
+
gridLayout: {
|
|
19453
|
+
row: 1,
|
|
19454
|
+
column: 2
|
|
19455
|
+
},
|
|
19456
|
+
menuItemFactory: DocZoomRatioMenuItemFactory
|
|
19457
|
+
},
|
|
19458
|
+
[ToggleFullscreenOperation.id]: {
|
|
19459
|
+
order: 2,
|
|
19460
|
+
gridLayout: {
|
|
19461
|
+
row: 2,
|
|
19462
|
+
column: 2
|
|
19463
|
+
},
|
|
19464
|
+
menuItemFactory: DocFullscreenMenuItemFactory
|
|
19465
|
+
}
|
|
19466
|
+
},
|
|
19288
19467
|
[ContextMenuPosition.MAIN_AREA]: {
|
|
19289
19468
|
[ContextMenuGroup.OTHERS]: { [OpenDocParagraphPermissionOperation.id]: {
|
|
19290
19469
|
order: 10,
|
|
@@ -20003,45 +20182,23 @@ const BulletListShortCut = {
|
|
|
20003
20182
|
|
|
20004
20183
|
//#endregion
|
|
20005
20184
|
//#region src/views/count-bar/ZoomSlider.tsx
|
|
20006
|
-
const ZOOM_MAP = [
|
|
20007
|
-
50,
|
|
20008
|
-
80,
|
|
20009
|
-
100,
|
|
20010
|
-
130,
|
|
20011
|
-
150,
|
|
20012
|
-
170,
|
|
20013
|
-
200,
|
|
20014
|
-
400
|
|
20015
|
-
];
|
|
20016
20185
|
const DOC_ZOOM_RANGE = [10, 400];
|
|
20017
20186
|
function ZoomSlider() {
|
|
20018
20187
|
const commandService = useDependency(ICommandService);
|
|
20019
20188
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
20020
|
-
const
|
|
20021
|
-
const getCurrentZoom = useCallback((docModel = documentDataModel) => {
|
|
20022
|
-
if (!docModel) return 100;
|
|
20023
|
-
return Math.round(getDocEffectiveZoomRatio(docModel) * 100);
|
|
20024
|
-
}, [documentDataModel]);
|
|
20025
|
-
const [zoom, setZoom] = useState(100);
|
|
20026
|
-
useEffect(() => setZoom(getCurrentZoom(documentDataModel)), [documentDataModel, getCurrentZoom]);
|
|
20027
|
-
useEffect(() => {
|
|
20028
|
-
return commandService.onCommandExecuted((commandInfo) => {
|
|
20029
|
-
if (commandInfo.id === SetDocZoomRatioOperation.id) setZoom(getCurrentZoom());
|
|
20030
|
-
}).dispose;
|
|
20031
|
-
}, [commandService, getCurrentZoom]);
|
|
20189
|
+
const zoom = useObservable(() => getDocZoomRatio$(commandService, univerInstanceService), 100, void 0, [commandService, univerInstanceService]);
|
|
20032
20190
|
function handleChange(value) {
|
|
20033
|
-
|
|
20191
|
+
const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
20034
20192
|
if (documentDataModel == null) return;
|
|
20035
|
-
|
|
20036
|
-
commandService.executeCommand(SetDocZoomRatioOperation.id, {
|
|
20193
|
+
return commandService.executeCommand(SetDocZoomRatioOperation.id, {
|
|
20037
20194
|
unitId: documentDataModel.getUnitId(),
|
|
20038
|
-
zoomRatio
|
|
20195
|
+
zoomRatio: value / 100
|
|
20039
20196
|
});
|
|
20040
20197
|
}
|
|
20041
20198
|
return /* @__PURE__ */ jsx(Slider, {
|
|
20042
20199
|
min: DOC_ZOOM_RANGE[0],
|
|
20043
20200
|
value: zoom,
|
|
20044
|
-
shortcuts:
|
|
20201
|
+
shortcuts: DOC_ZOOM_SHORTCUTS,
|
|
20045
20202
|
onChange: handleChange
|
|
20046
20203
|
});
|
|
20047
20204
|
}
|
|
@@ -20625,10 +20782,30 @@ function DocFooter() {
|
|
|
20625
20782
|
return /* @__PURE__ */ jsx(DocFooterContent, {});
|
|
20626
20783
|
}
|
|
20627
20784
|
|
|
20785
|
+
//#endregion
|
|
20786
|
+
//#region src/views/doc-side-menu-layout.ts
|
|
20787
|
+
function isDocSideMenuTableOverlapping(outline, table, viewport) {
|
|
20788
|
+
if (table.bottom <= outline.top || table.top >= outline.bottom) return false;
|
|
20789
|
+
let left = table.left;
|
|
20790
|
+
let right = table.right;
|
|
20791
|
+
if (viewport && (viewport.leadingInsetLeft ?? 0) + viewport.contentWidth + (viewport.trailingInsetRight ?? 0) > viewport.viewportWidth) {
|
|
20792
|
+
const clipLeft = viewport.viewportLeft ?? table.left - (viewport.leadingInsetLeft ?? 0);
|
|
20793
|
+
left = Math.max(clipLeft, table.left - viewport.scrollLeft);
|
|
20794
|
+
right = Math.min(clipLeft + viewport.viewportWidth, table.left + viewport.contentWidth - viewport.scrollLeft);
|
|
20795
|
+
}
|
|
20796
|
+
return right > left && left < outline.right && right > outline.left;
|
|
20797
|
+
}
|
|
20798
|
+
|
|
20628
20799
|
//#endregion
|
|
20629
20800
|
//#region src/views/SideMenu.tsx
|
|
20630
20801
|
const SideMenu = forwardRef((props, ref) => {
|
|
20631
|
-
const { label, menus, onClick, className, style, mode, maxHeight, activeId, open, onOpenChange, maxWidth, wrapperClass, wrapperStyle, iconClass, iconStyle } = props;
|
|
20802
|
+
const { label, menus, onClick, className, style, mode = "side-bar", maxHeight, activeId, open: controlledOpen, onOpenChange, maxWidth, wrapperClass, wrapperStyle, iconClass, iconStyle } = props;
|
|
20803
|
+
const [expanded, setExpanded] = useState(mode === "side-bar");
|
|
20804
|
+
const open = controlledOpen ?? expanded;
|
|
20805
|
+
const handleOpenChange = useCallback((nextOpen) => {
|
|
20806
|
+
if (controlledOpen === void 0) setExpanded(nextOpen);
|
|
20807
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(nextOpen);
|
|
20808
|
+
}, [controlledOpen, onOpenChange]);
|
|
20632
20809
|
const panelId = useId();
|
|
20633
20810
|
const wrapperRef = useRef(null);
|
|
20634
20811
|
const containerRef = useRef(null);
|
|
@@ -20656,13 +20833,13 @@ const SideMenu = forwardRef((props, ref) => {
|
|
|
20656
20833
|
if (!open || mode !== "float") return;
|
|
20657
20834
|
const handlePointerDown = (event) => {
|
|
20658
20835
|
var _wrapperRef$current;
|
|
20659
|
-
if (event.target instanceof Node && !((_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.contains(event.target)))
|
|
20836
|
+
if (event.target instanceof Node && !((_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.contains(event.target))) handleOpenChange(false);
|
|
20660
20837
|
};
|
|
20661
20838
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
20662
20839
|
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
20663
20840
|
}, [
|
|
20841
|
+
handleOpenChange,
|
|
20664
20842
|
mode,
|
|
20665
|
-
onOpenChange,
|
|
20666
20843
|
open
|
|
20667
20844
|
]);
|
|
20668
20845
|
const handleKeyDown = (event) => {
|
|
@@ -20671,7 +20848,7 @@ const SideMenu = forwardRef((props, ref) => {
|
|
|
20671
20848
|
var _toggleRef$current;
|
|
20672
20849
|
event.preventDefault();
|
|
20673
20850
|
event.stopPropagation();
|
|
20674
|
-
|
|
20851
|
+
handleOpenChange(false);
|
|
20675
20852
|
(_toggleRef$current = toggleRef.current) === null || _toggleRef$current === void 0 || _toggleRef$current.focus();
|
|
20676
20853
|
return;
|
|
20677
20854
|
}
|
|
@@ -20700,51 +20877,47 @@ const SideMenu = forwardRef((props, ref) => {
|
|
|
20700
20877
|
};
|
|
20701
20878
|
return /* @__PURE__ */ jsxs("div", {
|
|
20702
20879
|
ref: wrapperRef,
|
|
20703
|
-
className: clsx("univer-relative univer-
|
|
20880
|
+
className: clsx("univer-relative univer-ms-4", wrapperClass),
|
|
20704
20881
|
style: {
|
|
20705
|
-
width,
|
|
20882
|
+
width: open ? width : 32,
|
|
20706
20883
|
...wrapperStyle
|
|
20707
20884
|
},
|
|
20708
20885
|
onKeyDown: handleKeyDown,
|
|
20709
|
-
children: [/* @__PURE__ */ jsx(
|
|
20886
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
20710
20887
|
ref: toggleRef,
|
|
20711
20888
|
type: "button",
|
|
20889
|
+
variant: "ghost",
|
|
20890
|
+
size: "icon",
|
|
20712
20891
|
"aria-label": label,
|
|
20713
20892
|
"aria-expanded": !!open,
|
|
20714
20893
|
"aria-controls": open ? panelId : void 0,
|
|
20715
20894
|
title: label,
|
|
20716
|
-
onClick: () =>
|
|
20717
|
-
className: clsx("univer-absolute univer-
|
|
20718
|
-
style:
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20895
|
+
onClick: () => handleOpenChange(!open),
|
|
20896
|
+
className: clsx("univer-absolute univer-start-0 univer-top-0 univer-z-10 !univer-text-gray-500 hover:!univer-text-gray-900 focus-visible:univer-outline focus-visible:univer-outline-2 focus-visible:univer-outline-primary-600 dark:!univer-text-gray-400 dark:hover:!univer-text-gray-100", iconClass),
|
|
20897
|
+
style: iconStyle,
|
|
20898
|
+
children: open ? /* @__PURE__ */ jsx(MoreLeftIcon, {
|
|
20899
|
+
"aria-hidden": "true",
|
|
20900
|
+
className: "!univer-size-6"
|
|
20901
|
+
}) : /* @__PURE__ */ jsx(CatalogueIcon, {
|
|
20902
|
+
"aria-hidden": "true",
|
|
20903
|
+
className: "!univer-size-5"
|
|
20904
|
+
})
|
|
20905
|
+
}), open && /* @__PURE__ */ jsx("nav", {
|
|
20724
20906
|
id: panelId,
|
|
20725
20907
|
"aria-label": label,
|
|
20726
|
-
className: clsx("univer-box-border univer-flex univer-w-full univer-flex-col univer-overflow-hidden univer-
|
|
20908
|
+
className: clsx("univer-box-border univer-flex univer-w-full univer-flex-col univer-overflow-hidden univer-pt-10", mode === "float" && "univer-bg-gray-0 dark:univer-bg-gray-900", className),
|
|
20727
20909
|
style: {
|
|
20728
20910
|
maxHeight,
|
|
20729
20911
|
...style
|
|
20730
20912
|
},
|
|
20731
|
-
children:
|
|
20732
|
-
className: "univer-flex univer-h-11 univer-shrink-0 univer-items-center univer-gap-2 univer-px-3 univer-pr-12 univer-text-xs univer-font-medium univer-text-gray-500 dark:univer-text-gray-400",
|
|
20733
|
-
children: [/* @__PURE__ */ jsx(CatalogueIcon, {
|
|
20734
|
-
"aria-hidden": "true",
|
|
20735
|
-
className: "univer-shrink-0 univer-text-sm"
|
|
20736
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
20737
|
-
className: "univer-truncate",
|
|
20738
|
-
children: label
|
|
20739
|
-
})]
|
|
20740
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
20913
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
20741
20914
|
ref: containerRef,
|
|
20742
|
-
className: clsx("univer-relative univer-min-h-0 univer-overflow-y-auto univer-overscroll-contain univer-
|
|
20915
|
+
className: clsx("univer-relative univer-min-h-0 univer-overflow-y-auto univer-overscroll-contain univer-pb-2", scrollbarClassName),
|
|
20743
20916
|
children: /* @__PURE__ */ jsx("ol", {
|
|
20744
20917
|
className: "univer-m-0 univer-list-none univer-p-0",
|
|
20745
20918
|
children: menus === null || menus === void 0 ? void 0 : menus.map((menu) => /* @__PURE__ */ jsx("li", {
|
|
20746
|
-
className: menu.isTitle ? "univer-mb-
|
|
20747
|
-
children: /* @__PURE__ */
|
|
20919
|
+
className: menu.isTitle ? "univer-mb-2" : void 0,
|
|
20920
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
20748
20921
|
ref: (element) => {
|
|
20749
20922
|
if (element) itemsRef.current.set(menu.id, element);
|
|
20750
20923
|
else itemsRef.current.delete(menu.id);
|
|
@@ -20752,39 +20925,28 @@ const SideMenu = forwardRef((props, ref) => {
|
|
|
20752
20925
|
type: "button",
|
|
20753
20926
|
"aria-current": menu.id === activeId ? "location" : void 0,
|
|
20754
20927
|
title: menu.text,
|
|
20755
|
-
className: clsx("univer-
|
|
20756
|
-
"univer-
|
|
20757
|
-
"univer-text-gray-900 dark:univer-text-gray-100": menu.isTitle && menu.id !== activeId,
|
|
20758
|
-
"univer-text-gray-
|
|
20928
|
+
className: clsx("univer-box-border univer-flex univer-min-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-border-0 univer-bg-transparent univer-py-1.5 univer-pe-2 univer-text-start univer-text-sm univer-leading-5 univer-transition-colors focus-visible:univer-outline focus-visible:univer-outline-2 focus-visible:-univer-outline-offset-2 focus-visible:univer-outline-primary-600", menu.isTitle ? "univer-font-medium" : "univer-font-normal", {
|
|
20929
|
+
"univer-text-primary-600 dark:univer-text-primary-400": menu.id === activeId,
|
|
20930
|
+
"univer-text-gray-600 hover:univer-text-gray-900 dark:univer-text-gray-300 dark:hover:univer-text-gray-100": menu.isTitle && menu.id !== activeId,
|
|
20931
|
+
"univer-text-gray-500 hover:univer-text-gray-900 dark:univer-text-gray-400 dark:hover:univer-text-gray-100": !menu.isTitle && menu.id !== activeId
|
|
20759
20932
|
}),
|
|
20760
|
-
style: {
|
|
20933
|
+
style: { paddingInlineStart: menu.isTitle ? 0 : 12 + Math.max(0, menu.level - 1) * 12 },
|
|
20761
20934
|
onClick: () => {
|
|
20762
20935
|
onClick === null || onClick === void 0 || onClick(menu);
|
|
20763
20936
|
if (mode === "float") {
|
|
20764
20937
|
var _toggleRef$current2;
|
|
20765
|
-
|
|
20938
|
+
handleOpenChange(false);
|
|
20766
20939
|
(_toggleRef$current2 = toggleRef.current) === null || _toggleRef$current2 === void 0 || _toggleRef$current2.focus();
|
|
20767
20940
|
}
|
|
20768
20941
|
},
|
|
20769
|
-
children:
|
|
20770
|
-
menu.
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
style: { left: 14 + Math.max(0, menu.level - 2) * 12 }
|
|
20774
|
-
}),
|
|
20775
|
-
menu.id === activeId && /* @__PURE__ */ jsx("span", {
|
|
20776
|
-
"aria-hidden": "true",
|
|
20777
|
-
className: "univer-absolute univer-bottom-2 univer-left-0 univer-top-2 univer-w-0.5 univer-rounded-full univer-bg-primary-600 dark:univer-bg-primary-400"
|
|
20778
|
-
}),
|
|
20779
|
-
/* @__PURE__ */ jsx("span", {
|
|
20780
|
-
className: menu.isTitle ? "univer-line-clamp-2 univer-break-words" : "univer-truncate",
|
|
20781
|
-
children: menu.text
|
|
20782
|
-
})
|
|
20783
|
-
]
|
|
20942
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
20943
|
+
className: menu.isTitle ? "univer-line-clamp-2 univer-break-words" : "univer-truncate",
|
|
20944
|
+
children: menu.text
|
|
20945
|
+
})
|
|
20784
20946
|
})
|
|
20785
20947
|
}, menu.id))
|
|
20786
20948
|
})
|
|
20787
|
-
})
|
|
20949
|
+
})
|
|
20788
20950
|
})]
|
|
20789
20951
|
});
|
|
20790
20952
|
});
|
|
@@ -20806,52 +20968,77 @@ function findActiveHeading(boundMap, paragraphMap, scrollTop, bottom) {
|
|
|
20806
20968
|
if (!boundMap) return;
|
|
20807
20969
|
const paragraphBounds = Array.from(boundMap.values());
|
|
20808
20970
|
const paragraphIndex = paragraphBounds.findIndex((p) => p.paragraphStart !== p.paragraphEnd && p.rect.top < bottom && p.rect.bottom > scrollTop);
|
|
20809
|
-
if (paragraphIndex === -1) return
|
|
20810
|
-
|
|
20971
|
+
if (paragraphIndex === -1) return;
|
|
20972
|
+
let lastParagraphIndex = paragraphBounds.length - 1;
|
|
20973
|
+
while (lastParagraphIndex > paragraphIndex) {
|
|
20974
|
+
const bound = paragraphBounds[lastParagraphIndex];
|
|
20975
|
+
if (bound.paragraphStart !== bound.paragraphEnd && bound.rect.top < bottom && bound.rect.bottom > scrollTop) break;
|
|
20976
|
+
lastParagraphIndex--;
|
|
20977
|
+
}
|
|
20811
20978
|
for (let i = paragraphIndex; i <= lastParagraphIndex; i++) {
|
|
20812
|
-
var _paragraph$paragraphS;
|
|
20813
20979
|
const bound = paragraphBounds[i];
|
|
20814
20980
|
const paragraph = paragraphMap.get(bound.startIndex);
|
|
20815
|
-
if (paragraph
|
|
20981
|
+
if (paragraph) return paragraph.paragraphId;
|
|
20816
20982
|
}
|
|
20817
20983
|
for (let i = paragraphIndex; i >= 0; i--) {
|
|
20818
|
-
var _paragraph$paragraphS2;
|
|
20819
20984
|
const bound = paragraphBounds[i];
|
|
20820
20985
|
const paragraph = paragraphMap.get(bound.startIndex);
|
|
20821
|
-
if (paragraph
|
|
20986
|
+
if (paragraph) return paragraph.paragraphId;
|
|
20822
20987
|
}
|
|
20823
20988
|
}
|
|
20824
20989
|
const TITLE_ID = "__title";
|
|
20825
20990
|
function DocSideMenu() {
|
|
20826
20991
|
const config = useConfigValue(DOCS_UI_PLUGIN_CONFIG_KEY);
|
|
20827
20992
|
const workbenchService = useDependency(IWorkbenchService);
|
|
20828
|
-
if (useObservable(workbenchService.rootUnitType$, null, true) === UniverInstanceType.UNIVER_DOC && (config === null || config === void 0 ? void 0 : config.toc)) return /* @__PURE__ */ jsx(DocSideMenuContent, {});
|
|
20993
|
+
if (useObservable(workbenchService.rootUnitType$, null, true) === UniverInstanceType.UNIVER_DOC && (config === null || config === void 0 ? void 0 : config.toc) !== false) return /* @__PURE__ */ jsx(DocSideMenuContent, { toc: config === null || config === void 0 ? void 0 : config.toc });
|
|
20829
20994
|
return null;
|
|
20830
20995
|
}
|
|
20831
|
-
function DocSideMenuContent() {
|
|
20832
|
-
var _documentData$body, _documentData$body3;
|
|
20996
|
+
function DocSideMenuContent({ toc }) {
|
|
20997
|
+
var _currentDoc$getSnapsh, _documentData$body, _documentData$body3, _menus$find;
|
|
20833
20998
|
const instanceService = useDependency(IUniverInstanceService);
|
|
20834
20999
|
const localeService = useDependency(LocaleService);
|
|
20835
21000
|
const currentDoc = useObservable(() => instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), void 0, false, [instanceService]);
|
|
21001
|
+
const enabled = toc ?? (currentDoc === null || currentDoc === void 0 || (_currentDoc$getSnapsh = currentDoc.getSnapshot().documentStyle) === null || _currentDoc$getSnapsh === void 0 ? void 0 : _currentDoc$getSnapsh.documentFlavor) === DocumentFlavor.MODERN;
|
|
20836
21002
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
20837
21003
|
const documentData = useObservable(currentDoc ? () => currentDoc.change$.pipe(debounceTime(100), map(() => currentDoc.getSnapshot())) : null, currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getSnapshot(), false, [currentDoc]);
|
|
20838
21004
|
const fullDataStream = (documentData === null || documentData === void 0 || (_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream) ?? "";
|
|
20839
21005
|
const [activeId, setActiveId] = useState(void 0);
|
|
21006
|
+
const [outlineHeight, setOutlineHeight] = useState(0);
|
|
21007
|
+
const containerRef = useRef(null);
|
|
20840
21008
|
const unitId = (currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) ?? "";
|
|
20841
21009
|
const renderer = renderManagerService.getRenderUnitById(unitId);
|
|
20842
21010
|
const title = documentData === null || documentData === void 0 ? void 0 : documentData.title;
|
|
20843
21011
|
const docEventManagerService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocEventManagerService);
|
|
20844
|
-
const
|
|
21012
|
+
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
|
|
20845
21013
|
const readLayout = () => {
|
|
20846
21014
|
var _renderer$mainCompone;
|
|
21015
|
+
const scaleX = (renderer === null || renderer === void 0 ? void 0 : renderer.scene.scaleX) ?? 1;
|
|
21016
|
+
const scaleY = (renderer === null || renderer === void 0 ? void 0 : renderer.scene.scaleY) ?? 1;
|
|
21017
|
+
const scrollX = (viewport === null || viewport === void 0 ? void 0 : viewport.viewportScrollX) ?? 0;
|
|
21018
|
+
const scrollY = (viewport === null || viewport === void 0 ? void 0 : viewport.viewportScrollY) ?? 0;
|
|
21019
|
+
const canvasHeight = (renderer === null || renderer === void 0 ? void 0 : renderer.engine.height) ?? 0;
|
|
21020
|
+
const left = (((renderer === null || renderer === void 0 || (_renderer$mainCompone = renderer.mainComponent) === null || _renderer$mainCompone === void 0 ? void 0 : _renderer$mainCompone.left) ?? 0) - scrollX) * scaleX;
|
|
21021
|
+
const outlineRect = {
|
|
21022
|
+
left: scrollX + 16 / scaleX,
|
|
21023
|
+
right: scrollX + 272 / scaleX,
|
|
21024
|
+
top: scrollY + 16 / scaleY,
|
|
21025
|
+
bottom: scrollY + Math.min(canvasHeight - 16, 16 + outlineHeight) / scaleY
|
|
21026
|
+
};
|
|
21027
|
+
const overlapsTable = left >= 288 && outlineHeight > 0 && Array.from((docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.tableBounds.values()) ?? []).some(({ tableId, rect }) => isDocSideMenuTableOverlapping(outlineRect, rect, getDocsTableRenderViewport(unitId, getTableIdAndSliceIndex(tableId).tableId)));
|
|
20847
21028
|
return {
|
|
20848
|
-
left
|
|
20849
|
-
canvasHeight
|
|
21029
|
+
left,
|
|
21030
|
+
canvasHeight,
|
|
20850
21031
|
canvasWidth: (renderer === null || renderer === void 0 ? void 0 : renderer.engine.width) ?? 0,
|
|
20851
|
-
scaleY
|
|
21032
|
+
scaleY,
|
|
21033
|
+
overlapsTable
|
|
20852
21034
|
};
|
|
20853
21035
|
};
|
|
20854
|
-
const
|
|
21036
|
+
const layout = useObservable((renderer === null || renderer === void 0 ? void 0 : renderer.engine.onTransformChange$) ? () => merge$1(fromEventSubject(renderer.engine.onTransformChange$), fromEventSubject(renderer.scene.onTransformChange$), ...renderer.mainComponent instanceof Documents ? [renderer.mainComponent.pageRender$] : [], ...viewport ? [fromEventSubject(viewport.onScrollAfter$)] : [], ...renderer.mainComponent ? [fromEventSubject(renderer.mainComponent.onTransformChange$)] : []).pipe(auditTime(33), map(readLayout), startWith(readLayout()), distinctUntilChanged((previous, current) => previous.left === current.left && previous.canvasHeight === current.canvasHeight && previous.canvasWidth === current.canvasWidth && previous.scaleY === current.scaleY && previous.overlapsTable === current.overlapsTable)) : null, readLayout(), false, [
|
|
21037
|
+
renderer,
|
|
21038
|
+
viewport,
|
|
21039
|
+
outlineHeight
|
|
21040
|
+
]);
|
|
21041
|
+
const { left, canvasHeight, canvasWidth, scaleY } = layout;
|
|
20855
21042
|
const paragraphs = useMemo(() => {
|
|
20856
21043
|
var _documentData$body2;
|
|
20857
21044
|
return (documentData === null || documentData === void 0 || (_documentData$body2 = documentData.body) === null || _documentData$body2 === void 0 ? void 0 : _documentData$body2.paragraphs) ?? [];
|
|
@@ -20860,22 +21047,26 @@ function DocSideMenuContent() {
|
|
|
20860
21047
|
dataStream: fullDataStream,
|
|
20861
21048
|
paragraphs
|
|
20862
21049
|
}), [fullDataStream, paragraphs]);
|
|
21050
|
+
const headingParagraphs = useMemo(() => paragraphs.filter((p) => {
|
|
21051
|
+
var _p$paragraphStyle;
|
|
21052
|
+
return ((_p$paragraphStyle = p.paragraphStyle) === null || _p$paragraphStyle === void 0 ? void 0 : _p$paragraphStyle.namedStyleType) !== void 0 && p.paragraphStyle.namedStyleType !== NamedStyleType.SUBTITLE && p.paragraphStyle.namedStyleType !== NamedStyleType.NORMAL_TEXT;
|
|
21053
|
+
}).map((p) => p.paragraphId ? p : {
|
|
21054
|
+
...p,
|
|
21055
|
+
paragraphId: `__paragraph_${p.startIndex}`
|
|
21056
|
+
}), [paragraphs]);
|
|
20863
21057
|
const paragraphMap = useMemo(() => {
|
|
20864
21058
|
const map = /* @__PURE__ */ new Map();
|
|
20865
|
-
|
|
21059
|
+
headingParagraphs.forEach((p) => {
|
|
20866
21060
|
map.set(p.startIndex, p);
|
|
20867
21061
|
});
|
|
20868
21062
|
return map;
|
|
20869
|
-
}, [
|
|
20870
|
-
const mode = left <
|
|
20871
|
-
const paragraphMenus =
|
|
20872
|
-
var _p$paragraphStyle;
|
|
20873
|
-
return ((_p$paragraphStyle = p.paragraphStyle) === null || _p$paragraphStyle === void 0 ? void 0 : _p$paragraphStyle.namedStyleType) !== void 0 && p.paragraphStyle.namedStyleType !== NamedStyleType.SUBTITLE && p.paragraphStyle.namedStyleType !== NamedStyleType.NORMAL_TEXT;
|
|
20874
|
-
}).map((p) => {
|
|
21063
|
+
}, [headingParagraphs]);
|
|
21064
|
+
const mode = left < 288 || layout.overlapsTable ? "float" : "side-bar";
|
|
21065
|
+
const paragraphMenus = headingParagraphs.map((p) => {
|
|
20875
21066
|
var _p$paragraphStyle2;
|
|
20876
21067
|
const level = transformNamedStyleTypeToLevel(p.paragraphStyle.namedStyleType);
|
|
20877
21068
|
return {
|
|
20878
|
-
id: p.
|
|
21069
|
+
id: p.paragraphId,
|
|
20879
21070
|
text: getPlainText(fullDataStream.slice(paragraphStarts.get(p.startIndex), p.startIndex)),
|
|
20880
21071
|
level,
|
|
20881
21072
|
isTitle: ((_p$paragraphStyle2 = p.paragraphStyle) === null || _p$paragraphStyle2 === void 0 ? void 0 : _p$paragraphStyle2.namedStyleType) === NamedStyleType.TITLE
|
|
@@ -20884,7 +21075,7 @@ function DocSideMenuContent() {
|
|
|
20884
21075
|
const handleScroll = useEvent((params) => {
|
|
20885
21076
|
const scrollTop = params.viewportScrollY;
|
|
20886
21077
|
const bottom = scrollTop + canvasHeight / scaleY;
|
|
20887
|
-
const activeId = findActiveHeading(paragraphBounds, paragraphMap, scrollTop, bottom);
|
|
21078
|
+
const activeId = findActiveHeading(docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.paragraphBounds, paragraphMap, scrollTop, bottom);
|
|
20888
21079
|
if (activeId) setActiveId(activeId);
|
|
20889
21080
|
});
|
|
20890
21081
|
const menus = (paragraphMenus === null || paragraphMenus === void 0 ? void 0 : paragraphMenus.find((p) => p.isTitle)) ? paragraphMenus : [...title ? [{
|
|
@@ -20893,7 +21084,32 @@ function DocSideMenuContent() {
|
|
|
20893
21084
|
level: 1,
|
|
20894
21085
|
isTitle: true
|
|
20895
21086
|
}] : [], ...paragraphMenus ?? []].filter(Boolean);
|
|
20896
|
-
const
|
|
21087
|
+
const outlineTitle = (_menus$find = menus.find((menu) => menu.isTitle)) === null || _menus$find === void 0 ? void 0 : _menus$find.text;
|
|
21088
|
+
useLayoutEffect(() => {
|
|
21089
|
+
setOutlineHeight(0);
|
|
21090
|
+
}, [
|
|
21091
|
+
unitId,
|
|
21092
|
+
menus.length,
|
|
21093
|
+
outlineTitle
|
|
21094
|
+
]);
|
|
21095
|
+
useLayoutEffect(() => {
|
|
21096
|
+
const container = containerRef.current;
|
|
21097
|
+
const menu = container === null || container === void 0 ? void 0 : container.firstElementChild;
|
|
21098
|
+
if (!container || !menu) return;
|
|
21099
|
+
const measureOutline = () => {
|
|
21100
|
+
var _container$querySelec;
|
|
21101
|
+
const height = (_container$querySelec = container.querySelector("nav")) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.getBoundingClientRect().height;
|
|
21102
|
+
if (height) setOutlineHeight(height);
|
|
21103
|
+
};
|
|
21104
|
+
const observer = new ResizeObserver(measureOutline);
|
|
21105
|
+
observer.observe(menu);
|
|
21106
|
+
return () => observer.disconnect();
|
|
21107
|
+
}, [
|
|
21108
|
+
mode,
|
|
21109
|
+
unitId,
|
|
21110
|
+
menus.length,
|
|
21111
|
+
enabled
|
|
21112
|
+
]);
|
|
20897
21113
|
useEffect(() => {
|
|
20898
21114
|
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
|
|
20899
21115
|
if (!viewport) return;
|
|
@@ -20910,31 +21126,27 @@ function DocSideMenuContent() {
|
|
|
20910
21126
|
setActiveId(menu.id);
|
|
20911
21127
|
return;
|
|
20912
21128
|
}
|
|
20913
|
-
const paragraph =
|
|
20914
|
-
var _p$paragraphStyle3;
|
|
20915
|
-
return ((_p$paragraphStyle3 = p.paragraphStyle) === null || _p$paragraphStyle3 === void 0 ? void 0 : _p$paragraphStyle3.headingId) === menu.id;
|
|
20916
|
-
});
|
|
21129
|
+
const paragraph = headingParagraphs.find((p) => p.paragraphId === menu.id);
|
|
20917
21130
|
if (!paragraph) return;
|
|
20918
|
-
const bound =
|
|
21131
|
+
const bound = docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.paragraphBounds.get(paragraph.startIndex);
|
|
20919
21132
|
if (!bound) return;
|
|
20920
21133
|
viewport.scrollToViewportPos({ viewportScrollY: bound.rect.top });
|
|
20921
21134
|
setActiveId(menu.id);
|
|
20922
21135
|
});
|
|
20923
|
-
if (!currentDoc || isInternalEditorID(unitId) || !(menus === null || menus === void 0 ? void 0 : menus.length)) return null;
|
|
21136
|
+
if (!enabled || !currentDoc || isInternalEditorID(unitId) || !(menus === null || menus === void 0 ? void 0 : menus.length)) return null;
|
|
20924
21137
|
return /* @__PURE__ */ jsx("div", {
|
|
21138
|
+
ref: containerRef,
|
|
20925
21139
|
className: "univer-absolute univer-bottom-0 univer-left-0 univer-top-0 univer-z-[100] univer-w-[0px]",
|
|
20926
21140
|
children: /* @__PURE__ */ jsx(SideMenu, {
|
|
20927
21141
|
label: localeService.t("docs-ui.outline.title"),
|
|
20928
21142
|
menus,
|
|
20929
|
-
open,
|
|
20930
|
-
onOpenChange: setOpen,
|
|
20931
21143
|
mode,
|
|
20932
21144
|
maxWidth: Math.max(0, Math.floor(mode === "float" ? canvasWidth : left) - 24),
|
|
20933
21145
|
wrapperClass: "univer-mt-4",
|
|
20934
21146
|
activeId,
|
|
20935
21147
|
onClick: handleClick,
|
|
20936
21148
|
maxHeight: Math.max(0, canvasHeight - 32)
|
|
20937
|
-
})
|
|
21149
|
+
}, mode)
|
|
20938
21150
|
});
|
|
20939
21151
|
}
|
|
20940
21152
|
|
|
@@ -21312,7 +21524,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
|
|
|
21312
21524
|
//#endregion
|
|
21313
21525
|
//#region package.json
|
|
21314
21526
|
var name = "@univerjs/docs-ui";
|
|
21315
|
-
var version = "1.0
|
|
21527
|
+
var version = "1.2.0";
|
|
21316
21528
|
|
|
21317
21529
|
//#endregion
|
|
21318
21530
|
//#region src/commands/commands/doc-paragraph-setting.command.ts
|
|
@@ -22174,7 +22386,7 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
|
|
|
22174
22386
|
}
|
|
22175
22387
|
_deferUnmaterializedCursorMove(doc, skeleton, offset, segmentId, resume) {
|
|
22176
22388
|
var _skeleton$getSkeleton, _render$getInjector, _doc$getBody;
|
|
22177
|
-
if (segmentId !== "") return false;
|
|
22389
|
+
if (segmentId !== "" || skeleton.getViewModel().getCollapsedHeadingAtOffset(offset)) return false;
|
|
22178
22390
|
const pageIndex = skeleton.findBodyPageIndexByCharIndex(offset);
|
|
22179
22391
|
const page = (_skeleton$getSkeleton = skeleton.getSkeletonData()) === null || _skeleton$getSkeleton === void 0 ? void 0 : _skeleton$getSkeleton.pages[pageIndex];
|
|
22180
22392
|
if (pageIndex >= 0 && !(page === null || page === void 0 ? void 0 : page.isMaterializationPlaceholder)) return false;
|
|
@@ -22283,6 +22495,13 @@ let DocMoveCursorController = class DocMoveCursorController extends Disposable {
|
|
|
22283
22495
|
const visited = /* @__PURE__ */ new Set();
|
|
22284
22496
|
while (current >= 0 && current < dataStream.length && !visited.has(current)) {
|
|
22285
22497
|
visited.add(current);
|
|
22498
|
+
if (!segmentId) {
|
|
22499
|
+
const hidden = skeleton.getViewModel().getCollapsedHeadingAtOffset(current);
|
|
22500
|
+
if (hidden) {
|
|
22501
|
+
current = step < 0 ? hidden.paragraphIndex : hidden.endOffset;
|
|
22502
|
+
continue;
|
|
22503
|
+
}
|
|
22504
|
+
}
|
|
22286
22505
|
const normalizedCursor = this._normalizeCursorOffset(dataStream, customRanges, current, direction);
|
|
22287
22506
|
if (normalizedCursor < 0 || normalizedCursor >= dataStream.length) return;
|
|
22288
22507
|
if (this._isRenderableCursorOffset(skeleton, dataStream, normalizedCursor, segmentId, segmentPage)) return normalizedCursor;
|
|
@@ -24500,6 +24719,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
24500
24719
|
H5Icon,
|
|
24501
24720
|
HeaderFooterIcon,
|
|
24502
24721
|
HorizontallyIcon,
|
|
24722
|
+
InsertBelowDoubleIcon,
|
|
24503
24723
|
InsertDoubleIcon,
|
|
24504
24724
|
InsertRowAboveDoubleIcon,
|
|
24505
24725
|
InsertRowBelowDoubleIcon,
|
|
@@ -24532,6 +24752,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
24532
24752
|
TodoListDoubleIcon,
|
|
24533
24753
|
UnderlineIcon,
|
|
24534
24754
|
UnorderIcon,
|
|
24755
|
+
ZoomInIcon,
|
|
24535
24756
|
DefaultTextColorIcon,
|
|
24536
24757
|
HeaderTextColorIcon,
|
|
24537
24758
|
MoreRightIcon,
|
|
@@ -28280,6 +28501,10 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28280
28501
|
var _this$_paragraphMenu2;
|
|
28281
28502
|
return ((_this$_paragraphMenu2 = this._paragraphMenu) === null || _this$_paragraphMenu2 === void 0 ? void 0 : _this$_paragraphMenu2.target) ?? null;
|
|
28282
28503
|
}
|
|
28504
|
+
get focusedTableTarget() {
|
|
28505
|
+
var _this$_focusedTableMe;
|
|
28506
|
+
return ((_this$_focusedTableMe = this._focusedTableMenu) === null || _this$_focusedTableMe === void 0 ? void 0 : _this$_focusedTableMe.target) ?? null;
|
|
28507
|
+
}
|
|
28283
28508
|
setBlockMenuDragging(isDragging) {
|
|
28284
28509
|
this._isBlockMenuDragging = isDragging;
|
|
28285
28510
|
if (isDragging) this._dragInteraction ??= this._docLayoutInteractionService.beginInteraction();
|
|
@@ -28307,6 +28532,11 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28307
28532
|
_defineProperty(this, "_paragraphMenu", null);
|
|
28308
28533
|
_defineProperty(this, "_activeTarget$", new BehaviorSubject(null));
|
|
28309
28534
|
_defineProperty(this, "activeTarget$", this._activeTarget$.asObservable());
|
|
28535
|
+
_defineProperty(this, "_focusedTableMenu", null);
|
|
28536
|
+
_defineProperty(this, "_focusedTableTarget$", new BehaviorSubject(null));
|
|
28537
|
+
_defineProperty(this, "focusedTableTarget$", this._focusedTableTarget$.asObservable());
|
|
28538
|
+
_defineProperty(this, "_focusedTableMenuDismiss$", new Subject());
|
|
28539
|
+
_defineProperty(this, "focusedTableMenuDismiss$", this._focusedTableMenuDismiss$.asObservable());
|
|
28310
28540
|
_defineProperty(this, "_slashMenuRequest$", new BehaviorSubject(null));
|
|
28311
28541
|
_defineProperty(this, "slashMenuRequest$", this._slashMenuRequest$.asObservable());
|
|
28312
28542
|
_defineProperty(this, "_isBlockMenuDragging", false);
|
|
@@ -28322,6 +28552,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28322
28552
|
this._isBlockMenuDragging = false;
|
|
28323
28553
|
this.hideParagraphMenu(true);
|
|
28324
28554
|
}
|
|
28555
|
+
if (this._focusedTableMenu && !this._canEditDocument(this._focusedTableMenu.target.menuRange)) this.hideFocusedTableMenu();
|
|
28325
28556
|
}));
|
|
28326
28557
|
}
|
|
28327
28558
|
_isCursorInActiveParagraph() {
|
|
@@ -28358,9 +28589,11 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28358
28589
|
_hasExpandedSelection() {
|
|
28359
28590
|
return this._hasExpandedSelectionRanges(this._docSelectionManagerService.getDocRanges());
|
|
28360
28591
|
}
|
|
28361
|
-
setParagraphMenuActive(active) {
|
|
28362
|
-
|
|
28363
|
-
|
|
28592
|
+
setParagraphMenuActive(active, focusedTable = false) {
|
|
28593
|
+
var _this$_paragraphMenu3, _this$_focusedTableMe2;
|
|
28594
|
+
const menu = focusedTable ? this._focusedTableMenu : this._paragraphMenu;
|
|
28595
|
+
if (menu) menu.active = active;
|
|
28596
|
+
if (((_this$_paragraphMenu3 = this._paragraphMenu) === null || _this$_paragraphMenu3 === void 0 ? void 0 : _this$_paragraphMenu3.active) || ((_this$_focusedTableMe2 = this._focusedTableMenu) === null || _this$_focusedTableMe2 === void 0 ? void 0 : _this$_focusedTableMe2.active)) this._menuInteraction ??= this._docLayoutInteractionService.beginInteraction();
|
|
28364
28597
|
else {
|
|
28365
28598
|
var _this$_menuInteractio;
|
|
28366
28599
|
(_this$_menuInteractio = this._menuInteraction) === null || _this$_menuInteractio === void 0 || _this$_menuInteractio.dispose();
|
|
@@ -28369,7 +28602,9 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28369
28602
|
}
|
|
28370
28603
|
_init() {
|
|
28371
28604
|
const handleHoverTarget = (paragraph, tableBound) => {
|
|
28605
|
+
var _this$_focusedTableMe3;
|
|
28372
28606
|
if (this._isBlockMenuDragging) return;
|
|
28607
|
+
if ((_this$_focusedTableMe3 = this._focusedTableMenu) === null || _this$_focusedTableMe3 === void 0 ? void 0 : _this$_focusedTableMe3.active) return;
|
|
28373
28608
|
if (this._docSelectionRenderService.isOnPointerEvent) {
|
|
28374
28609
|
this.hideParagraphMenu(true);
|
|
28375
28610
|
return;
|
|
@@ -28380,18 +28615,18 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28380
28615
|
return;
|
|
28381
28616
|
}
|
|
28382
28617
|
if (selectionState.hasRectRange) {
|
|
28383
|
-
var _this$
|
|
28618
|
+
var _this$_paragraphMenu4;
|
|
28384
28619
|
if (tableBound) {
|
|
28385
28620
|
this.showTableMenu(tableBound);
|
|
28386
28621
|
return;
|
|
28387
28622
|
}
|
|
28388
|
-
if (((_this$
|
|
28623
|
+
if (((_this$_paragraphMenu4 = this._paragraphMenu) === null || _this$_paragraphMenu4 === void 0 ? void 0 : _this$_paragraphMenu4.target.kind) === DocumentBlockType.TABLE) return;
|
|
28389
28624
|
this.hideParagraphMenu(true);
|
|
28390
28625
|
return;
|
|
28391
28626
|
}
|
|
28392
28627
|
if (this._docSkeletonManagerService.getViewModel().getEditArea() === DocumentEditArea.BODY && !this._floatMenuService.floatMenu && !this._context.unit.getDisabled() && this._canEditDocument()) {
|
|
28393
|
-
var _this$
|
|
28394
|
-
if ((_this$
|
|
28628
|
+
var _this$_paragraphMenu5;
|
|
28629
|
+
if ((_this$_paragraphMenu5 = this._paragraphMenu) === null || _this$_paragraphMenu5 === void 0 ? void 0 : _this$_paragraphMenu5.active) return;
|
|
28395
28630
|
if (paragraph) {
|
|
28396
28631
|
this.showParagraphMenu(paragraph);
|
|
28397
28632
|
return;
|
|
@@ -28417,16 +28652,17 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28417
28652
|
this.hideParagraphMenu(true);
|
|
28418
28653
|
}));
|
|
28419
28654
|
this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe(({ textRanges, rectRanges }) => {
|
|
28420
|
-
var _this$
|
|
28655
|
+
var _this$_paragraphMenu6;
|
|
28421
28656
|
const selectionState = this._getExpandedSelectionState([...textRanges, ...rectRanges]);
|
|
28422
|
-
if (selectionState.hasExpandedTextRange || selectionState.hasRectRange && ((_this$
|
|
28657
|
+
if (selectionState.hasExpandedTextRange || selectionState.hasRectRange && ((_this$_paragraphMenu6 = this._paragraphMenu) === null || _this$_paragraphMenu6 === void 0 ? void 0 : _this$_paragraphMenu6.target.kind) !== DocumentBlockType.TABLE) this.hideParagraphMenu(true);
|
|
28423
28658
|
}));
|
|
28424
28659
|
let lastScrollY = 0;
|
|
28425
28660
|
this.disposeWithMe(this._context.scene.getViewport("viewMain").onScrollAfter$.subscribeEvent((e) => {
|
|
28426
|
-
var _this$
|
|
28661
|
+
var _this$_paragraphMenu7;
|
|
28427
28662
|
if (lastScrollY === e.scrollY) return;
|
|
28428
28663
|
lastScrollY = e.scrollY;
|
|
28429
|
-
|
|
28664
|
+
this._focusedTableMenuDismiss$.next();
|
|
28665
|
+
if ((_this$_paragraphMenu7 = this._paragraphMenu) === null || _this$_paragraphMenu7 === void 0 ? void 0 : _this$_paragraphMenu7.blockRange) return;
|
|
28430
28666
|
if (this._isBlockMenuDragging) return;
|
|
28431
28667
|
this.hideParagraphMenu(true);
|
|
28432
28668
|
}));
|
|
@@ -28437,6 +28673,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28437
28673
|
this.disposeWithMe(this._docSelectionRenderService.onKeydown$.subscribe((config) => {
|
|
28438
28674
|
if (this._isBlockMenuDragging) return;
|
|
28439
28675
|
if (this._handleSlashMenuKeydown(config)) return;
|
|
28676
|
+
this._focusedTableMenuDismiss$.next();
|
|
28440
28677
|
this.hideParagraphMenu(true);
|
|
28441
28678
|
}));
|
|
28442
28679
|
this.disposeWithMe(this._docSelectionRenderService.onInputBefore$.subscribe((config) => {
|
|
@@ -28492,10 +28729,10 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28492
28729
|
return null;
|
|
28493
28730
|
}
|
|
28494
28731
|
_getSlashMenuParagraph(config) {
|
|
28495
|
-
var _this$
|
|
28732
|
+
var _this$_paragraphMenu8;
|
|
28496
28733
|
const activeRange = this._getCollapsedTextRange(config);
|
|
28497
28734
|
const offset = activeRange === null || activeRange === void 0 ? void 0 : activeRange.startOffset;
|
|
28498
|
-
const activeParagraph = ((_this$
|
|
28735
|
+
const activeParagraph = ((_this$_paragraphMenu8 = this._paragraphMenu) === null || _this$_paragraphMenu8 === void 0 ? void 0 : _this$_paragraphMenu8.paragraph) ?? null;
|
|
28499
28736
|
if (activeParagraph && offset != null && offset >= activeParagraph.paragraphStart && offset <= activeParagraph.paragraphEnd) return activeParagraph;
|
|
28500
28737
|
if (activeParagraph && offset == null) return activeParagraph;
|
|
28501
28738
|
if (offset == null) return null;
|
|
@@ -28516,7 +28753,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28516
28753
|
}
|
|
28517
28754
|
}
|
|
28518
28755
|
showParagraphMenu(paragraph) {
|
|
28519
|
-
var _this$
|
|
28756
|
+
var _this$_paragraphMenu9;
|
|
28520
28757
|
if (this._hasExpandedSelection()) {
|
|
28521
28758
|
this.hideParagraphMenu(true);
|
|
28522
28759
|
return;
|
|
@@ -28526,15 +28763,21 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28526
28763
|
this.hideParagraphMenu(true);
|
|
28527
28764
|
return;
|
|
28528
28765
|
}
|
|
28529
|
-
if (((_this$
|
|
28766
|
+
if (((_this$_paragraphMenu9 = this._paragraphMenu) === null || _this$_paragraphMenu9 === void 0 ? void 0 : _this$_paragraphMenu9.target.key) === target.key) return;
|
|
28530
28767
|
this.hideParagraphMenu(true);
|
|
28531
28768
|
const targetParagraph = target.paragraph ?? paragraph;
|
|
28532
28769
|
const blockRange = target.blockRange;
|
|
28533
28770
|
const getFirstLine = () => {
|
|
28771
|
+
var _this$_context$unit$g;
|
|
28534
28772
|
const latestParagraphBound = this._docEventManagerService.findParagraphBoundByIndex(targetParagraph.startIndex) ?? targetParagraph;
|
|
28535
28773
|
const baseAnchor = blockRange ? getBlockRangeAnchorRect(this._docEventManagerService, blockRange, paragraph) : latestParagraphBound.firstLine ?? paragraph.firstLine;
|
|
28536
|
-
|
|
28537
|
-
|
|
28774
|
+
const menuAnchor = ((_this$_context$unit$g = this._context.unit.getSnapshot().documentStyle) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.documentFlavor) === DocumentFlavor.MODERN && this._docSkeletonManagerService.getViewModel().getHeadingSections().some((heading) => heading.paragraphIndex === targetParagraph.startIndex && heading.startOffset < heading.endOffset) ? {
|
|
28775
|
+
...baseAnchor,
|
|
28776
|
+
left: baseAnchor.left - 24,
|
|
28777
|
+
right: baseAnchor.right - 24
|
|
28778
|
+
} : baseAnchor;
|
|
28779
|
+
if (!target.cellRange) return menuAnchor;
|
|
28780
|
+
return getTableCellParagraphAnchorRect(this._docEventManagerService, latestParagraphBound, menuAnchor);
|
|
28538
28781
|
};
|
|
28539
28782
|
const disposable = this._docPopupManagerService.attachPopupToRect(getFirstLine, {
|
|
28540
28783
|
componentKey: DOC_PARAGRAPH_MENU_COMPONENT_KEY,
|
|
@@ -28561,15 +28804,19 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28561
28804
|
};
|
|
28562
28805
|
this._activeTarget$.next(target);
|
|
28563
28806
|
}
|
|
28564
|
-
showTableMenu(tableBound) {
|
|
28565
|
-
var _body$tables, _this$
|
|
28566
|
-
if (this.
|
|
28807
|
+
showTableMenu(tableBound, focused = false) {
|
|
28808
|
+
var _this$_focusedTableMe4, _body$tables, _this$_paragraphMenu10;
|
|
28809
|
+
if (!focused && ((_this$_focusedTableMe4 = this._focusedTableMenu) === null || _this$_focusedTableMe4 === void 0 || (_this$_focusedTableMe4 = _this$_focusedTableMe4.target.table) === null || _this$_focusedTableMe4 === void 0 ? void 0 : _this$_focusedTableMe4.tableId) === tableBound.tableId) return;
|
|
28810
|
+
if (!focused && this._hasExpandedTextSelection()) {
|
|
28567
28811
|
this.hideParagraphMenu(true);
|
|
28568
28812
|
return;
|
|
28569
28813
|
}
|
|
28570
28814
|
const body = this._context.unit.getBody();
|
|
28571
28815
|
const table = body === null || body === void 0 || (_body$tables = body.tables) === null || _body$tables === void 0 ? void 0 : _body$tables.find((item) => item.tableId === tableBound.tableId);
|
|
28572
|
-
if (!table)
|
|
28816
|
+
if (!table) {
|
|
28817
|
+
if (focused) this.hideFocusedTableMenu();
|
|
28818
|
+
return;
|
|
28819
|
+
}
|
|
28573
28820
|
const target = {
|
|
28574
28821
|
kind: DocumentBlockType.TABLE,
|
|
28575
28822
|
key: `${DocumentBlockType.TABLE}:${table.tableId}`,
|
|
@@ -28582,17 +28829,21 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28582
28829
|
},
|
|
28583
28830
|
moveRange: {
|
|
28584
28831
|
startOffset: table.startIndex,
|
|
28585
|
-
endOffset: table.endIndex
|
|
28832
|
+
endOffset: table.endIndex + ((body === null || body === void 0 ? void 0 : body.dataStream[table.endIndex]) === "\r" ? 1 : 0)
|
|
28586
28833
|
},
|
|
28587
28834
|
emptyMode: false,
|
|
28588
28835
|
draggable: true
|
|
28589
28836
|
};
|
|
28590
28837
|
if (!this._canEditDocument(target.menuRange)) {
|
|
28838
|
+
if (focused) {
|
|
28839
|
+
this.hideFocusedTableMenu();
|
|
28840
|
+
return;
|
|
28841
|
+
}
|
|
28591
28842
|
this.hideParagraphMenu(true);
|
|
28592
28843
|
return;
|
|
28593
28844
|
}
|
|
28594
|
-
if (this._shouldKeepCurrentCellMenuForTable(table)) return;
|
|
28595
|
-
if (((_this$
|
|
28845
|
+
if (!focused && this._shouldKeepCurrentCellMenuForTable(table)) return;
|
|
28846
|
+
if (!focused && ((_this$_paragraphMenu10 = this._paragraphMenu) === null || _this$_paragraphMenu10 === void 0 ? void 0 : _this$_paragraphMenu10.target.key) === target.key) return;
|
|
28596
28847
|
const anchorRect = getTableAnchorRect(tableBound);
|
|
28597
28848
|
const paragraph = {
|
|
28598
28849
|
rect: tableBound.rect,
|
|
@@ -28603,8 +28854,16 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28603
28854
|
pageIndex: tableBound.pageIndex,
|
|
28604
28855
|
firstLine: anchorRect
|
|
28605
28856
|
};
|
|
28857
|
+
if (focused) {
|
|
28858
|
+
target.paragraph = paragraph;
|
|
28859
|
+
this._showFocusedTableMenu(tableBound, target);
|
|
28860
|
+
return;
|
|
28861
|
+
}
|
|
28862
|
+
this._showHoverTableMenu(tableBound, target, paragraph);
|
|
28863
|
+
}
|
|
28864
|
+
_showHoverTableMenu(tableBound, target, paragraph) {
|
|
28606
28865
|
this.hideParagraphMenu(true);
|
|
28607
|
-
const getFirstLine = () => getTableAnchorRect(this._docEventManagerService.tableBounds.get(
|
|
28866
|
+
const getFirstLine = () => getTableAnchorRect(this._docEventManagerService.tableBounds.get(tableBound.tableId) ?? tableBound);
|
|
28608
28867
|
const disposable = this._docPopupManagerService.attachPopupToRect(getFirstLine, {
|
|
28609
28868
|
componentKey: DOC_TABLE_BLOCK_MENU_COMPONENT_KEY,
|
|
28610
28869
|
constrainToCanvas: true,
|
|
@@ -28623,9 +28882,40 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28623
28882
|
};
|
|
28624
28883
|
this._activeTarget$.next(target);
|
|
28625
28884
|
}
|
|
28885
|
+
_showFocusedTableMenu(tableBound, target) {
|
|
28886
|
+
var _this$_focusedTableMe5, _this$_paragraphMenu11;
|
|
28887
|
+
if (((_this$_focusedTableMe5 = this._focusedTableMenu) === null || _this$_focusedTableMe5 === void 0 ? void 0 : _this$_focusedTableMe5.target.key) === target.key) {
|
|
28888
|
+
this._focusedTableMenu.target = target;
|
|
28889
|
+
this._focusedTableMenu.bound = tableBound;
|
|
28890
|
+
this._focusedTableTarget$.next(target);
|
|
28891
|
+
return;
|
|
28892
|
+
}
|
|
28893
|
+
this.hideFocusedTableMenu();
|
|
28894
|
+
if (((_this$_paragraphMenu11 = this._paragraphMenu) === null || _this$_paragraphMenu11 === void 0 ? void 0 : _this$_paragraphMenu11.target.key) === target.key) this.hideParagraphMenu(true);
|
|
28895
|
+
const getFocusedAnchor = () => {
|
|
28896
|
+
var _this$_focusedTableMe6;
|
|
28897
|
+
return getTableAnchorRect(this._docEventManagerService.tableBounds.get(tableBound.tableId) ?? ((_this$_focusedTableMe6 = this._focusedTableMenu) === null || _this$_focusedTableMe6 === void 0 ? void 0 : _this$_focusedTableMe6.bound) ?? tableBound);
|
|
28898
|
+
};
|
|
28899
|
+
const disposable = this._docPopupManagerService.attachPopupToRect(getFocusedAnchor, {
|
|
28900
|
+
componentKey: DOC_TABLE_BLOCK_MENU_COMPONENT_KEY,
|
|
28901
|
+
extraProps: { focusedTableMenu: true },
|
|
28902
|
+
constrainToCanvas: true,
|
|
28903
|
+
requiresStableLayout: false,
|
|
28904
|
+
direction: "top-right",
|
|
28905
|
+
onClickOutside: () => this._focusedTableMenuDismiss$.next(),
|
|
28906
|
+
zIndex: 102
|
|
28907
|
+
}, this._context.unitId);
|
|
28908
|
+
this._focusedTableMenu = {
|
|
28909
|
+
target,
|
|
28910
|
+
bound: tableBound,
|
|
28911
|
+
disposable,
|
|
28912
|
+
active: false
|
|
28913
|
+
};
|
|
28914
|
+
this._focusedTableTarget$.next(target);
|
|
28915
|
+
}
|
|
28626
28916
|
_shouldKeepCurrentCellMenuForTable(table) {
|
|
28627
|
-
var _this$
|
|
28628
|
-
const target = (_this$
|
|
28917
|
+
var _this$_paragraphMenu12;
|
|
28918
|
+
const target = (_this$_paragraphMenu12 = this._paragraphMenu) === null || _this$_paragraphMenu12 === void 0 ? void 0 : _this$_paragraphMenu12.target;
|
|
28629
28919
|
if (!target || target.kind === DocumentBlockType.TABLE || !target.cellRange) return false;
|
|
28630
28920
|
return target.cellRange.startOffset >= table.startIndex && target.cellRange.startOffset <= table.endIndex;
|
|
28631
28921
|
}
|
|
@@ -28668,22 +28958,32 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28668
28958
|
hideParagraphMenu(force = false) {
|
|
28669
28959
|
if (this._isBlockMenuDragging) return;
|
|
28670
28960
|
if (this._paragraphMenu && (this._paragraphMenu.disposable.canDispose() || force)) {
|
|
28671
|
-
var _this$_menuInteractio2;
|
|
28672
28961
|
this._paragraphMenu.disposable.dispose();
|
|
28673
28962
|
this._paragraphMenu = null;
|
|
28674
|
-
|
|
28675
|
-
this._menuInteraction = null;
|
|
28963
|
+
this.setParagraphMenuActive(false);
|
|
28676
28964
|
this._isSlashMenuActive = false;
|
|
28677
28965
|
this._slashMenuRequest$.next(null);
|
|
28678
28966
|
this._activeTarget$.next(null);
|
|
28679
28967
|
}
|
|
28680
28968
|
}
|
|
28969
|
+
hideFocusedTableMenu() {
|
|
28970
|
+
var _this$_focusedTableMe7;
|
|
28971
|
+
(_this$_focusedTableMe7 = this._focusedTableMenu) === null || _this$_focusedTableMe7 === void 0 || _this$_focusedTableMe7.disposable.dispose();
|
|
28972
|
+
this._focusedTableMenu = null;
|
|
28973
|
+
this._focusedTableTarget$.next(null);
|
|
28974
|
+
this.setParagraphMenuActive(false, true);
|
|
28975
|
+
}
|
|
28681
28976
|
_canEditDocument(range, segmentId = "") {
|
|
28682
28977
|
return canEditDocumentTargets(this._permissionService, this._context.unitId, range ? getDocumentEditTargetObjectIds(this._context.unit, segmentId, range) : []);
|
|
28683
28978
|
}
|
|
28684
28979
|
dispose() {
|
|
28685
|
-
var _this$
|
|
28686
|
-
|
|
28980
|
+
var _this$_menuInteractio2, _this$_dragInteractio2;
|
|
28981
|
+
this._isBlockMenuDragging = false;
|
|
28982
|
+
this.hideFocusedTableMenu();
|
|
28983
|
+
this.hideParagraphMenu(true);
|
|
28984
|
+
this._focusedTableTarget$.complete();
|
|
28985
|
+
this._focusedTableMenuDismiss$.complete();
|
|
28986
|
+
(_this$_menuInteractio2 = this._menuInteraction) === null || _this$_menuInteractio2 === void 0 || _this$_menuInteractio2.dispose();
|
|
28687
28987
|
this._menuInteraction = null;
|
|
28688
28988
|
(_this$_dragInteractio2 = this._dragInteraction) === null || _this$_dragInteractio2 === void 0 || _this$_dragInteractio2.dispose();
|
|
28689
28989
|
this._dragInteraction = null;
|
|
@@ -29015,9 +29315,6 @@ function createParagraphMenuHoverOpenScheduler(openMenu, delay = 800) {
|
|
|
29015
29315
|
}
|
|
29016
29316
|
};
|
|
29017
29317
|
}
|
|
29018
|
-
function setParagraphMenuInteractionActive(docParagraphMenuService, active) {
|
|
29019
|
-
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(active);
|
|
29020
|
-
}
|
|
29021
29318
|
function isEmptyParagraphMenuTarget(dataStream, paragraph) {
|
|
29022
29319
|
if (!paragraph) return false;
|
|
29023
29320
|
return dataStream.slice(paragraph.paragraphStart, paragraph.paragraphEnd).replace(/[\r\n]/g, "") === "";
|
|
@@ -29427,7 +29724,7 @@ function getBlockRangeClipboardTargetRange(commandId, target, paragraph) {
|
|
|
29427
29724
|
return null;
|
|
29428
29725
|
}
|
|
29429
29726
|
function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
29430
|
-
var _doc$getBody, _paragraphObj$paragra;
|
|
29727
|
+
var _popup$extraProps, _doc$getBody, _paragraphObj$paragra;
|
|
29431
29728
|
const [visible, setVisible] = useState(false);
|
|
29432
29729
|
const [openMode, setOpenMode] = useState("pointer");
|
|
29433
29730
|
const [anchorRect, setAnchorRect] = useState(null);
|
|
@@ -29436,10 +29733,12 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29436
29733
|
const targetRangeRef = useRef(null);
|
|
29437
29734
|
const dragTargetOffsetRef = useRef(null);
|
|
29438
29735
|
const dragRangeRef = useRef(null);
|
|
29736
|
+
const dragCleanupRef = useRef(null);
|
|
29439
29737
|
const isDraggingRef = useRef(false);
|
|
29440
29738
|
const openMenuRef = useRef(() => void 0);
|
|
29441
29739
|
const hoverOpenSchedulerRef = useRef(createParagraphMenuHoverOpenScheduler(() => openMenuRef.current()));
|
|
29442
29740
|
const commandService = useDependency(ICommandService);
|
|
29741
|
+
const logService = useDependency(ILogService);
|
|
29443
29742
|
const localeService = useDependency(LocaleService);
|
|
29444
29743
|
const themeService = useDependency(ThemeService);
|
|
29445
29744
|
const docSelectionManagerService = useDependency(DocSelectionManagerService);
|
|
@@ -29460,12 +29759,20 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29460
29759
|
const doc = univerInstanceService.getUnit(popup.unitId, UniverInstanceType.UNIVER_DOC);
|
|
29461
29760
|
const docParagraphMenuService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocParagraphMenuService);
|
|
29462
29761
|
const docEventManagerService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocEventManagerService);
|
|
29463
|
-
const
|
|
29762
|
+
const isFocusedTableMenu = ((_popup$extraProps = popup.extraProps) === null || _popup$extraProps === void 0 ? void 0 : _popup$extraProps.focusedTableMenu) === true;
|
|
29763
|
+
const activeTarget = useObservable(isFocusedTableMenu ? docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.focusedTableTarget$ : docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget$);
|
|
29464
29764
|
const slashMenuRequest = useObservable(docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.slashMenuRequest$);
|
|
29465
29765
|
const paragraph = useObservable(docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.hoverParagraph$);
|
|
29466
29766
|
const paragraphLeft = useObservable(docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.hoverParagraphLeft$);
|
|
29467
|
-
const
|
|
29468
|
-
|
|
29767
|
+
const getActiveTarget = () => {
|
|
29768
|
+
if (isFocusedTableMenu) return (docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.focusedTableTarget) ?? activeTarget;
|
|
29769
|
+
return (docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget) ?? activeTarget;
|
|
29770
|
+
};
|
|
29771
|
+
const setMenuInteractionActive = (active) => {
|
|
29772
|
+
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(active, isFocusedTableMenu);
|
|
29773
|
+
};
|
|
29774
|
+
const rawActiveTarget = getActiveTarget();
|
|
29775
|
+
const currentActiveTarget = (rawActiveTarget === null || rawActiveTarget === void 0 ? void 0 : rawActiveTarget.kind) === "table" === tableBlockOnly ? rawActiveTarget : null;
|
|
29469
29776
|
const activeParagraphBound = (currentActiveTarget === null || currentActiveTarget === void 0 ? void 0 : currentActiveTarget.paragraph) ?? (docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeParagraph) ?? paragraph ?? paragraphLeft;
|
|
29470
29777
|
const startIndex = activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.startIndex;
|
|
29471
29778
|
const dataStream = (doc === null || doc === void 0 || (_doc$getBody = doc.getBody()) === null || _doc$getBody === void 0 ? void 0 : _doc$getBody.dataStream) ?? "";
|
|
@@ -29475,6 +29782,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29475
29782
|
}, [doc, startIndex]);
|
|
29476
29783
|
const isEmptyParagraph = (currentActiveTarget === null || currentActiveTarget === void 0 ? void 0 : currentActiveTarget.emptyMode) ?? isEmptyParagraphMenuTarget(dataStream, activeParagraphBound);
|
|
29477
29784
|
const namedStyleType = paragraphObj === null || paragraphObj === void 0 || (_paragraphObj$paragra = paragraphObj.paragraphStyle) === null || _paragraphObj$paragra === void 0 ? void 0 : _paragraphObj$paragra.namedStyleType;
|
|
29785
|
+
const isModernHeading = (doc === null || doc === void 0 ? void 0 : doc.getDocumentStyle().documentFlavor) === DocumentFlavor.MODERN && startIndex != null && (renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocSkeletonManagerService).getViewModel().getHeadingSections().some((heading) => heading.paragraphIndex === startIndex && heading.startOffset < heading.endOffset));
|
|
29478
29786
|
const targetIconKey = (currentActiveTarget === null || currentActiveTarget === void 0 ? void 0 : currentActiveTarget.icon) ?? getParagraphMenuTriggerIconKey(namedStyleType);
|
|
29479
29787
|
const TargetIcon = iconManager.get(targetIconKey);
|
|
29480
29788
|
const paragraphMenuType = useMemo(() => getParagraphMenuType(currentActiveTarget, isEmptyParagraph), [currentActiveTarget, isEmptyParagraph]);
|
|
@@ -29518,13 +29826,41 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29518
29826
|
if (activeElement === focusedElement || !focusedElement.isConnected && activeElement === body) layoutService.focus();
|
|
29519
29827
|
}, [layoutService]);
|
|
29520
29828
|
useLayoutEffect(() => restoreMenuFocus, [restoreMenuFocus]);
|
|
29521
|
-
const handleHideMenu = () => {
|
|
29829
|
+
const handleHideMenu = useCallback(() => {
|
|
29830
|
+
hoverOpenSchedulerRef.current.cancel();
|
|
29522
29831
|
restoreMenuFocus();
|
|
29523
29832
|
setVisible(false);
|
|
29524
29833
|
setOpenMode("pointer");
|
|
29525
29834
|
targetRangeRef.current = null;
|
|
29526
|
-
|
|
29527
|
-
}
|
|
29835
|
+
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(false, isFocusedTableMenu);
|
|
29836
|
+
}, [
|
|
29837
|
+
docParagraphMenuService,
|
|
29838
|
+
isFocusedTableMenu,
|
|
29839
|
+
restoreMenuFocus
|
|
29840
|
+
]);
|
|
29841
|
+
useEffect(() => {
|
|
29842
|
+
if (!isFocusedTableMenu || !docParagraphMenuService) return;
|
|
29843
|
+
const subscription = docParagraphMenuService.focusedTableMenuDismiss$.subscribe(handleHideMenu);
|
|
29844
|
+
const ownerDocument = popup.canvasElement.ownerDocument;
|
|
29845
|
+
const handleKeydown = (event) => {
|
|
29846
|
+
if (event.key === "Escape") {
|
|
29847
|
+
event.preventDefault();
|
|
29848
|
+
event.stopPropagation();
|
|
29849
|
+
handleHideMenu();
|
|
29850
|
+
}
|
|
29851
|
+
};
|
|
29852
|
+
if (visible) ownerDocument.addEventListener("keydown", handleKeydown, true);
|
|
29853
|
+
return () => {
|
|
29854
|
+
subscription.unsubscribe();
|
|
29855
|
+
ownerDocument.removeEventListener("keydown", handleKeydown, true);
|
|
29856
|
+
};
|
|
29857
|
+
}, [
|
|
29858
|
+
docParagraphMenuService,
|
|
29859
|
+
isFocusedTableMenu,
|
|
29860
|
+
handleHideMenu,
|
|
29861
|
+
popup.canvasElement,
|
|
29862
|
+
visible
|
|
29863
|
+
]);
|
|
29528
29864
|
const clearHideTimer = () => {
|
|
29529
29865
|
if (hideTimerRef.current != null) {
|
|
29530
29866
|
window.clearTimeout(hideTimerRef.current);
|
|
@@ -29542,8 +29878,8 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29542
29878
|
const handleOpenMenu = (mode = "pointer") => {
|
|
29543
29879
|
clearHideTimer();
|
|
29544
29880
|
if (openMode === "slash") return;
|
|
29545
|
-
const latestTarget = (
|
|
29546
|
-
|
|
29881
|
+
const latestTarget = getActiveTarget();
|
|
29882
|
+
setMenuInteractionActive(true);
|
|
29547
29883
|
const targetRange = latestTarget ? {
|
|
29548
29884
|
...latestTarget.menuRange,
|
|
29549
29885
|
segmentId: activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.segmentId
|
|
@@ -29591,7 +29927,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29591
29927
|
return commandService.executeCommand(resolved.commandId, resolved.params);
|
|
29592
29928
|
};
|
|
29593
29929
|
const unwrapActiveBlockRange = async () => {
|
|
29594
|
-
const latestTarget = (
|
|
29930
|
+
const latestTarget = getActiveTarget();
|
|
29595
29931
|
if (!latestTarget || latestTarget.kind !== "blockRange" || !latestTarget.blockRange || !(doc === null || doc === void 0 ? void 0 : doc.getBody())) return null;
|
|
29596
29932
|
const previousBody = doc.getBody();
|
|
29597
29933
|
const { body, range } = unwrapBlockRangeBody(previousBody, latestTarget.blockRange);
|
|
@@ -29614,7 +29950,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29614
29950
|
return nextRange;
|
|
29615
29951
|
};
|
|
29616
29952
|
const executeParagraphMenuOption = async (option) => {
|
|
29617
|
-
const latestTarget = (
|
|
29953
|
+
const latestTarget = getActiveTarget();
|
|
29618
29954
|
const targetRange = getTargetSelectionRange(latestTarget, activeParagraphBound ?? void 0);
|
|
29619
29955
|
const blockRange = getBlockSelectionRange(latestTarget, activeParagraphBound ?? void 0);
|
|
29620
29956
|
const formattingRange = getParagraphFormattingRange(latestTarget, activeParagraphBound ?? void 0);
|
|
@@ -29718,31 +30054,38 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29718
30054
|
const hoverBridgeStyle = visible && (menuDirection === "left" || menuDirection === "right") ? getParagraphMenuHoverBridgeStyle(anchorRect, menuDirection) : void 0;
|
|
29719
30055
|
const resolvedParagraphMenuType = openMode === "slash" ? DOC_PARAGRAPH_T_INSERT_MENU_ID : paragraphMenuType;
|
|
29720
30056
|
useEffect(() => () => {
|
|
30057
|
+
var _dragCleanupRef$curre;
|
|
30058
|
+
(_dragCleanupRef$curre = dragCleanupRef.current) === null || _dragCleanupRef$curre === void 0 || _dragCleanupRef$curre.call(dragCleanupRef);
|
|
29721
30059
|
if (hideTimerRef.current != null) {
|
|
29722
30060
|
window.clearTimeout(hideTimerRef.current);
|
|
29723
30061
|
hideTimerRef.current = null;
|
|
29724
30062
|
}
|
|
29725
30063
|
hoverOpenSchedulerRef.current.cancel();
|
|
29726
|
-
|
|
29727
|
-
}, []);
|
|
30064
|
+
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(false, isFocusedTableMenu);
|
|
30065
|
+
}, [docParagraphMenuService, isFocusedTableMenu]);
|
|
29728
30066
|
useEffect(() => {
|
|
29729
|
-
if (!slashMenuRequest || handledSlashRequestNonceRef.current >= slashMenuRequest.nonce) return;
|
|
30067
|
+
if (tableBlockOnly || !slashMenuRequest || handledSlashRequestNonceRef.current >= slashMenuRequest.nonce) return;
|
|
29730
30068
|
handledSlashRequestNonceRef.current = slashMenuRequest.nonce;
|
|
29731
30069
|
hoverOpenSchedulerRef.current.cancel();
|
|
29732
30070
|
clearHideTimer();
|
|
29733
30071
|
isMouseOver.current = false;
|
|
29734
30072
|
handleOpenSlashMenu(slashMenuRequest);
|
|
29735
|
-
}, [slashMenuRequest]);
|
|
30073
|
+
}, [slashMenuRequest, tableBlockOnly]);
|
|
29736
30074
|
if (!currentActiveTarget) return null;
|
|
29737
30075
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29738
30076
|
/* @__PURE__ */ jsxs("div", {
|
|
29739
30077
|
"data-u-comp": "paragraph-menu",
|
|
30078
|
+
"data-u-table-menu": tableBlockOnly ? "true" : void 0,
|
|
30079
|
+
"data-u-focused-table-menu": isFocusedTableMenu ? "true" : void 0,
|
|
29740
30080
|
ref: anchorRef,
|
|
29741
|
-
className: clsx("univer-
|
|
30081
|
+
className: clsx("univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 univer-px-2 univer-py-0 univer-shadow-sm univer-transition-colors hover:univer-bg-gray-50 hover:univer-shadow-md dark:!univer-border-gray-600 dark:!univer-bg-gray-900 dark:hover:!univer-bg-gray-800", {
|
|
30082
|
+
"univer-mr-1": !isModernHeading,
|
|
30083
|
+
"univer-bg-gray-100 univer-shadow-md dark:!univer-bg-gray-800": visible
|
|
30084
|
+
}),
|
|
29742
30085
|
onMouseEnter: (e) => {
|
|
29743
30086
|
var _popup$onPointerEnter;
|
|
29744
30087
|
(_popup$onPointerEnter = popup.onPointerEnter) === null || _popup$onPointerEnter === void 0 || _popup$onPointerEnter.call(popup, e);
|
|
29745
|
-
|
|
30088
|
+
setMenuInteractionActive(true);
|
|
29746
30089
|
isMouseOver.current = true;
|
|
29747
30090
|
scheduleOpenMenu();
|
|
29748
30091
|
},
|
|
@@ -29764,7 +30107,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29764
30107
|
title: localeService.t("docs-ui.doc.blockMenu.dragBlock"),
|
|
29765
30108
|
onPointerDown: (event) => {
|
|
29766
30109
|
var _event$currentTarget$, _event$currentTarget;
|
|
29767
|
-
const latestTarget = (
|
|
30110
|
+
const latestTarget = getActiveTarget();
|
|
29768
30111
|
const moveRange = latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.moveRange;
|
|
29769
30112
|
if (!moveRange || !(latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.draggable)) return;
|
|
29770
30113
|
event.preventDefault();
|
|
@@ -29792,6 +30135,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29792
30135
|
window.removeEventListener("pointerup", handlePointerUp);
|
|
29793
30136
|
window.removeEventListener("pointercancel", handlePointerCancel);
|
|
29794
30137
|
window.removeEventListener("blur", handleWindowBlur);
|
|
30138
|
+
dragCleanupRef.current = null;
|
|
29795
30139
|
const range = dragRangeRef.current;
|
|
29796
30140
|
const targetOffset = dragTargetOffsetRef.current;
|
|
29797
30141
|
dragRangeRef.current = null;
|
|
@@ -29807,7 +30151,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29807
30151
|
unitId: popup.unitId,
|
|
29808
30152
|
sourceRange: range,
|
|
29809
30153
|
targetOffset
|
|
29810
|
-
});
|
|
30154
|
+
}).catch((error) => logService.error(error));
|
|
29811
30155
|
};
|
|
29812
30156
|
const handlePointerUp = (upEvent) => {
|
|
29813
30157
|
if (upEvent.pointerId !== pointerId) return;
|
|
@@ -29821,6 +30165,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29821
30165
|
const handleWindowBlur = () => {
|
|
29822
30166
|
finishDrag(false);
|
|
29823
30167
|
};
|
|
30168
|
+
dragCleanupRef.current = () => finishDrag(false);
|
|
29824
30169
|
window.addEventListener("pointermove", handlePointerMove);
|
|
29825
30170
|
window.addEventListener("pointerup", handlePointerUp);
|
|
29826
30171
|
window.addEventListener("pointercancel", handlePointerCancel);
|
|
@@ -29836,7 +30181,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29836
30181
|
onMouseEnter: (e) => {
|
|
29837
30182
|
var _popup$onPointerEnter2;
|
|
29838
30183
|
(_popup$onPointerEnter2 = popup.onPointerEnter) === null || _popup$onPointerEnter2 === void 0 || _popup$onPointerEnter2.call(popup, e);
|
|
29839
|
-
|
|
30184
|
+
setMenuInteractionActive(true);
|
|
29840
30185
|
isMouseOver.current = true;
|
|
29841
30186
|
clearHideTimer();
|
|
29842
30187
|
},
|
|
@@ -29859,7 +30204,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29859
30204
|
onMouseEnter: (e) => {
|
|
29860
30205
|
var _popup$onPointerEnter3;
|
|
29861
30206
|
(_popup$onPointerEnter3 = popup.onPointerEnter) === null || _popup$onPointerEnter3 === void 0 || _popup$onPointerEnter3.call(popup, e);
|
|
29862
|
-
|
|
30207
|
+
setMenuInteractionActive(true);
|
|
29863
30208
|
isMouseOver.current = true;
|
|
29864
30209
|
clearHideTimer();
|
|
29865
30210
|
},
|
|
@@ -29877,7 +30222,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29877
30222
|
autoFocusTarget: openMode === "slash" ? "container" : void 0,
|
|
29878
30223
|
suppressHoverUntilPointerMove: openMode === "slash",
|
|
29879
30224
|
onMenuPointerEnter: () => {
|
|
29880
|
-
|
|
30225
|
+
setMenuInteractionActive(true);
|
|
29881
30226
|
isMouseOver.current = true;
|
|
29882
30227
|
clearHideTimer();
|
|
29883
30228
|
},
|
|
@@ -29891,7 +30236,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29891
30236
|
onOptionSelect: async (params) => {
|
|
29892
30237
|
const targetRange = targetRangeRef.current ?? getParagraphMenuTargetRange(activeParagraphBound);
|
|
29893
30238
|
const { commandId, params: commandParams } = getParagraphMenuCommand(params, targetRange);
|
|
29894
|
-
const latestTarget = (
|
|
30239
|
+
const latestTarget = getActiveTarget();
|
|
29895
30240
|
if ((latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.kind) === "table" && commandId && targetRange) {
|
|
29896
30241
|
univerInstanceService.focusUnit(popup.unitId);
|
|
29897
30242
|
const tableRange = {
|
|
@@ -30034,6 +30379,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
30034
30379
|
H5Icon,
|
|
30035
30380
|
HeaderFooterIcon,
|
|
30036
30381
|
HorizontallyIcon,
|
|
30382
|
+
InsertBelowDoubleIcon,
|
|
30037
30383
|
InsertDoubleIcon,
|
|
30038
30384
|
InsertRowAboveDoubleIcon,
|
|
30039
30385
|
InsertRowBelowDoubleIcon,
|
|
@@ -30067,6 +30413,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
30067
30413
|
TodoListDoubleIcon,
|
|
30068
30414
|
UnderlineIcon,
|
|
30069
30415
|
UnorderIcon,
|
|
30416
|
+
ZoomInIcon,
|
|
30070
30417
|
DefaultTextColorIcon,
|
|
30071
30418
|
HeaderTextColorIcon,
|
|
30072
30419
|
MoreRightIcon,
|
|
@@ -30594,6 +30941,289 @@ let DocContextualRibbonService = class DocContextualRibbonService extends Dispos
|
|
|
30594
30941
|
};
|
|
30595
30942
|
DocContextualRibbonService = __decorate([__decorateParam(0, IRibbonService)], DocContextualRibbonService);
|
|
30596
30943
|
|
|
30944
|
+
//#endregion
|
|
30945
|
+
//#region src/views/heading-collapse-shape.ts
|
|
30946
|
+
var HeadingCollapseShape = class extends Shape {
|
|
30947
|
+
constructor(key, colors, activate) {
|
|
30948
|
+
super(key, {
|
|
30949
|
+
width: 24,
|
|
30950
|
+
height: 28,
|
|
30951
|
+
debounceParentDirty: false
|
|
30952
|
+
});
|
|
30953
|
+
_defineProperty(this, "_collapsed", false);
|
|
30954
|
+
_defineProperty(this, "_label", "");
|
|
30955
|
+
_defineProperty(this, "_colors", void 0);
|
|
30956
|
+
_defineProperty(this, "_hovered", false);
|
|
30957
|
+
_defineProperty(this, "_tooltipVisible", false);
|
|
30958
|
+
_defineProperty(this, "_tooltipTimer", null);
|
|
30959
|
+
_defineProperty(this, "_pressed", false);
|
|
30960
|
+
this._colors = colors;
|
|
30961
|
+
this.cursor = CURSOR_TYPE.POINTER;
|
|
30962
|
+
this.disposeWithMe(this.onPointerEnter$.subscribeEvent((event) => {
|
|
30963
|
+
if (this._hovered || event.buttons) return;
|
|
30964
|
+
this._hovered = true;
|
|
30965
|
+
this._tooltipTimer = setTimeout(() => {
|
|
30966
|
+
this._tooltipTimer = null;
|
|
30967
|
+
this._tooltipVisible = true;
|
|
30968
|
+
this.makeDirty(true);
|
|
30969
|
+
}, 500);
|
|
30970
|
+
this.makeDirty(true);
|
|
30971
|
+
}));
|
|
30972
|
+
this.disposeWithMe(this.onPointerLeave$.subscribeEvent(() => this.resetHover()));
|
|
30973
|
+
this.disposeWithMe(this.onPointerDown$.subscribeEvent((event, state) => {
|
|
30974
|
+
state.stopPropagation();
|
|
30975
|
+
event.preventDefault();
|
|
30976
|
+
this._pressed = event.button === 0;
|
|
30977
|
+
}));
|
|
30978
|
+
this.disposeWithMe(this.onPointerUp$.subscribeEvent((event, state) => {
|
|
30979
|
+
state.stopPropagation();
|
|
30980
|
+
event.preventDefault();
|
|
30981
|
+
const activateButton = this._pressed && event.button === 0;
|
|
30982
|
+
this._pressed = false;
|
|
30983
|
+
this._hideTooltip();
|
|
30984
|
+
if (activateButton) activate();
|
|
30985
|
+
}));
|
|
30986
|
+
this.disposeWithMe(this.onClick$.subscribeEvent((_event, state) => state.stopPropagation()));
|
|
30987
|
+
this.disposeWithMe(this.onDblclick$.subscribeEvent((_event, state) => state.stopPropagation()));
|
|
30988
|
+
}
|
|
30989
|
+
update(collapsed, label, colors) {
|
|
30990
|
+
if (collapsed === this._collapsed && label === this._label && colors === this._colors) return;
|
|
30991
|
+
this._collapsed = collapsed;
|
|
30992
|
+
this._label = label;
|
|
30993
|
+
this._colors = colors;
|
|
30994
|
+
this.makeDirty(true);
|
|
30995
|
+
}
|
|
30996
|
+
resetHover() {
|
|
30997
|
+
this._hideTooltip();
|
|
30998
|
+
this._pressed = false;
|
|
30999
|
+
if (this._hovered) {
|
|
31000
|
+
this._hovered = false;
|
|
31001
|
+
this.makeDirty(true);
|
|
31002
|
+
}
|
|
31003
|
+
}
|
|
31004
|
+
_hideTooltip() {
|
|
31005
|
+
if (this._tooltipTimer !== null) {
|
|
31006
|
+
clearTimeout(this._tooltipTimer);
|
|
31007
|
+
this._tooltipTimer = null;
|
|
31008
|
+
}
|
|
31009
|
+
if (this._tooltipVisible) {
|
|
31010
|
+
this._tooltipVisible = false;
|
|
31011
|
+
this.makeDirty(true);
|
|
31012
|
+
}
|
|
31013
|
+
}
|
|
31014
|
+
_draw(ctx, bounds) {
|
|
31015
|
+
ctx.fillStyle = this._hovered ? this._colors.hover : this._colors.normal;
|
|
31016
|
+
ctx.beginPath();
|
|
31017
|
+
if (this._collapsed) {
|
|
31018
|
+
ctx.moveTo(9, 8);
|
|
31019
|
+
ctx.lineTo(16, 14);
|
|
31020
|
+
ctx.lineTo(9, 20);
|
|
31021
|
+
} else {
|
|
31022
|
+
ctx.moveTo(6, 11);
|
|
31023
|
+
ctx.lineTo(18, 11);
|
|
31024
|
+
ctx.lineTo(12, 18);
|
|
31025
|
+
}
|
|
31026
|
+
ctx.closePath();
|
|
31027
|
+
ctx.fill();
|
|
31028
|
+
if (!this._tooltipVisible) return;
|
|
31029
|
+
ctx.save();
|
|
31030
|
+
ctx.font = "12px sans-serif";
|
|
31031
|
+
const width = ctx.measureText(this._label).width + 20;
|
|
31032
|
+
const viewport = bounds === null || bounds === void 0 ? void 0 : bounds.viewBound;
|
|
31033
|
+
const centeredLeft = (this.width - width) / 2;
|
|
31034
|
+
const left = viewport ? Math.max(viewport.left - this.left, Math.min(centeredLeft, viewport.right - this.left - width)) : centeredLeft;
|
|
31035
|
+
const below = viewport != null && this.top - 36 < viewport.top;
|
|
31036
|
+
ctx.translate(left, below ? this.height + 8 : -36);
|
|
31037
|
+
Rect.drawWith(ctx, {
|
|
31038
|
+
width,
|
|
31039
|
+
height: 28,
|
|
31040
|
+
radius: 6,
|
|
31041
|
+
fill: this._colors.tooltipBackground
|
|
31042
|
+
});
|
|
31043
|
+
ctx.fillStyle = this._colors.tooltipBackground;
|
|
31044
|
+
ctx.beginPath();
|
|
31045
|
+
const arrow = this.width / 2 - left;
|
|
31046
|
+
const arrowBase = below ? 0 : 28;
|
|
31047
|
+
ctx.moveTo(arrow - 4, arrowBase);
|
|
31048
|
+
ctx.lineTo(arrow, below ? -4 : 32);
|
|
31049
|
+
ctx.lineTo(arrow + 4, arrowBase);
|
|
31050
|
+
ctx.fill();
|
|
31051
|
+
ctx.fillStyle = this._colors.tooltipText;
|
|
31052
|
+
ctx.textAlign = "center";
|
|
31053
|
+
ctx.textBaseline = "middle";
|
|
31054
|
+
ctx.fillText(this._label, width / 2, 14);
|
|
31055
|
+
ctx.restore();
|
|
31056
|
+
}
|
|
31057
|
+
dispose() {
|
|
31058
|
+
this.resetHover();
|
|
31059
|
+
super.dispose();
|
|
31060
|
+
}
|
|
31061
|
+
};
|
|
31062
|
+
|
|
31063
|
+
//#endregion
|
|
31064
|
+
//#region src/services/doc-heading-collapse.service.ts
|
|
31065
|
+
let DocHeadingCollapseService = class DocHeadingCollapseService extends Disposable {
|
|
31066
|
+
constructor(_context, _skeletonManager, _eventManager, _selections, _commandService, _layoutService, themeService, localeService) {
|
|
31067
|
+
super();
|
|
31068
|
+
this._context = _context;
|
|
31069
|
+
this._skeletonManager = _skeletonManager;
|
|
31070
|
+
this._eventManager = _eventManager;
|
|
31071
|
+
this._selections = _selections;
|
|
31072
|
+
this._commandService = _commandService;
|
|
31073
|
+
this._layoutService = _layoutService;
|
|
31074
|
+
_defineProperty(this, "_buttons", /* @__PURE__ */ new Map());
|
|
31075
|
+
_defineProperty(this, "_colors", void 0);
|
|
31076
|
+
_defineProperty(this, "_expandLabel", "");
|
|
31077
|
+
_defineProperty(this, "_collapseLabel", "");
|
|
31078
|
+
this._colors = this._getColors(themeService);
|
|
31079
|
+
if (isInternalEditorID(_context.unitId)) return;
|
|
31080
|
+
this.disposeWithMe(themeService.currentTheme$.subscribe(() => {
|
|
31081
|
+
this._colors = this._getColors(themeService);
|
|
31082
|
+
this._update();
|
|
31083
|
+
}));
|
|
31084
|
+
this.disposeWithMe(localeService.currentLocale$.subscribe(() => {
|
|
31085
|
+
this._expandLabel = localeService.t("docs-ui.heading.expand");
|
|
31086
|
+
this._collapseLabel = localeService.t("docs-ui.heading.collapse");
|
|
31087
|
+
this._update();
|
|
31088
|
+
}));
|
|
31089
|
+
this.disposeWithMe(_context.scene.beforeRender$.subscribe(() => this._update()));
|
|
31090
|
+
this.disposeWithMe(this._skeletonManager.currentSkeleton$.subscribe(() => this._update()));
|
|
31091
|
+
this.disposeWithMe(this._skeletonManager.getSkeleton().dirty$.subscribe(() => this._update()));
|
|
31092
|
+
const resetHover = () => this._buttons.forEach((button) => button.resetHover());
|
|
31093
|
+
const viewport = _context.scene.getViewport("viewMain");
|
|
31094
|
+
if (viewport) {
|
|
31095
|
+
let scrollX = viewport.viewportScrollX;
|
|
31096
|
+
let scrollY = viewport.viewportScrollY;
|
|
31097
|
+
this.disposeWithMe(viewport.onScrollAfter$.subscribeEvent((event) => {
|
|
31098
|
+
if (event.viewportScrollX !== scrollX || event.viewportScrollY !== scrollY) {
|
|
31099
|
+
resetHover();
|
|
31100
|
+
scrollX = event.viewportScrollX;
|
|
31101
|
+
scrollY = event.viewportScrollY;
|
|
31102
|
+
}
|
|
31103
|
+
}));
|
|
31104
|
+
}
|
|
31105
|
+
this.disposeWithMe(_context.scene.onPointerCancel$.subscribeEvent(resetHover));
|
|
31106
|
+
this.disposeWithMe(_context.scene.onTransformChange$.subscribeEvent(({ value, preValue }) => {
|
|
31107
|
+
if (value.scaleX != null && value.scaleX !== preValue.scaleX || value.scaleY != null && value.scaleY !== preValue.scaleY) resetHover();
|
|
31108
|
+
}));
|
|
31109
|
+
this.disposeWithMe(_context.scene.onPointerLeave$.subscribeEvent(resetHover));
|
|
31110
|
+
this.disposeWithMe(this._selections.textSelection$.subscribe(({ unitId }) => {
|
|
31111
|
+
if (unitId === _context.unitId) this._normalizeSelection();
|
|
31112
|
+
}));
|
|
31113
|
+
}
|
|
31114
|
+
_getColors(themeService) {
|
|
31115
|
+
return {
|
|
31116
|
+
normal: themeService.getColorFromTheme("gray.900"),
|
|
31117
|
+
hover: themeService.getColorFromTheme("primary.600"),
|
|
31118
|
+
tooltipBackground: themeService.getColorFromTheme("gray.700"),
|
|
31119
|
+
tooltipText: themeService.getColorFromTheme("gray.0")
|
|
31120
|
+
};
|
|
31121
|
+
}
|
|
31122
|
+
_normalizeSelection() {
|
|
31123
|
+
const target = {
|
|
31124
|
+
unitId: this._context.unitId,
|
|
31125
|
+
subUnitId: this._context.unitId
|
|
31126
|
+
};
|
|
31127
|
+
const info = this._selections.getSelectionInfo(target);
|
|
31128
|
+
if (!info || info.segmentId) return;
|
|
31129
|
+
const viewModel = this._skeletonManager.getViewModel();
|
|
31130
|
+
const hiddenRect = info.rectRanges.find((range) => !range.segmentId && range.startOffset != null && viewModel.getCollapsedHeadingAtOffset(range.startOffset));
|
|
31131
|
+
if ((hiddenRect === null || hiddenRect === void 0 ? void 0 : hiddenRect.startOffset) != null) {
|
|
31132
|
+
const offset = viewModel.getCollapsedHeadingAtOffset(hiddenRect.startOffset).paragraphIndex;
|
|
31133
|
+
const textRanges = [{
|
|
31134
|
+
startOffset: offset,
|
|
31135
|
+
endOffset: offset,
|
|
31136
|
+
collapsed: true,
|
|
31137
|
+
isActive: true
|
|
31138
|
+
}];
|
|
31139
|
+
this._selections.replaceSelectionInfoWithoutRefresh({
|
|
31140
|
+
...info,
|
|
31141
|
+
textRanges,
|
|
31142
|
+
rectRanges: []
|
|
31143
|
+
}, target);
|
|
31144
|
+
this._selections.replaceDocRanges(textRanges, target, false, { forceFocus: false });
|
|
31145
|
+
return;
|
|
31146
|
+
}
|
|
31147
|
+
let changed = false;
|
|
31148
|
+
const textRanges = info.textRanges.map((range) => {
|
|
31149
|
+
var _viewModel$getCollaps, _viewModel$getCollaps2;
|
|
31150
|
+
if (range.segmentId) return range;
|
|
31151
|
+
const startOffset = ((_viewModel$getCollaps = viewModel.getCollapsedHeadingAtOffset(range.startOffset)) === null || _viewModel$getCollaps === void 0 ? void 0 : _viewModel$getCollaps.paragraphIndex) ?? range.startOffset;
|
|
31152
|
+
const endOffset = ((_viewModel$getCollaps2 = viewModel.getCollapsedHeadingAtOffset(range.endOffset)) === null || _viewModel$getCollaps2 === void 0 ? void 0 : _viewModel$getCollaps2.paragraphIndex) ?? range.endOffset;
|
|
31153
|
+
if (startOffset === range.startOffset && endOffset === range.endOffset) return range;
|
|
31154
|
+
changed = true;
|
|
31155
|
+
return {
|
|
31156
|
+
...range,
|
|
31157
|
+
startOffset,
|
|
31158
|
+
endOffset,
|
|
31159
|
+
collapsed: startOffset === endOffset,
|
|
31160
|
+
startNodePosition: void 0,
|
|
31161
|
+
endNodePosition: void 0
|
|
31162
|
+
};
|
|
31163
|
+
});
|
|
31164
|
+
if (changed) {
|
|
31165
|
+
this._selections.replaceSelectionInfoWithoutRefresh({
|
|
31166
|
+
...info,
|
|
31167
|
+
textRanges
|
|
31168
|
+
}, target);
|
|
31169
|
+
this._selections.replaceDocRanges([...textRanges, ...info.rectRanges], target, false, { forceFocus: false });
|
|
31170
|
+
}
|
|
31171
|
+
}
|
|
31172
|
+
_update() {
|
|
31173
|
+
this._normalizeSelection();
|
|
31174
|
+
const active = /* @__PURE__ */ new Set();
|
|
31175
|
+
const viewModel = this._skeletonManager.getViewModel();
|
|
31176
|
+
if (this._context.unit.getSnapshot().documentStyle.documentFlavor === DocumentFlavor.MODERN) for (const heading of viewModel.getHeadingSections()) {
|
|
31177
|
+
if (heading.startOffset >= heading.endOffset || viewModel.getCollapsedHeadingAtOffset(heading.paragraphIndex)) continue;
|
|
31178
|
+
const bound = this._eventManager.findParagraphBoundByIndex(heading.paragraphIndex);
|
|
31179
|
+
if (!bound || bound.segmentId) continue;
|
|
31180
|
+
active.add(heading.paragraphId);
|
|
31181
|
+
let button = this._buttons.get(heading.paragraphId);
|
|
31182
|
+
if (!button) {
|
|
31183
|
+
button = new HeadingCollapseShape(`__DocHeadingCollapse__${heading.paragraphId}`, this._colors, () => {
|
|
31184
|
+
var _this$_context$unit$g;
|
|
31185
|
+
const paragraph = (_this$_context$unit$g = this._context.unit.getBody()) === null || _this$_context$unit$g === void 0 || (_this$_context$unit$g = _this$_context$unit$g.paragraphs) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.find((item) => item.paragraphId === heading.paragraphId);
|
|
31186
|
+
if (paragraph && this._commandService.syncExecuteCommand(SetHeadingCollapsedCommand.id, {
|
|
31187
|
+
unitId: this._context.unitId,
|
|
31188
|
+
paragraphId: heading.paragraphId,
|
|
31189
|
+
collapsed: paragraph.headingCollapsed !== true
|
|
31190
|
+
})) this._layoutService.focus(this._context.unitId);
|
|
31191
|
+
});
|
|
31192
|
+
this._buttons.set(heading.paragraphId, button);
|
|
31193
|
+
this._context.scene.addObject(button, 3);
|
|
31194
|
+
}
|
|
31195
|
+
const left = bound.firstLine.left - button.width;
|
|
31196
|
+
const top = (bound.firstLine.top + bound.firstLine.bottom - button.height) / 2;
|
|
31197
|
+
if (button.left !== left || button.top !== top) {
|
|
31198
|
+
button.resetHover();
|
|
31199
|
+
button.transformByState({
|
|
31200
|
+
left,
|
|
31201
|
+
top
|
|
31202
|
+
});
|
|
31203
|
+
}
|
|
31204
|
+
button.update(heading.collapsed, heading.collapsed ? this._expandLabel : this._collapseLabel, this._colors);
|
|
31205
|
+
}
|
|
31206
|
+
for (const [id, button] of this._buttons) if (!active.has(id)) {
|
|
31207
|
+
button.dispose();
|
|
31208
|
+
this._buttons.delete(id);
|
|
31209
|
+
}
|
|
31210
|
+
}
|
|
31211
|
+
dispose() {
|
|
31212
|
+
super.dispose();
|
|
31213
|
+
this._buttons.forEach((button) => button.dispose());
|
|
31214
|
+
this._buttons.clear();
|
|
31215
|
+
}
|
|
31216
|
+
};
|
|
31217
|
+
DocHeadingCollapseService = __decorate([
|
|
31218
|
+
__decorateParam(1, Inject(DocSkeletonManagerService)),
|
|
31219
|
+
__decorateParam(2, Inject(DocEventManagerService)),
|
|
31220
|
+
__decorateParam(3, Inject(DocSelectionManagerService)),
|
|
31221
|
+
__decorateParam(4, ICommandService),
|
|
31222
|
+
__decorateParam(5, ILayoutService),
|
|
31223
|
+
__decorateParam(6, Inject(ThemeService)),
|
|
31224
|
+
__decorateParam(7, Inject(LocaleService))
|
|
31225
|
+
], DocHeadingCollapseService);
|
|
31226
|
+
|
|
30597
31227
|
//#endregion
|
|
30598
31228
|
//#region src/shortcuts/core-editing.shortcut.ts
|
|
30599
31229
|
const BreakLineShortcut = {
|
|
@@ -31018,6 +31648,7 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends Plugin {
|
|
|
31018
31648
|
[DocFloatMenuService],
|
|
31019
31649
|
[DocPasteOptionsRenderController],
|
|
31020
31650
|
[DocParagraphMenuService],
|
|
31651
|
+
[DocHeadingCollapseService],
|
|
31021
31652
|
[DocHeaderFooterController],
|
|
31022
31653
|
[DocHeaderFooterRibbonController],
|
|
31023
31654
|
[DocResizeRenderController],
|
|
@@ -31222,6 +31853,35 @@ const mobileButtonClassName = `
|
|
|
31222
31853
|
`;
|
|
31223
31854
|
const activeButtonClassName = "univer-bg-primary-100 univer-text-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-primary-400";
|
|
31224
31855
|
function MobileRichTextToolbar({ editorId, className }) {
|
|
31856
|
+
function resolveToolbarState(editor, defaultTextColor) {
|
|
31857
|
+
var _style$ul, _style$st, _style$cl;
|
|
31858
|
+
const body = editor === null || editor === void 0 ? void 0 : editor.getDocumentData().body;
|
|
31859
|
+
const ranges = (editor === null || editor === void 0 ? void 0 : editor.getSelectionRanges()) ?? [];
|
|
31860
|
+
const range = ranges.find((item) => item.isActive) ?? ranges[0];
|
|
31861
|
+
if (!body || !range) return {
|
|
31862
|
+
bold: false,
|
|
31863
|
+
italic: false,
|
|
31864
|
+
underline: false,
|
|
31865
|
+
strike: false,
|
|
31866
|
+
color: defaultTextColor,
|
|
31867
|
+
bulletList: false,
|
|
31868
|
+
orderList: false
|
|
31869
|
+
};
|
|
31870
|
+
const style = getStyleInTextRange(body, range, {});
|
|
31871
|
+
const listTypes = BuildTextUtils.range.getParagraphsInRanges([range], body.paragraphs ?? [], body.dataStream).map((paragraph) => {
|
|
31872
|
+
var _paragraph$bullet;
|
|
31873
|
+
return (_paragraph$bullet = paragraph.bullet) === null || _paragraph$bullet === void 0 ? void 0 : _paragraph$bullet.listType;
|
|
31874
|
+
}).filter((listType) => typeof listType === "string");
|
|
31875
|
+
return {
|
|
31876
|
+
bold: style.bl === BooleanNumber.TRUE,
|
|
31877
|
+
italic: style.it === BooleanNumber.TRUE,
|
|
31878
|
+
underline: ((_style$ul = style.ul) === null || _style$ul === void 0 ? void 0 : _style$ul.s) === BooleanNumber.TRUE,
|
|
31879
|
+
strike: ((_style$st = style.st) === null || _style$st === void 0 ? void 0 : _style$st.s) === BooleanNumber.TRUE,
|
|
31880
|
+
color: ((_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? defaultTextColor,
|
|
31881
|
+
bulletList: Boolean(listTypes.length && listTypes.every((listType) => listType.startsWith(PresetListType.BULLET_LIST))),
|
|
31882
|
+
orderList: Boolean(listTypes.length && listTypes.every((listType) => listType.startsWith(PresetListType.ORDER_LIST)))
|
|
31883
|
+
};
|
|
31884
|
+
}
|
|
31225
31885
|
const commandService = useDependency(ICommandService);
|
|
31226
31886
|
const editorService = useDependency(IEditorService);
|
|
31227
31887
|
const localeService = useDependency(LocaleService);
|
|
@@ -31235,12 +31895,11 @@ function MobileRichTextToolbar({ editorId, className }) {
|
|
|
31235
31895
|
return () => cancelAnimationFrame(frame);
|
|
31236
31896
|
}, [editorId, editorService]);
|
|
31237
31897
|
useEffect(() => {
|
|
31238
|
-
if (!editor) return
|
|
31898
|
+
if (!editor) return;
|
|
31239
31899
|
const subscription = merge$1(editor.input$, editor.selectionChange$).subscribe(() => setRevision((value) => value + 1));
|
|
31240
31900
|
return () => subscription.unsubscribe();
|
|
31241
31901
|
}, [editor]);
|
|
31242
|
-
const
|
|
31243
|
-
const state = resolveToolbarState(editor, defaultTextColor);
|
|
31902
|
+
const state = resolveToolbarState(editor, themeService.getColorFromTheme("gray.900"));
|
|
31244
31903
|
const colors = COLOR_TOKENS.map((token) => themeService.getColorFromTheme(token));
|
|
31245
31904
|
async function execute(commandId, params) {
|
|
31246
31905
|
const activeEditor = editorService.getEditor(editorId);
|
|
@@ -31339,18 +31998,23 @@ function MobileRichTextToolbar({ editorId, className }) {
|
|
|
31339
31998
|
style: { backgroundColor: color },
|
|
31340
31999
|
onClick: () => execute(SetInlineFormatTextColorCommand.id, { value: color })
|
|
31341
32000
|
}, color)),
|
|
31342
|
-
/* @__PURE__ */
|
|
31343
|
-
|
|
31344
|
-
|
|
31345
|
-
|
|
32001
|
+
/* @__PURE__ */ jsx(MobileDropdown, {
|
|
32002
|
+
overlay: /* @__PURE__ */ jsx("div", {
|
|
32003
|
+
className: "univer-px-4 univer-pb-2",
|
|
32004
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
32005
|
+
children: /* @__PURE__ */ jsx(MobileColorPicker, {
|
|
32006
|
+
value: state.color,
|
|
32007
|
+
onChange: (color) => execute(SetInlineFormatTextColorCommand.id, { value: color })
|
|
32008
|
+
})
|
|
32009
|
+
}),
|
|
32010
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
32011
|
+
type: "button",
|
|
32012
|
+
variant: "text",
|
|
32013
|
+
size: "icon",
|
|
31346
32014
|
"aria-label": localeService.t("docs-ui.toolbar.textColor.main"),
|
|
31347
|
-
className: "univer-
|
|
31348
|
-
|
|
31349
|
-
|
|
31350
|
-
onChange: (event) => {
|
|
31351
|
-
execute(SetInlineFormatTextColorCommand.id, { value: event.target.value });
|
|
31352
|
-
}
|
|
31353
|
-
})]
|
|
32015
|
+
className: "univer-size-7 univer-justify-self-center",
|
|
32016
|
+
children: /* @__PURE__ */ jsx(ColorWheelMultiIcon, { className: "!univer-size-6" })
|
|
32017
|
+
})
|
|
31354
32018
|
})
|
|
31355
32019
|
]
|
|
31356
32020
|
})
|
|
@@ -31369,35 +32033,6 @@ function FormatButton(props) {
|
|
|
31369
32033
|
})
|
|
31370
32034
|
});
|
|
31371
32035
|
}
|
|
31372
|
-
function resolveToolbarState(editor, defaultTextColor) {
|
|
31373
|
-
var _style$ul, _style$st, _style$cl;
|
|
31374
|
-
const body = editor === null || editor === void 0 ? void 0 : editor.getDocumentData().body;
|
|
31375
|
-
const ranges = (editor === null || editor === void 0 ? void 0 : editor.getSelectionRanges()) ?? [];
|
|
31376
|
-
const range = ranges.find((item) => item.isActive) ?? ranges[0];
|
|
31377
|
-
if (!body || !range) return {
|
|
31378
|
-
bold: false,
|
|
31379
|
-
italic: false,
|
|
31380
|
-
underline: false,
|
|
31381
|
-
strike: false,
|
|
31382
|
-
color: defaultTextColor,
|
|
31383
|
-
bulletList: false,
|
|
31384
|
-
orderList: false
|
|
31385
|
-
};
|
|
31386
|
-
const style = getStyleInTextRange(body, range, {});
|
|
31387
|
-
const listTypes = BuildTextUtils.range.getParagraphsInRanges([range], body.paragraphs ?? [], body.dataStream).map((paragraph) => {
|
|
31388
|
-
var _paragraph$bullet;
|
|
31389
|
-
return (_paragraph$bullet = paragraph.bullet) === null || _paragraph$bullet === void 0 ? void 0 : _paragraph$bullet.listType;
|
|
31390
|
-
}).filter((listType) => typeof listType === "string");
|
|
31391
|
-
return {
|
|
31392
|
-
bold: style.bl === BooleanNumber.TRUE,
|
|
31393
|
-
italic: style.it === BooleanNumber.TRUE,
|
|
31394
|
-
underline: ((_style$ul = style.ul) === null || _style$ul === void 0 ? void 0 : _style$ul.s) === BooleanNumber.TRUE,
|
|
31395
|
-
strike: ((_style$st = style.st) === null || _style$st === void 0 ? void 0 : _style$st.s) === BooleanNumber.TRUE,
|
|
31396
|
-
color: ((_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? defaultTextColor,
|
|
31397
|
-
bulletList: Boolean(listTypes.length && listTypes.every((listType) => listType.startsWith(PresetListType.BULLET_LIST))),
|
|
31398
|
-
orderList: Boolean(listTypes.length && listTypes.every((listType) => listType.startsWith(PresetListType.ORDER_LIST)))
|
|
31399
|
-
};
|
|
31400
|
-
}
|
|
31401
32036
|
|
|
31402
32037
|
//#endregion
|
|
31403
32038
|
//#region src/views/rich-text-editor/hooks/editor-undo-redo-keyboard.ts
|
|
@@ -32124,4 +32759,4 @@ function MobileRichTextEditor(props) {
|
|
|
32124
32759
|
}
|
|
32125
32760
|
|
|
32126
32761
|
//#endregion
|
|
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 };
|
|
32762
|
+
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, ParagraphSettingMenuFactory, 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 };
|