@univerjs/docs-ui 1.0.4 → 1.1.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/lib/cjs/index.js +412 -192
- package/lib/cjs/locale/ar-SA.js +2 -0
- package/lib/cjs/locale/ca-ES.js +2 -0
- package/lib/cjs/locale/de-DE.js +2 -0
- package/lib/cjs/locale/en-US.js +2 -0
- package/lib/cjs/locale/es-ES.js +2 -0
- package/lib/cjs/locale/fa-IR.js +2 -0
- package/lib/cjs/locale/fr-FR.js +2 -0
- package/lib/cjs/locale/id-ID.js +2 -0
- package/lib/cjs/locale/it-IT.js +2 -0
- package/lib/cjs/locale/ja-JP.js +2 -0
- package/lib/cjs/locale/ko-KR.js +2 -0
- package/lib/cjs/locale/pl-PL.js +2 -0
- package/lib/cjs/locale/pt-BR.js +2 -0
- package/lib/cjs/locale/ru-RU.js +2 -0
- package/lib/cjs/locale/sk-SK.js +2 -0
- package/lib/cjs/locale/vi-VN.js +2 -0
- package/lib/cjs/locale/zh-CN.js +2 -0
- package/lib/cjs/locale/zh-HK.js +2 -0
- package/lib/cjs/locale/zh-TW.js +2 -0
- package/lib/es/index.js +391 -177
- package/lib/es/locale/ar-SA.js +2 -0
- package/lib/es/locale/ca-ES.js +2 -0
- package/lib/es/locale/de-DE.js +2 -0
- package/lib/es/locale/en-US.js +2 -0
- package/lib/es/locale/es-ES.js +2 -0
- package/lib/es/locale/fa-IR.js +2 -0
- package/lib/es/locale/fr-FR.js +2 -0
- package/lib/es/locale/id-ID.js +2 -0
- package/lib/es/locale/it-IT.js +2 -0
- package/lib/es/locale/ja-JP.js +2 -0
- package/lib/es/locale/ko-KR.js +2 -0
- package/lib/es/locale/pl-PL.js +2 -0
- package/lib/es/locale/pt-BR.js +2 -0
- package/lib/es/locale/ru-RU.js +2 -0
- package/lib/es/locale/sk-SK.js +2 -0
- package/lib/es/locale/vi-VN.js +2 -0
- package/lib/es/locale/zh-CN.js +2 -0
- package/lib/es/locale/zh-HK.js +2 -0
- package/lib/es/locale/zh-TW.js +2 -0
- package/lib/index.css +5 -4
- package/lib/index.js +391 -177
- package/lib/locale/ar-SA.js +2 -0
- package/lib/locale/ca-ES.js +2 -0
- package/lib/locale/de-DE.js +2 -0
- package/lib/locale/en-US.js +2 -0
- package/lib/locale/es-ES.js +2 -0
- package/lib/locale/fa-IR.js +2 -0
- package/lib/locale/fr-FR.js +2 -0
- package/lib/locale/id-ID.js +2 -0
- package/lib/locale/it-IT.js +2 -0
- package/lib/locale/ja-JP.js +2 -0
- package/lib/locale/ko-KR.js +2 -0
- package/lib/locale/pl-PL.js +2 -0
- package/lib/locale/pt-BR.js +2 -0
- package/lib/locale/ru-RU.js +2 -0
- package/lib/locale/sk-SK.js +2 -0
- package/lib/locale/vi-VN.js +2 -0
- package/lib/locale/zh-CN.js +2 -0
- package/lib/locale/zh-HK.js +2 -0
- package/lib/locale/zh-TW.js +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/en-US.d.ts +2 -0
- package/lib/types/menu/display.menu.d.ts +21 -0
- package/lib/types/services/doc-paragraph-menu.service.d.ts +11 -2
- package/lib/types/services/doc-zoom.d.ts +4 -1
- 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 +13 -13
package/lib/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import { BaselineOffset, BlockType, BooleanNumber, BuildTextUtils, COLORS, Color
|
|
|
2
2
|
import { CreateHeaderFooterCommand, DeleteTextCommand, DocBlockMoveValidatorService, DocContentInsertService, DocHistoryAction, DocInterceptorService, DocLayoutExecutorService, DocLayoutExecutorState, DocLayoutSessionStatus, DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, DocStateEmitService, HeaderFooterType, IDocStateChangeInterceptorService, InsertDocumentColumnBreakCommand, InsertDocumentSectionBreakCommand, InsertTextCommand, RichTextEditingMutation, SetDocumentPermissionCommand, SetSectionHeaderFooterLinkCommand, SetTextSelectionsOperation, UniverDocsPlugin, UpdateDocumentSectionCommand, UpdateTextCommand, buildDocTransform, canEditDocumentTargets, consumeContentInsertRange, createSectionColumnProperties, generateParagraphs, getDocumentEditTargetObjectIds, getDocumentParagraphPermissionObjectId, getDocumentPermissionValue, getDocumentSectionPermissionObjectId, getTopLevelSectionBreaks, isSheetLikeDocsCustomBlockChildType, resolveDocsCustomBlockSize, shouldUseInlineTextSelectionForDocsCustomBlockDrawing, transformDocumentTextRanges } from "@univerjs/docs";
|
|
3
3
|
import * as EngineRender from "@univerjs/engine-render";
|
|
4
4
|
import { BaseObject, CURSOR_TYPE, DRAWING_OBJECT_UPPER_LAYER_INDEX, DeviceInputEventType, DocBackground, DocumentEditArea, DocumentSkeletonPageType, Documents, GlyphType, IRenderManagerService, Layer, LineType, Liquid, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, PageLayoutType, Path, RENDER_CLASS_TYPE, Rect, RegularPolygon, ScrollBar, ScrollTimer, Shape, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, Viewport, compareDocumentSkeletonNestedPagePathOrder, documentSkeletonLineIterator, documentSkeletonTableIterator, getColor, getDocsTableRenderViewport, getDocsTableViewportLeft, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getLastColumn, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getSystemHighlightColor, getTableIdAndSliceIndex, getTopmostDocsTableHit, hasListGlyph, isFirstGlyph, isIndentByGlyph, parseDataStreamToTree, pixelToPt, ptToPixel, pxToNum, registerDocumentLayoutPresentation } from "@univerjs/engine-render";
|
|
5
|
-
import { Button, Checkbox, 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";
|
|
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() {
|
|
@@ -3430,7 +3430,12 @@ let DocSelectionRenderService = class DocSelectionRenderService extends RxDispos
|
|
|
3430
3430
|
this._addRectRanges(rectRanges);
|
|
3431
3431
|
};
|
|
3432
3432
|
for (const range of ranges) {
|
|
3433
|
-
const {
|
|
3433
|
+
const { rangeType } = range;
|
|
3434
|
+
let { startOffset, endOffset, startNodePosition, endNodePosition } = range;
|
|
3435
|
+
if (rangeType !== DOC_RANGE_TYPE.RECT && range.direction === RANGE_DIRECTION.BACKWARD && startOffset < endOffset) {
|
|
3436
|
+
[startOffset, endOffset] = [endOffset, startOffset];
|
|
3437
|
+
[startNodePosition, endNodePosition] = [endNodePosition, startNodePosition];
|
|
3438
|
+
}
|
|
3434
3439
|
const rangeStyle = range.style ?? style;
|
|
3435
3440
|
if (rangeType !== DOC_RANGE_TYPE.RECT && startOffset === endOffset) {
|
|
3436
3441
|
const textRange = cursorConvertToTextRange(scene, {
|
|
@@ -8533,23 +8538,39 @@ function getTableClipboardBodySlice(body, range) {
|
|
|
8533
8538
|
return getTableCellContentClipboardBodySlice(body, startOffset, endOffset);
|
|
8534
8539
|
}
|
|
8535
8540
|
function getTableCellContentClipboardBodySlice(body, start, end) {
|
|
8536
|
-
var _bodySlice$textRuns, _bodySlice$
|
|
8541
|
+
var _bodySlice$textRuns, _bodySlice$docxExport;
|
|
8537
8542
|
const bodySlice = getBodySlice(body, start, end + 2);
|
|
8538
|
-
|
|
8543
|
+
const prefix = DataStreamTreeTokenType.TABLE_START + DataStreamTreeTokenType.TABLE_ROW_START + DataStreamTreeTokenType.TABLE_CELL_START;
|
|
8544
|
+
bodySlice.dataStream = prefix + bodySlice.dataStream + DataStreamTreeTokenType.TABLE_CELL_END + DataStreamTreeTokenType.TABLE_ROW_END + DataStreamTreeTokenType.TABLE_END;
|
|
8545
|
+
const offset = prefix.length;
|
|
8539
8546
|
(_bodySlice$textRuns = bodySlice.textRuns) === null || _bodySlice$textRuns === void 0 || _bodySlice$textRuns.forEach((textRun) => {
|
|
8540
|
-
|
|
8541
|
-
textRun.
|
|
8542
|
-
textRun.ed = ed + 3;
|
|
8547
|
+
textRun.st += offset;
|
|
8548
|
+
textRun.ed += offset;
|
|
8543
8549
|
});
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8550
|
+
[
|
|
8551
|
+
bodySlice.paragraphs,
|
|
8552
|
+
bodySlice.sectionBreaks,
|
|
8553
|
+
bodySlice.customBlocks,
|
|
8554
|
+
bodySlice.docxRawCustomBlocks,
|
|
8555
|
+
bodySlice.docxRawBlocks
|
|
8556
|
+
].forEach((items) => items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
8557
|
+
item.startIndex += offset;
|
|
8558
|
+
}));
|
|
8559
|
+
[
|
|
8560
|
+
bodySlice.tables,
|
|
8561
|
+
bodySlice.columnGroups,
|
|
8562
|
+
bodySlice.blockRanges,
|
|
8563
|
+
bodySlice.customRanges,
|
|
8564
|
+
bodySlice.customDecorations
|
|
8565
|
+
].forEach((ranges) => ranges === null || ranges === void 0 ? void 0 : ranges.forEach((range) => {
|
|
8566
|
+
range.startIndex += offset;
|
|
8567
|
+
range.endIndex += offset;
|
|
8568
|
+
}));
|
|
8569
|
+
(_bodySlice$docxExport = bodySlice.docxExportExcludedRanges) === null || _bodySlice$docxExport === void 0 || _bodySlice$docxExport.forEach((range) => {
|
|
8570
|
+
range.start += offset;
|
|
8571
|
+
range.end += offset;
|
|
8552
8572
|
});
|
|
8573
|
+
if (bodySlice.renderedPageBreaks) bodySlice.renderedPageBreaks = bodySlice.renderedPageBreaks.map((index) => index + offset);
|
|
8553
8574
|
return bodySlice;
|
|
8554
8575
|
}
|
|
8555
8576
|
const IDocClipboardService = createIdentifier("doc.clipboard-service");
|
|
@@ -12131,6 +12152,7 @@ function getLineFontFamily(line) {
|
|
|
12131
12152
|
function drawParagraphPlaceholders(ctx, placeholders, color = PLACEHOLDER_COLOR) {
|
|
12132
12153
|
ctx.save();
|
|
12133
12154
|
ctx.fillStyle = color;
|
|
12155
|
+
ctx.globalAlpha *= .5;
|
|
12134
12156
|
ctx.textBaseline = "alphabetic";
|
|
12135
12157
|
for (const placeholder of placeholders) {
|
|
12136
12158
|
const clipLeft = placeholder.clipLeft ?? placeholder.x;
|
|
@@ -12754,12 +12776,35 @@ var DocLayoutInteractionService = class extends Disposable {
|
|
|
12754
12776
|
//#region src/services/doc-zoom.ts
|
|
12755
12777
|
const DEFAULT_DOC_ZOOM_RATIO = 1;
|
|
12756
12778
|
const DEFAULT_MODERN_DOC_ZOOM_RATIO = 1;
|
|
12779
|
+
const DOC_ZOOM_SHORTCUTS = [
|
|
12780
|
+
50,
|
|
12781
|
+
80,
|
|
12782
|
+
100,
|
|
12783
|
+
130,
|
|
12784
|
+
150,
|
|
12785
|
+
170,
|
|
12786
|
+
200,
|
|
12787
|
+
400
|
|
12788
|
+
];
|
|
12757
12789
|
function getDocEffectiveZoomRatio(documentModel) {
|
|
12758
12790
|
var _documentModel$getSet, _documentModel$getSna;
|
|
12759
12791
|
const zoomRatio = (_documentModel$getSet = documentModel.getSettings()) === null || _documentModel$getSet === void 0 ? void 0 : _documentModel$getSet.zoomRatio;
|
|
12760
12792
|
if (zoomRatio != null) return zoomRatio;
|
|
12761
12793
|
return ((_documentModel$getSna = documentModel.getSnapshot().documentStyle) === null || _documentModel$getSna === void 0 ? void 0 : _documentModel$getSna.documentFlavor) === DocumentFlavor.MODERN ? 1 : DEFAULT_DOC_ZOOM_RATIO;
|
|
12762
12794
|
}
|
|
12795
|
+
function getDocZoomRatio$(commandService, instanceService) {
|
|
12796
|
+
return instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(switchMap((documentModel) => {
|
|
12797
|
+
if (!documentModel) return of(100);
|
|
12798
|
+
return new Observable((subscriber) => {
|
|
12799
|
+
const update = () => subscriber.next(Math.round(getDocEffectiveZoomRatio(documentModel) * 100));
|
|
12800
|
+
const disposable = commandService.onCommandExecuted((command) => {
|
|
12801
|
+
if (command.id === SetDocZoomRatioOperation.id && command.params.unitId === documentModel.getUnitId()) update();
|
|
12802
|
+
});
|
|
12803
|
+
update();
|
|
12804
|
+
return () => disposable.dispose();
|
|
12805
|
+
});
|
|
12806
|
+
}), distinctUntilChanged());
|
|
12807
|
+
}
|
|
12763
12808
|
|
|
12764
12809
|
//#endregion
|
|
12765
12810
|
//#region src/services/doc-view-scale.ts
|
|
@@ -13409,11 +13454,13 @@ function doesDocMutationRequireLayout(actions, drawings) {
|
|
|
13409
13454
|
if (!sawComponent || !drawingOnly) return true;
|
|
13410
13455
|
if (transitions.size === 0) return false;
|
|
13411
13456
|
for (const [drawingId, transition] of transitions) {
|
|
13412
|
-
var
|
|
13413
|
-
const
|
|
13457
|
+
var _currentDrawing$docTr, _currentDrawing$docTr2;
|
|
13458
|
+
const currentDrawing = drawings === null || drawings === void 0 ? void 0 : drawings[drawingId];
|
|
13459
|
+
const currentLayoutType = currentDrawing === null || currentDrawing === void 0 ? void 0 : currentDrawing.layoutType;
|
|
13414
13460
|
const before = transition.before ?? currentLayoutType;
|
|
13415
13461
|
const after = transition.after ?? currentLayoutType;
|
|
13416
13462
|
if (before == null || after == null || before !== PositionedObjectLayoutType.WRAP_NONE || after !== PositionedObjectLayoutType.WRAP_NONE) return true;
|
|
13463
|
+
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
13464
|
}
|
|
13418
13465
|
return false;
|
|
13419
13466
|
}
|
|
@@ -18435,6 +18482,46 @@ function PasteRibbonMenuFactory(accessor) {
|
|
|
18435
18482
|
};
|
|
18436
18483
|
}
|
|
18437
18484
|
|
|
18485
|
+
//#endregion
|
|
18486
|
+
//#region src/menu/display.menu.ts
|
|
18487
|
+
const DOC_ZOOM_RATIO_MENU_ID = "doc.menu.zoom-ratio";
|
|
18488
|
+
function DocZoomRatioMenuItemFactory(accessor) {
|
|
18489
|
+
const commandService = accessor.get(ICommandService);
|
|
18490
|
+
const instanceService = accessor.get(IUniverInstanceService);
|
|
18491
|
+
return {
|
|
18492
|
+
id: DOC_ZOOM_RATIO_MENU_ID,
|
|
18493
|
+
type: MenuItemType.SELECTOR,
|
|
18494
|
+
icon: "ZoomInIcon",
|
|
18495
|
+
tooltip: "docs-ui.toolbar.zoom",
|
|
18496
|
+
selectionsCommandId: SetDocZoomRatioOperation.id,
|
|
18497
|
+
selections: DOC_ZOOM_SHORTCUTS.map((value) => ({
|
|
18498
|
+
value,
|
|
18499
|
+
label: `${value}%`,
|
|
18500
|
+
params: () => {
|
|
18501
|
+
var _instanceService$getC;
|
|
18502
|
+
return {
|
|
18503
|
+
unitId: (_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId(),
|
|
18504
|
+
zoomRatio: value / 100
|
|
18505
|
+
};
|
|
18506
|
+
}
|
|
18507
|
+
})),
|
|
18508
|
+
value$: getDocZoomRatio$(commandService, instanceService),
|
|
18509
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
|
|
18510
|
+
};
|
|
18511
|
+
}
|
|
18512
|
+
function DocFullscreenMenuItemFactory(accessor) {
|
|
18513
|
+
const root = accessor.get(ILayoutService).rootContainerElement;
|
|
18514
|
+
const fullscreen$ = root ? merge$1(of(null), fromEvent(root.ownerDocument, "fullscreenchange")).pipe(map(() => root.ownerDocument.fullscreenElement === root), distinctUntilChanged()) : of(false);
|
|
18515
|
+
return {
|
|
18516
|
+
id: ToggleFullscreenOperation.id,
|
|
18517
|
+
type: MenuItemType.BUTTON,
|
|
18518
|
+
tooltip: "docs-ui.toolbar.fullscreen",
|
|
18519
|
+
icon: fullscreen$.pipe(map((fullscreen) => fullscreen ? "ShrinkIcon" : "ExpandIcon")),
|
|
18520
|
+
activated$: fullscreen$,
|
|
18521
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
|
|
18522
|
+
};
|
|
18523
|
+
}
|
|
18524
|
+
|
|
18438
18525
|
//#endregion
|
|
18439
18526
|
//#region src/views/paragraph-menu/theme-color.ts
|
|
18440
18527
|
function getHighlightBackgroundColor(themeService, index) {
|
|
@@ -18843,7 +18930,7 @@ function ParagraphMenuInsertBelowSubmenuItemFactory(accessor) {
|
|
|
18843
18930
|
return {
|
|
18844
18931
|
id: DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID,
|
|
18845
18932
|
type: MenuItemType.SUBITEMS,
|
|
18846
|
-
icon: "
|
|
18933
|
+
icon: "InsertBelowDoubleIcon",
|
|
18847
18934
|
title: "docs-ui.rightClick.insertBellow",
|
|
18848
18935
|
tooltip: "docs-ui.rightClick.insertBellow",
|
|
18849
18936
|
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
|
|
@@ -19061,7 +19148,8 @@ const menuSchema = {
|
|
|
19061
19148
|
order: 0,
|
|
19062
19149
|
gridLayout: {
|
|
19063
19150
|
row: 2,
|
|
19064
|
-
column: 1
|
|
19151
|
+
column: 1,
|
|
19152
|
+
width: 44
|
|
19065
19153
|
},
|
|
19066
19154
|
menuItemFactory: BoldMenuItemFactory
|
|
19067
19155
|
},
|
|
@@ -19069,7 +19157,8 @@ const menuSchema = {
|
|
|
19069
19157
|
order: 1,
|
|
19070
19158
|
gridLayout: {
|
|
19071
19159
|
row: 2,
|
|
19072
|
-
column: 2
|
|
19160
|
+
column: 2,
|
|
19161
|
+
width: 44
|
|
19073
19162
|
},
|
|
19074
19163
|
menuItemFactory: ItalicMenuItemFactory
|
|
19075
19164
|
},
|
|
@@ -19077,7 +19166,8 @@ const menuSchema = {
|
|
|
19077
19166
|
order: 2,
|
|
19078
19167
|
gridLayout: {
|
|
19079
19168
|
row: 2,
|
|
19080
|
-
column: 3
|
|
19169
|
+
column: 3,
|
|
19170
|
+
width: 44
|
|
19081
19171
|
},
|
|
19082
19172
|
menuItemFactory: UnderlineMenuItemFactory
|
|
19083
19173
|
},
|
|
@@ -19085,7 +19175,8 @@ const menuSchema = {
|
|
|
19085
19175
|
order: 3,
|
|
19086
19176
|
gridLayout: {
|
|
19087
19177
|
row: 2,
|
|
19088
|
-
column: 4
|
|
19178
|
+
column: 4,
|
|
19179
|
+
width: 44
|
|
19089
19180
|
},
|
|
19090
19181
|
menuItemFactory: StrikeThroughMenuItemFactory
|
|
19091
19182
|
},
|
|
@@ -19093,7 +19184,8 @@ const menuSchema = {
|
|
|
19093
19184
|
order: 4,
|
|
19094
19185
|
gridLayout: {
|
|
19095
19186
|
row: 2,
|
|
19096
|
-
column:
|
|
19187
|
+
column: 6,
|
|
19188
|
+
width: 44
|
|
19097
19189
|
},
|
|
19098
19190
|
menuItemFactory: SubscriptMenuItemFactory
|
|
19099
19191
|
},
|
|
@@ -19101,7 +19193,8 @@ const menuSchema = {
|
|
|
19101
19193
|
order: 5,
|
|
19102
19194
|
gridLayout: {
|
|
19103
19195
|
row: 2,
|
|
19104
|
-
column:
|
|
19196
|
+
column: 5,
|
|
19197
|
+
width: 44
|
|
19105
19198
|
},
|
|
19106
19199
|
menuItemFactory: SuperscriptMenuItemFactory
|
|
19107
19200
|
},
|
|
@@ -19111,7 +19204,7 @@ const menuSchema = {
|
|
|
19111
19204
|
row: 1,
|
|
19112
19205
|
column: 1,
|
|
19113
19206
|
columnSpan: 2,
|
|
19114
|
-
width:
|
|
19207
|
+
width: 96
|
|
19115
19208
|
},
|
|
19116
19209
|
menuItemFactory: HeadingSelectorMenuItemFactory
|
|
19117
19210
|
},
|
|
@@ -19120,7 +19213,8 @@ const menuSchema = {
|
|
|
19120
19213
|
gridLayout: {
|
|
19121
19214
|
row: 1,
|
|
19122
19215
|
column: 7,
|
|
19123
|
-
|
|
19216
|
+
columnSpan: 2,
|
|
19217
|
+
width: 96
|
|
19124
19218
|
},
|
|
19125
19219
|
menuItemFactory: FontSizeSelectorMenuItemFactory
|
|
19126
19220
|
},
|
|
@@ -19130,7 +19224,7 @@ const menuSchema = {
|
|
|
19130
19224
|
row: 1,
|
|
19131
19225
|
column: 3,
|
|
19132
19226
|
columnSpan: 4,
|
|
19133
|
-
width:
|
|
19227
|
+
width: 200
|
|
19134
19228
|
},
|
|
19135
19229
|
menuItemFactory: FontFamilySelectorMenuItemFactory
|
|
19136
19230
|
},
|
|
@@ -19138,7 +19232,8 @@ const menuSchema = {
|
|
|
19138
19232
|
order: 8,
|
|
19139
19233
|
gridLayout: {
|
|
19140
19234
|
row: 2,
|
|
19141
|
-
column:
|
|
19235
|
+
column: 8,
|
|
19236
|
+
width: 44
|
|
19142
19237
|
},
|
|
19143
19238
|
menuItemFactory: TextColorSelectorMenuItemFactory,
|
|
19144
19239
|
[ResetInlineFormatTextColorCommand.id]: {
|
|
@@ -19150,7 +19245,8 @@ const menuSchema = {
|
|
|
19150
19245
|
order: 9,
|
|
19151
19246
|
gridLayout: {
|
|
19152
19247
|
row: 2,
|
|
19153
|
-
column:
|
|
19248
|
+
column: 7,
|
|
19249
|
+
width: 44
|
|
19154
19250
|
},
|
|
19155
19251
|
menuItemFactory: BackgroundColorSelectorMenuItemFactory,
|
|
19156
19252
|
[ResetInlineFormatTextBackgroundColorCommand.id]: {
|
|
@@ -19201,16 +19297,6 @@ const menuSchema = {
|
|
|
19201
19297
|
showLabel: true
|
|
19202
19298
|
},
|
|
19203
19299
|
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
19300
|
}
|
|
19215
19301
|
},
|
|
19216
19302
|
[RibbonInsertGroup.MEDIA]: {
|
|
@@ -19285,6 +19371,34 @@ const menuSchema = {
|
|
|
19285
19371
|
menuItemFactory: SymbolPickerMenuItemFactory
|
|
19286
19372
|
}
|
|
19287
19373
|
},
|
|
19374
|
+
[RibbonViewGroup.DISPLAY]: {
|
|
19375
|
+
[DocOpenPageSettingCommand.id]: {
|
|
19376
|
+
order: 0,
|
|
19377
|
+
gridLayout: {
|
|
19378
|
+
row: 1,
|
|
19379
|
+
column: 1,
|
|
19380
|
+
rowSpan: 2,
|
|
19381
|
+
showLabel: true
|
|
19382
|
+
},
|
|
19383
|
+
menuItemFactory: PageSettingMenuItemFactory
|
|
19384
|
+
},
|
|
19385
|
+
[DOC_ZOOM_RATIO_MENU_ID]: {
|
|
19386
|
+
order: 1,
|
|
19387
|
+
gridLayout: {
|
|
19388
|
+
row: 1,
|
|
19389
|
+
column: 2
|
|
19390
|
+
},
|
|
19391
|
+
menuItemFactory: DocZoomRatioMenuItemFactory
|
|
19392
|
+
},
|
|
19393
|
+
[ToggleFullscreenOperation.id]: {
|
|
19394
|
+
order: 2,
|
|
19395
|
+
gridLayout: {
|
|
19396
|
+
row: 2,
|
|
19397
|
+
column: 2
|
|
19398
|
+
},
|
|
19399
|
+
menuItemFactory: DocFullscreenMenuItemFactory
|
|
19400
|
+
}
|
|
19401
|
+
},
|
|
19288
19402
|
[ContextMenuPosition.MAIN_AREA]: {
|
|
19289
19403
|
[ContextMenuGroup.OTHERS]: { [OpenDocParagraphPermissionOperation.id]: {
|
|
19290
19404
|
order: 10,
|
|
@@ -20003,45 +20117,23 @@ const BulletListShortCut = {
|
|
|
20003
20117
|
|
|
20004
20118
|
//#endregion
|
|
20005
20119
|
//#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
20120
|
const DOC_ZOOM_RANGE = [10, 400];
|
|
20017
20121
|
function ZoomSlider() {
|
|
20018
20122
|
const commandService = useDependency(ICommandService);
|
|
20019
20123
|
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]);
|
|
20124
|
+
const zoom = useObservable(() => getDocZoomRatio$(commandService, univerInstanceService), 100, void 0, [commandService, univerInstanceService]);
|
|
20032
20125
|
function handleChange(value) {
|
|
20033
|
-
|
|
20126
|
+
const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
20034
20127
|
if (documentDataModel == null) return;
|
|
20035
|
-
|
|
20036
|
-
commandService.executeCommand(SetDocZoomRatioOperation.id, {
|
|
20128
|
+
return commandService.executeCommand(SetDocZoomRatioOperation.id, {
|
|
20037
20129
|
unitId: documentDataModel.getUnitId(),
|
|
20038
|
-
zoomRatio
|
|
20130
|
+
zoomRatio: value / 100
|
|
20039
20131
|
});
|
|
20040
20132
|
}
|
|
20041
20133
|
return /* @__PURE__ */ jsx(Slider, {
|
|
20042
20134
|
min: DOC_ZOOM_RANGE[0],
|
|
20043
20135
|
value: zoom,
|
|
20044
|
-
shortcuts:
|
|
20136
|
+
shortcuts: DOC_ZOOM_SHORTCUTS,
|
|
20045
20137
|
onChange: handleChange
|
|
20046
20138
|
});
|
|
20047
20139
|
}
|
|
@@ -21312,7 +21404,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
|
|
|
21312
21404
|
//#endregion
|
|
21313
21405
|
//#region package.json
|
|
21314
21406
|
var name = "@univerjs/docs-ui";
|
|
21315
|
-
var version = "1.0
|
|
21407
|
+
var version = "1.1.0";
|
|
21316
21408
|
|
|
21317
21409
|
//#endregion
|
|
21318
21410
|
//#region src/commands/commands/doc-paragraph-setting.command.ts
|
|
@@ -24500,6 +24592,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
24500
24592
|
H5Icon,
|
|
24501
24593
|
HeaderFooterIcon,
|
|
24502
24594
|
HorizontallyIcon,
|
|
24595
|
+
InsertBelowDoubleIcon,
|
|
24503
24596
|
InsertDoubleIcon,
|
|
24504
24597
|
InsertRowAboveDoubleIcon,
|
|
24505
24598
|
InsertRowBelowDoubleIcon,
|
|
@@ -24532,6 +24625,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
24532
24625
|
TodoListDoubleIcon,
|
|
24533
24626
|
UnderlineIcon,
|
|
24534
24627
|
UnorderIcon,
|
|
24628
|
+
ZoomInIcon,
|
|
24535
24629
|
DefaultTextColorIcon,
|
|
24536
24630
|
HeaderTextColorIcon,
|
|
24537
24631
|
MoreRightIcon,
|
|
@@ -28280,6 +28374,10 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28280
28374
|
var _this$_paragraphMenu2;
|
|
28281
28375
|
return ((_this$_paragraphMenu2 = this._paragraphMenu) === null || _this$_paragraphMenu2 === void 0 ? void 0 : _this$_paragraphMenu2.target) ?? null;
|
|
28282
28376
|
}
|
|
28377
|
+
get focusedTableTarget() {
|
|
28378
|
+
var _this$_focusedTableMe;
|
|
28379
|
+
return ((_this$_focusedTableMe = this._focusedTableMenu) === null || _this$_focusedTableMe === void 0 ? void 0 : _this$_focusedTableMe.target) ?? null;
|
|
28380
|
+
}
|
|
28283
28381
|
setBlockMenuDragging(isDragging) {
|
|
28284
28382
|
this._isBlockMenuDragging = isDragging;
|
|
28285
28383
|
if (isDragging) this._dragInteraction ??= this._docLayoutInteractionService.beginInteraction();
|
|
@@ -28307,6 +28405,11 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28307
28405
|
_defineProperty(this, "_paragraphMenu", null);
|
|
28308
28406
|
_defineProperty(this, "_activeTarget$", new BehaviorSubject(null));
|
|
28309
28407
|
_defineProperty(this, "activeTarget$", this._activeTarget$.asObservable());
|
|
28408
|
+
_defineProperty(this, "_focusedTableMenu", null);
|
|
28409
|
+
_defineProperty(this, "_focusedTableTarget$", new BehaviorSubject(null));
|
|
28410
|
+
_defineProperty(this, "focusedTableTarget$", this._focusedTableTarget$.asObservable());
|
|
28411
|
+
_defineProperty(this, "_focusedTableMenuDismiss$", new Subject());
|
|
28412
|
+
_defineProperty(this, "focusedTableMenuDismiss$", this._focusedTableMenuDismiss$.asObservable());
|
|
28310
28413
|
_defineProperty(this, "_slashMenuRequest$", new BehaviorSubject(null));
|
|
28311
28414
|
_defineProperty(this, "slashMenuRequest$", this._slashMenuRequest$.asObservable());
|
|
28312
28415
|
_defineProperty(this, "_isBlockMenuDragging", false);
|
|
@@ -28322,6 +28425,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28322
28425
|
this._isBlockMenuDragging = false;
|
|
28323
28426
|
this.hideParagraphMenu(true);
|
|
28324
28427
|
}
|
|
28428
|
+
if (this._focusedTableMenu && !this._canEditDocument(this._focusedTableMenu.target.menuRange)) this.hideFocusedTableMenu();
|
|
28325
28429
|
}));
|
|
28326
28430
|
}
|
|
28327
28431
|
_isCursorInActiveParagraph() {
|
|
@@ -28358,9 +28462,11 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28358
28462
|
_hasExpandedSelection() {
|
|
28359
28463
|
return this._hasExpandedSelectionRanges(this._docSelectionManagerService.getDocRanges());
|
|
28360
28464
|
}
|
|
28361
|
-
setParagraphMenuActive(active) {
|
|
28362
|
-
|
|
28363
|
-
|
|
28465
|
+
setParagraphMenuActive(active, focusedTable = false) {
|
|
28466
|
+
var _this$_paragraphMenu3, _this$_focusedTableMe2;
|
|
28467
|
+
const menu = focusedTable ? this._focusedTableMenu : this._paragraphMenu;
|
|
28468
|
+
if (menu) menu.active = active;
|
|
28469
|
+
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
28470
|
else {
|
|
28365
28471
|
var _this$_menuInteractio;
|
|
28366
28472
|
(_this$_menuInteractio = this._menuInteraction) === null || _this$_menuInteractio === void 0 || _this$_menuInteractio.dispose();
|
|
@@ -28369,7 +28475,9 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28369
28475
|
}
|
|
28370
28476
|
_init() {
|
|
28371
28477
|
const handleHoverTarget = (paragraph, tableBound) => {
|
|
28478
|
+
var _this$_focusedTableMe3;
|
|
28372
28479
|
if (this._isBlockMenuDragging) return;
|
|
28480
|
+
if ((_this$_focusedTableMe3 = this._focusedTableMenu) === null || _this$_focusedTableMe3 === void 0 ? void 0 : _this$_focusedTableMe3.active) return;
|
|
28373
28481
|
if (this._docSelectionRenderService.isOnPointerEvent) {
|
|
28374
28482
|
this.hideParagraphMenu(true);
|
|
28375
28483
|
return;
|
|
@@ -28380,18 +28488,18 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28380
28488
|
return;
|
|
28381
28489
|
}
|
|
28382
28490
|
if (selectionState.hasRectRange) {
|
|
28383
|
-
var _this$
|
|
28491
|
+
var _this$_paragraphMenu4;
|
|
28384
28492
|
if (tableBound) {
|
|
28385
28493
|
this.showTableMenu(tableBound);
|
|
28386
28494
|
return;
|
|
28387
28495
|
}
|
|
28388
|
-
if (((_this$
|
|
28496
|
+
if (((_this$_paragraphMenu4 = this._paragraphMenu) === null || _this$_paragraphMenu4 === void 0 ? void 0 : _this$_paragraphMenu4.target.kind) === DocumentBlockType.TABLE) return;
|
|
28389
28497
|
this.hideParagraphMenu(true);
|
|
28390
28498
|
return;
|
|
28391
28499
|
}
|
|
28392
28500
|
if (this._docSkeletonManagerService.getViewModel().getEditArea() === DocumentEditArea.BODY && !this._floatMenuService.floatMenu && !this._context.unit.getDisabled() && this._canEditDocument()) {
|
|
28393
|
-
var _this$
|
|
28394
|
-
if ((_this$
|
|
28501
|
+
var _this$_paragraphMenu5;
|
|
28502
|
+
if ((_this$_paragraphMenu5 = this._paragraphMenu) === null || _this$_paragraphMenu5 === void 0 ? void 0 : _this$_paragraphMenu5.active) return;
|
|
28395
28503
|
if (paragraph) {
|
|
28396
28504
|
this.showParagraphMenu(paragraph);
|
|
28397
28505
|
return;
|
|
@@ -28417,16 +28525,17 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28417
28525
|
this.hideParagraphMenu(true);
|
|
28418
28526
|
}));
|
|
28419
28527
|
this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe(({ textRanges, rectRanges }) => {
|
|
28420
|
-
var _this$
|
|
28528
|
+
var _this$_paragraphMenu6;
|
|
28421
28529
|
const selectionState = this._getExpandedSelectionState([...textRanges, ...rectRanges]);
|
|
28422
|
-
if (selectionState.hasExpandedTextRange || selectionState.hasRectRange && ((_this$
|
|
28530
|
+
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
28531
|
}));
|
|
28424
28532
|
let lastScrollY = 0;
|
|
28425
28533
|
this.disposeWithMe(this._context.scene.getViewport("viewMain").onScrollAfter$.subscribeEvent((e) => {
|
|
28426
|
-
var _this$
|
|
28534
|
+
var _this$_paragraphMenu7;
|
|
28427
28535
|
if (lastScrollY === e.scrollY) return;
|
|
28428
28536
|
lastScrollY = e.scrollY;
|
|
28429
|
-
|
|
28537
|
+
this._focusedTableMenuDismiss$.next();
|
|
28538
|
+
if ((_this$_paragraphMenu7 = this._paragraphMenu) === null || _this$_paragraphMenu7 === void 0 ? void 0 : _this$_paragraphMenu7.blockRange) return;
|
|
28430
28539
|
if (this._isBlockMenuDragging) return;
|
|
28431
28540
|
this.hideParagraphMenu(true);
|
|
28432
28541
|
}));
|
|
@@ -28437,6 +28546,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28437
28546
|
this.disposeWithMe(this._docSelectionRenderService.onKeydown$.subscribe((config) => {
|
|
28438
28547
|
if (this._isBlockMenuDragging) return;
|
|
28439
28548
|
if (this._handleSlashMenuKeydown(config)) return;
|
|
28549
|
+
this._focusedTableMenuDismiss$.next();
|
|
28440
28550
|
this.hideParagraphMenu(true);
|
|
28441
28551
|
}));
|
|
28442
28552
|
this.disposeWithMe(this._docSelectionRenderService.onInputBefore$.subscribe((config) => {
|
|
@@ -28492,10 +28602,10 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28492
28602
|
return null;
|
|
28493
28603
|
}
|
|
28494
28604
|
_getSlashMenuParagraph(config) {
|
|
28495
|
-
var _this$
|
|
28605
|
+
var _this$_paragraphMenu8;
|
|
28496
28606
|
const activeRange = this._getCollapsedTextRange(config);
|
|
28497
28607
|
const offset = activeRange === null || activeRange === void 0 ? void 0 : activeRange.startOffset;
|
|
28498
|
-
const activeParagraph = ((_this$
|
|
28608
|
+
const activeParagraph = ((_this$_paragraphMenu8 = this._paragraphMenu) === null || _this$_paragraphMenu8 === void 0 ? void 0 : _this$_paragraphMenu8.paragraph) ?? null;
|
|
28499
28609
|
if (activeParagraph && offset != null && offset >= activeParagraph.paragraphStart && offset <= activeParagraph.paragraphEnd) return activeParagraph;
|
|
28500
28610
|
if (activeParagraph && offset == null) return activeParagraph;
|
|
28501
28611
|
if (offset == null) return null;
|
|
@@ -28516,7 +28626,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28516
28626
|
}
|
|
28517
28627
|
}
|
|
28518
28628
|
showParagraphMenu(paragraph) {
|
|
28519
|
-
var _this$
|
|
28629
|
+
var _this$_paragraphMenu9;
|
|
28520
28630
|
if (this._hasExpandedSelection()) {
|
|
28521
28631
|
this.hideParagraphMenu(true);
|
|
28522
28632
|
return;
|
|
@@ -28526,7 +28636,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28526
28636
|
this.hideParagraphMenu(true);
|
|
28527
28637
|
return;
|
|
28528
28638
|
}
|
|
28529
|
-
if (((_this$
|
|
28639
|
+
if (((_this$_paragraphMenu9 = this._paragraphMenu) === null || _this$_paragraphMenu9 === void 0 ? void 0 : _this$_paragraphMenu9.target.key) === target.key) return;
|
|
28530
28640
|
this.hideParagraphMenu(true);
|
|
28531
28641
|
const targetParagraph = target.paragraph ?? paragraph;
|
|
28532
28642
|
const blockRange = target.blockRange;
|
|
@@ -28561,15 +28671,19 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28561
28671
|
};
|
|
28562
28672
|
this._activeTarget$.next(target);
|
|
28563
28673
|
}
|
|
28564
|
-
showTableMenu(tableBound) {
|
|
28565
|
-
var _body$tables, _this$
|
|
28566
|
-
if (this.
|
|
28674
|
+
showTableMenu(tableBound, focused = false) {
|
|
28675
|
+
var _this$_focusedTableMe4, _body$tables, _this$_paragraphMenu10;
|
|
28676
|
+
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;
|
|
28677
|
+
if (!focused && this._hasExpandedTextSelection()) {
|
|
28567
28678
|
this.hideParagraphMenu(true);
|
|
28568
28679
|
return;
|
|
28569
28680
|
}
|
|
28570
28681
|
const body = this._context.unit.getBody();
|
|
28571
28682
|
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)
|
|
28683
|
+
if (!table) {
|
|
28684
|
+
if (focused) this.hideFocusedTableMenu();
|
|
28685
|
+
return;
|
|
28686
|
+
}
|
|
28573
28687
|
const target = {
|
|
28574
28688
|
kind: DocumentBlockType.TABLE,
|
|
28575
28689
|
key: `${DocumentBlockType.TABLE}:${table.tableId}`,
|
|
@@ -28582,17 +28696,21 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28582
28696
|
},
|
|
28583
28697
|
moveRange: {
|
|
28584
28698
|
startOffset: table.startIndex,
|
|
28585
|
-
endOffset: table.endIndex
|
|
28699
|
+
endOffset: table.endIndex + ((body === null || body === void 0 ? void 0 : body.dataStream[table.endIndex]) === "\r" ? 1 : 0)
|
|
28586
28700
|
},
|
|
28587
28701
|
emptyMode: false,
|
|
28588
28702
|
draggable: true
|
|
28589
28703
|
};
|
|
28590
28704
|
if (!this._canEditDocument(target.menuRange)) {
|
|
28705
|
+
if (focused) {
|
|
28706
|
+
this.hideFocusedTableMenu();
|
|
28707
|
+
return;
|
|
28708
|
+
}
|
|
28591
28709
|
this.hideParagraphMenu(true);
|
|
28592
28710
|
return;
|
|
28593
28711
|
}
|
|
28594
|
-
if (this._shouldKeepCurrentCellMenuForTable(table)) return;
|
|
28595
|
-
if (((_this$
|
|
28712
|
+
if (!focused && this._shouldKeepCurrentCellMenuForTable(table)) return;
|
|
28713
|
+
if (!focused && ((_this$_paragraphMenu10 = this._paragraphMenu) === null || _this$_paragraphMenu10 === void 0 ? void 0 : _this$_paragraphMenu10.target.key) === target.key) return;
|
|
28596
28714
|
const anchorRect = getTableAnchorRect(tableBound);
|
|
28597
28715
|
const paragraph = {
|
|
28598
28716
|
rect: tableBound.rect,
|
|
@@ -28603,8 +28721,16 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28603
28721
|
pageIndex: tableBound.pageIndex,
|
|
28604
28722
|
firstLine: anchorRect
|
|
28605
28723
|
};
|
|
28724
|
+
if (focused) {
|
|
28725
|
+
target.paragraph = paragraph;
|
|
28726
|
+
this._showFocusedTableMenu(tableBound, target);
|
|
28727
|
+
return;
|
|
28728
|
+
}
|
|
28729
|
+
this._showHoverTableMenu(tableBound, target, paragraph);
|
|
28730
|
+
}
|
|
28731
|
+
_showHoverTableMenu(tableBound, target, paragraph) {
|
|
28606
28732
|
this.hideParagraphMenu(true);
|
|
28607
|
-
const getFirstLine = () => getTableAnchorRect(this._docEventManagerService.tableBounds.get(
|
|
28733
|
+
const getFirstLine = () => getTableAnchorRect(this._docEventManagerService.tableBounds.get(tableBound.tableId) ?? tableBound);
|
|
28608
28734
|
const disposable = this._docPopupManagerService.attachPopupToRect(getFirstLine, {
|
|
28609
28735
|
componentKey: DOC_TABLE_BLOCK_MENU_COMPONENT_KEY,
|
|
28610
28736
|
constrainToCanvas: true,
|
|
@@ -28623,9 +28749,40 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28623
28749
|
};
|
|
28624
28750
|
this._activeTarget$.next(target);
|
|
28625
28751
|
}
|
|
28752
|
+
_showFocusedTableMenu(tableBound, target) {
|
|
28753
|
+
var _this$_focusedTableMe5, _this$_paragraphMenu11;
|
|
28754
|
+
if (((_this$_focusedTableMe5 = this._focusedTableMenu) === null || _this$_focusedTableMe5 === void 0 ? void 0 : _this$_focusedTableMe5.target.key) === target.key) {
|
|
28755
|
+
this._focusedTableMenu.target = target;
|
|
28756
|
+
this._focusedTableMenu.bound = tableBound;
|
|
28757
|
+
this._focusedTableTarget$.next(target);
|
|
28758
|
+
return;
|
|
28759
|
+
}
|
|
28760
|
+
this.hideFocusedTableMenu();
|
|
28761
|
+
if (((_this$_paragraphMenu11 = this._paragraphMenu) === null || _this$_paragraphMenu11 === void 0 ? void 0 : _this$_paragraphMenu11.target.key) === target.key) this.hideParagraphMenu(true);
|
|
28762
|
+
const getFocusedAnchor = () => {
|
|
28763
|
+
var _this$_focusedTableMe6;
|
|
28764
|
+
return getTableAnchorRect(this._docEventManagerService.tableBounds.get(tableBound.tableId) ?? ((_this$_focusedTableMe6 = this._focusedTableMenu) === null || _this$_focusedTableMe6 === void 0 ? void 0 : _this$_focusedTableMe6.bound) ?? tableBound);
|
|
28765
|
+
};
|
|
28766
|
+
const disposable = this._docPopupManagerService.attachPopupToRect(getFocusedAnchor, {
|
|
28767
|
+
componentKey: DOC_TABLE_BLOCK_MENU_COMPONENT_KEY,
|
|
28768
|
+
extraProps: { focusedTableMenu: true },
|
|
28769
|
+
constrainToCanvas: true,
|
|
28770
|
+
requiresStableLayout: false,
|
|
28771
|
+
direction: "top-right",
|
|
28772
|
+
onClickOutside: () => this._focusedTableMenuDismiss$.next(),
|
|
28773
|
+
zIndex: 102
|
|
28774
|
+
}, this._context.unitId);
|
|
28775
|
+
this._focusedTableMenu = {
|
|
28776
|
+
target,
|
|
28777
|
+
bound: tableBound,
|
|
28778
|
+
disposable,
|
|
28779
|
+
active: false
|
|
28780
|
+
};
|
|
28781
|
+
this._focusedTableTarget$.next(target);
|
|
28782
|
+
}
|
|
28626
28783
|
_shouldKeepCurrentCellMenuForTable(table) {
|
|
28627
|
-
var _this$
|
|
28628
|
-
const target = (_this$
|
|
28784
|
+
var _this$_paragraphMenu12;
|
|
28785
|
+
const target = (_this$_paragraphMenu12 = this._paragraphMenu) === null || _this$_paragraphMenu12 === void 0 ? void 0 : _this$_paragraphMenu12.target;
|
|
28629
28786
|
if (!target || target.kind === DocumentBlockType.TABLE || !target.cellRange) return false;
|
|
28630
28787
|
return target.cellRange.startOffset >= table.startIndex && target.cellRange.startOffset <= table.endIndex;
|
|
28631
28788
|
}
|
|
@@ -28668,22 +28825,32 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
|
|
|
28668
28825
|
hideParagraphMenu(force = false) {
|
|
28669
28826
|
if (this._isBlockMenuDragging) return;
|
|
28670
28827
|
if (this._paragraphMenu && (this._paragraphMenu.disposable.canDispose() || force)) {
|
|
28671
|
-
var _this$_menuInteractio2;
|
|
28672
28828
|
this._paragraphMenu.disposable.dispose();
|
|
28673
28829
|
this._paragraphMenu = null;
|
|
28674
|
-
|
|
28675
|
-
this._menuInteraction = null;
|
|
28830
|
+
this.setParagraphMenuActive(false);
|
|
28676
28831
|
this._isSlashMenuActive = false;
|
|
28677
28832
|
this._slashMenuRequest$.next(null);
|
|
28678
28833
|
this._activeTarget$.next(null);
|
|
28679
28834
|
}
|
|
28680
28835
|
}
|
|
28836
|
+
hideFocusedTableMenu() {
|
|
28837
|
+
var _this$_focusedTableMe7;
|
|
28838
|
+
(_this$_focusedTableMe7 = this._focusedTableMenu) === null || _this$_focusedTableMe7 === void 0 || _this$_focusedTableMe7.disposable.dispose();
|
|
28839
|
+
this._focusedTableMenu = null;
|
|
28840
|
+
this._focusedTableTarget$.next(null);
|
|
28841
|
+
this.setParagraphMenuActive(false, true);
|
|
28842
|
+
}
|
|
28681
28843
|
_canEditDocument(range, segmentId = "") {
|
|
28682
28844
|
return canEditDocumentTargets(this._permissionService, this._context.unitId, range ? getDocumentEditTargetObjectIds(this._context.unit, segmentId, range) : []);
|
|
28683
28845
|
}
|
|
28684
28846
|
dispose() {
|
|
28685
|
-
var _this$
|
|
28686
|
-
|
|
28847
|
+
var _this$_menuInteractio2, _this$_dragInteractio2;
|
|
28848
|
+
this._isBlockMenuDragging = false;
|
|
28849
|
+
this.hideFocusedTableMenu();
|
|
28850
|
+
this.hideParagraphMenu(true);
|
|
28851
|
+
this._focusedTableTarget$.complete();
|
|
28852
|
+
this._focusedTableMenuDismiss$.complete();
|
|
28853
|
+
(_this$_menuInteractio2 = this._menuInteraction) === null || _this$_menuInteractio2 === void 0 || _this$_menuInteractio2.dispose();
|
|
28687
28854
|
this._menuInteraction = null;
|
|
28688
28855
|
(_this$_dragInteractio2 = this._dragInteraction) === null || _this$_dragInteractio2 === void 0 || _this$_dragInteractio2.dispose();
|
|
28689
28856
|
this._dragInteraction = null;
|
|
@@ -29015,9 +29182,6 @@ function createParagraphMenuHoverOpenScheduler(openMenu, delay = 800) {
|
|
|
29015
29182
|
}
|
|
29016
29183
|
};
|
|
29017
29184
|
}
|
|
29018
|
-
function setParagraphMenuInteractionActive(docParagraphMenuService, active) {
|
|
29019
|
-
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(active);
|
|
29020
|
-
}
|
|
29021
29185
|
function isEmptyParagraphMenuTarget(dataStream, paragraph) {
|
|
29022
29186
|
if (!paragraph) return false;
|
|
29023
29187
|
return dataStream.slice(paragraph.paragraphStart, paragraph.paragraphEnd).replace(/[\r\n]/g, "") === "";
|
|
@@ -29427,7 +29591,7 @@ function getBlockRangeClipboardTargetRange(commandId, target, paragraph) {
|
|
|
29427
29591
|
return null;
|
|
29428
29592
|
}
|
|
29429
29593
|
function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
29430
|
-
var _doc$getBody, _paragraphObj$paragra;
|
|
29594
|
+
var _popup$extraProps, _doc$getBody, _paragraphObj$paragra;
|
|
29431
29595
|
const [visible, setVisible] = useState(false);
|
|
29432
29596
|
const [openMode, setOpenMode] = useState("pointer");
|
|
29433
29597
|
const [anchorRect, setAnchorRect] = useState(null);
|
|
@@ -29436,10 +29600,12 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29436
29600
|
const targetRangeRef = useRef(null);
|
|
29437
29601
|
const dragTargetOffsetRef = useRef(null);
|
|
29438
29602
|
const dragRangeRef = useRef(null);
|
|
29603
|
+
const dragCleanupRef = useRef(null);
|
|
29439
29604
|
const isDraggingRef = useRef(false);
|
|
29440
29605
|
const openMenuRef = useRef(() => void 0);
|
|
29441
29606
|
const hoverOpenSchedulerRef = useRef(createParagraphMenuHoverOpenScheduler(() => openMenuRef.current()));
|
|
29442
29607
|
const commandService = useDependency(ICommandService);
|
|
29608
|
+
const logService = useDependency(ILogService);
|
|
29443
29609
|
const localeService = useDependency(LocaleService);
|
|
29444
29610
|
const themeService = useDependency(ThemeService);
|
|
29445
29611
|
const docSelectionManagerService = useDependency(DocSelectionManagerService);
|
|
@@ -29460,12 +29626,20 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29460
29626
|
const doc = univerInstanceService.getUnit(popup.unitId, UniverInstanceType.UNIVER_DOC);
|
|
29461
29627
|
const docParagraphMenuService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocParagraphMenuService);
|
|
29462
29628
|
const docEventManagerService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocEventManagerService);
|
|
29463
|
-
const
|
|
29629
|
+
const isFocusedTableMenu = ((_popup$extraProps = popup.extraProps) === null || _popup$extraProps === void 0 ? void 0 : _popup$extraProps.focusedTableMenu) === true;
|
|
29630
|
+
const activeTarget = useObservable(isFocusedTableMenu ? docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.focusedTableTarget$ : docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget$);
|
|
29464
29631
|
const slashMenuRequest = useObservable(docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.slashMenuRequest$);
|
|
29465
29632
|
const paragraph = useObservable(docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.hoverParagraph$);
|
|
29466
29633
|
const paragraphLeft = useObservable(docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.hoverParagraphLeft$);
|
|
29467
|
-
const
|
|
29468
|
-
|
|
29634
|
+
const getActiveTarget = () => {
|
|
29635
|
+
if (isFocusedTableMenu) return (docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.focusedTableTarget) ?? activeTarget;
|
|
29636
|
+
return (docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget) ?? activeTarget;
|
|
29637
|
+
};
|
|
29638
|
+
const setMenuInteractionActive = (active) => {
|
|
29639
|
+
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(active, isFocusedTableMenu);
|
|
29640
|
+
};
|
|
29641
|
+
const rawActiveTarget = getActiveTarget();
|
|
29642
|
+
const currentActiveTarget = (rawActiveTarget === null || rawActiveTarget === void 0 ? void 0 : rawActiveTarget.kind) === "table" === tableBlockOnly ? rawActiveTarget : null;
|
|
29469
29643
|
const activeParagraphBound = (currentActiveTarget === null || currentActiveTarget === void 0 ? void 0 : currentActiveTarget.paragraph) ?? (docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeParagraph) ?? paragraph ?? paragraphLeft;
|
|
29470
29644
|
const startIndex = activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.startIndex;
|
|
29471
29645
|
const dataStream = (doc === null || doc === void 0 || (_doc$getBody = doc.getBody()) === null || _doc$getBody === void 0 ? void 0 : _doc$getBody.dataStream) ?? "";
|
|
@@ -29518,13 +29692,41 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29518
29692
|
if (activeElement === focusedElement || !focusedElement.isConnected && activeElement === body) layoutService.focus();
|
|
29519
29693
|
}, [layoutService]);
|
|
29520
29694
|
useLayoutEffect(() => restoreMenuFocus, [restoreMenuFocus]);
|
|
29521
|
-
const handleHideMenu = () => {
|
|
29695
|
+
const handleHideMenu = useCallback(() => {
|
|
29696
|
+
hoverOpenSchedulerRef.current.cancel();
|
|
29522
29697
|
restoreMenuFocus();
|
|
29523
29698
|
setVisible(false);
|
|
29524
29699
|
setOpenMode("pointer");
|
|
29525
29700
|
targetRangeRef.current = null;
|
|
29526
|
-
|
|
29527
|
-
}
|
|
29701
|
+
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(false, isFocusedTableMenu);
|
|
29702
|
+
}, [
|
|
29703
|
+
docParagraphMenuService,
|
|
29704
|
+
isFocusedTableMenu,
|
|
29705
|
+
restoreMenuFocus
|
|
29706
|
+
]);
|
|
29707
|
+
useEffect(() => {
|
|
29708
|
+
if (!isFocusedTableMenu || !docParagraphMenuService) return;
|
|
29709
|
+
const subscription = docParagraphMenuService.focusedTableMenuDismiss$.subscribe(handleHideMenu);
|
|
29710
|
+
const ownerDocument = popup.canvasElement.ownerDocument;
|
|
29711
|
+
const handleKeydown = (event) => {
|
|
29712
|
+
if (event.key === "Escape") {
|
|
29713
|
+
event.preventDefault();
|
|
29714
|
+
event.stopPropagation();
|
|
29715
|
+
handleHideMenu();
|
|
29716
|
+
}
|
|
29717
|
+
};
|
|
29718
|
+
if (visible) ownerDocument.addEventListener("keydown", handleKeydown, true);
|
|
29719
|
+
return () => {
|
|
29720
|
+
subscription.unsubscribe();
|
|
29721
|
+
ownerDocument.removeEventListener("keydown", handleKeydown, true);
|
|
29722
|
+
};
|
|
29723
|
+
}, [
|
|
29724
|
+
docParagraphMenuService,
|
|
29725
|
+
isFocusedTableMenu,
|
|
29726
|
+
handleHideMenu,
|
|
29727
|
+
popup.canvasElement,
|
|
29728
|
+
visible
|
|
29729
|
+
]);
|
|
29528
29730
|
const clearHideTimer = () => {
|
|
29529
29731
|
if (hideTimerRef.current != null) {
|
|
29530
29732
|
window.clearTimeout(hideTimerRef.current);
|
|
@@ -29542,8 +29744,8 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29542
29744
|
const handleOpenMenu = (mode = "pointer") => {
|
|
29543
29745
|
clearHideTimer();
|
|
29544
29746
|
if (openMode === "slash") return;
|
|
29545
|
-
const latestTarget = (
|
|
29546
|
-
|
|
29747
|
+
const latestTarget = getActiveTarget();
|
|
29748
|
+
setMenuInteractionActive(true);
|
|
29547
29749
|
const targetRange = latestTarget ? {
|
|
29548
29750
|
...latestTarget.menuRange,
|
|
29549
29751
|
segmentId: activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.segmentId
|
|
@@ -29591,7 +29793,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29591
29793
|
return commandService.executeCommand(resolved.commandId, resolved.params);
|
|
29592
29794
|
};
|
|
29593
29795
|
const unwrapActiveBlockRange = async () => {
|
|
29594
|
-
const latestTarget = (
|
|
29796
|
+
const latestTarget = getActiveTarget();
|
|
29595
29797
|
if (!latestTarget || latestTarget.kind !== "blockRange" || !latestTarget.blockRange || !(doc === null || doc === void 0 ? void 0 : doc.getBody())) return null;
|
|
29596
29798
|
const previousBody = doc.getBody();
|
|
29597
29799
|
const { body, range } = unwrapBlockRangeBody(previousBody, latestTarget.blockRange);
|
|
@@ -29614,7 +29816,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29614
29816
|
return nextRange;
|
|
29615
29817
|
};
|
|
29616
29818
|
const executeParagraphMenuOption = async (option) => {
|
|
29617
|
-
const latestTarget = (
|
|
29819
|
+
const latestTarget = getActiveTarget();
|
|
29618
29820
|
const targetRange = getTargetSelectionRange(latestTarget, activeParagraphBound ?? void 0);
|
|
29619
29821
|
const blockRange = getBlockSelectionRange(latestTarget, activeParagraphBound ?? void 0);
|
|
29620
29822
|
const formattingRange = getParagraphFormattingRange(latestTarget, activeParagraphBound ?? void 0);
|
|
@@ -29718,31 +29920,35 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29718
29920
|
const hoverBridgeStyle = visible && (menuDirection === "left" || menuDirection === "right") ? getParagraphMenuHoverBridgeStyle(anchorRect, menuDirection) : void 0;
|
|
29719
29921
|
const resolvedParagraphMenuType = openMode === "slash" ? DOC_PARAGRAPH_T_INSERT_MENU_ID : paragraphMenuType;
|
|
29720
29922
|
useEffect(() => () => {
|
|
29923
|
+
var _dragCleanupRef$curre;
|
|
29924
|
+
(_dragCleanupRef$curre = dragCleanupRef.current) === null || _dragCleanupRef$curre === void 0 || _dragCleanupRef$curre.call(dragCleanupRef);
|
|
29721
29925
|
if (hideTimerRef.current != null) {
|
|
29722
29926
|
window.clearTimeout(hideTimerRef.current);
|
|
29723
29927
|
hideTimerRef.current = null;
|
|
29724
29928
|
}
|
|
29725
29929
|
hoverOpenSchedulerRef.current.cancel();
|
|
29726
|
-
|
|
29727
|
-
}, []);
|
|
29930
|
+
docParagraphMenuService === null || docParagraphMenuService === void 0 || docParagraphMenuService.setParagraphMenuActive(false, isFocusedTableMenu);
|
|
29931
|
+
}, [docParagraphMenuService, isFocusedTableMenu]);
|
|
29728
29932
|
useEffect(() => {
|
|
29729
|
-
if (!slashMenuRequest || handledSlashRequestNonceRef.current >= slashMenuRequest.nonce) return;
|
|
29933
|
+
if (tableBlockOnly || !slashMenuRequest || handledSlashRequestNonceRef.current >= slashMenuRequest.nonce) return;
|
|
29730
29934
|
handledSlashRequestNonceRef.current = slashMenuRequest.nonce;
|
|
29731
29935
|
hoverOpenSchedulerRef.current.cancel();
|
|
29732
29936
|
clearHideTimer();
|
|
29733
29937
|
isMouseOver.current = false;
|
|
29734
29938
|
handleOpenSlashMenu(slashMenuRequest);
|
|
29735
|
-
}, [slashMenuRequest]);
|
|
29939
|
+
}, [slashMenuRequest, tableBlockOnly]);
|
|
29736
29940
|
if (!currentActiveTarget) return null;
|
|
29737
29941
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29738
29942
|
/* @__PURE__ */ jsxs("div", {
|
|
29739
29943
|
"data-u-comp": "paragraph-menu",
|
|
29944
|
+
"data-u-table-menu": tableBlockOnly ? "true" : void 0,
|
|
29945
|
+
"data-u-focused-table-menu": isFocusedTableMenu ? "true" : void 0,
|
|
29740
29946
|
ref: anchorRef,
|
|
29741
|
-
className: clsx("univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-gray-200 univer-bg-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-
|
|
29947
|
+
className: clsx("univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-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", { "univer-bg-gray-100 univer-shadow-md dark:!univer-bg-gray-800": visible }),
|
|
29742
29948
|
onMouseEnter: (e) => {
|
|
29743
29949
|
var _popup$onPointerEnter;
|
|
29744
29950
|
(_popup$onPointerEnter = popup.onPointerEnter) === null || _popup$onPointerEnter === void 0 || _popup$onPointerEnter.call(popup, e);
|
|
29745
|
-
|
|
29951
|
+
setMenuInteractionActive(true);
|
|
29746
29952
|
isMouseOver.current = true;
|
|
29747
29953
|
scheduleOpenMenu();
|
|
29748
29954
|
},
|
|
@@ -29764,7 +29970,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29764
29970
|
title: localeService.t("docs-ui.doc.blockMenu.dragBlock"),
|
|
29765
29971
|
onPointerDown: (event) => {
|
|
29766
29972
|
var _event$currentTarget$, _event$currentTarget;
|
|
29767
|
-
const latestTarget = (
|
|
29973
|
+
const latestTarget = getActiveTarget();
|
|
29768
29974
|
const moveRange = latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.moveRange;
|
|
29769
29975
|
if (!moveRange || !(latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.draggable)) return;
|
|
29770
29976
|
event.preventDefault();
|
|
@@ -29792,6 +29998,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29792
29998
|
window.removeEventListener("pointerup", handlePointerUp);
|
|
29793
29999
|
window.removeEventListener("pointercancel", handlePointerCancel);
|
|
29794
30000
|
window.removeEventListener("blur", handleWindowBlur);
|
|
30001
|
+
dragCleanupRef.current = null;
|
|
29795
30002
|
const range = dragRangeRef.current;
|
|
29796
30003
|
const targetOffset = dragTargetOffsetRef.current;
|
|
29797
30004
|
dragRangeRef.current = null;
|
|
@@ -29807,7 +30014,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29807
30014
|
unitId: popup.unitId,
|
|
29808
30015
|
sourceRange: range,
|
|
29809
30016
|
targetOffset
|
|
29810
|
-
});
|
|
30017
|
+
}).catch((error) => logService.error(error));
|
|
29811
30018
|
};
|
|
29812
30019
|
const handlePointerUp = (upEvent) => {
|
|
29813
30020
|
if (upEvent.pointerId !== pointerId) return;
|
|
@@ -29821,6 +30028,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29821
30028
|
const handleWindowBlur = () => {
|
|
29822
30029
|
finishDrag(false);
|
|
29823
30030
|
};
|
|
30031
|
+
dragCleanupRef.current = () => finishDrag(false);
|
|
29824
30032
|
window.addEventListener("pointermove", handlePointerMove);
|
|
29825
30033
|
window.addEventListener("pointerup", handlePointerUp);
|
|
29826
30034
|
window.addEventListener("pointercancel", handlePointerCancel);
|
|
@@ -29836,7 +30044,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29836
30044
|
onMouseEnter: (e) => {
|
|
29837
30045
|
var _popup$onPointerEnter2;
|
|
29838
30046
|
(_popup$onPointerEnter2 = popup.onPointerEnter) === null || _popup$onPointerEnter2 === void 0 || _popup$onPointerEnter2.call(popup, e);
|
|
29839
|
-
|
|
30047
|
+
setMenuInteractionActive(true);
|
|
29840
30048
|
isMouseOver.current = true;
|
|
29841
30049
|
clearHideTimer();
|
|
29842
30050
|
},
|
|
@@ -29859,7 +30067,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29859
30067
|
onMouseEnter: (e) => {
|
|
29860
30068
|
var _popup$onPointerEnter3;
|
|
29861
30069
|
(_popup$onPointerEnter3 = popup.onPointerEnter) === null || _popup$onPointerEnter3 === void 0 || _popup$onPointerEnter3.call(popup, e);
|
|
29862
|
-
|
|
30070
|
+
setMenuInteractionActive(true);
|
|
29863
30071
|
isMouseOver.current = true;
|
|
29864
30072
|
clearHideTimer();
|
|
29865
30073
|
},
|
|
@@ -29877,7 +30085,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29877
30085
|
autoFocusTarget: openMode === "slash" ? "container" : void 0,
|
|
29878
30086
|
suppressHoverUntilPointerMove: openMode === "slash",
|
|
29879
30087
|
onMenuPointerEnter: () => {
|
|
29880
|
-
|
|
30088
|
+
setMenuInteractionActive(true);
|
|
29881
30089
|
isMouseOver.current = true;
|
|
29882
30090
|
clearHideTimer();
|
|
29883
30091
|
},
|
|
@@ -29891,7 +30099,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
29891
30099
|
onOptionSelect: async (params) => {
|
|
29892
30100
|
const targetRange = targetRangeRef.current ?? getParagraphMenuTargetRange(activeParagraphBound);
|
|
29893
30101
|
const { commandId, params: commandParams } = getParagraphMenuCommand(params, targetRange);
|
|
29894
|
-
const latestTarget = (
|
|
30102
|
+
const latestTarget = getActiveTarget();
|
|
29895
30103
|
if ((latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.kind) === "table" && commandId && targetRange) {
|
|
29896
30104
|
univerInstanceService.focusUnit(popup.unitId);
|
|
29897
30105
|
const tableRange = {
|
|
@@ -30034,6 +30242,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
30034
30242
|
H5Icon,
|
|
30035
30243
|
HeaderFooterIcon,
|
|
30036
30244
|
HorizontallyIcon,
|
|
30245
|
+
InsertBelowDoubleIcon,
|
|
30037
30246
|
InsertDoubleIcon,
|
|
30038
30247
|
InsertRowAboveDoubleIcon,
|
|
30039
30248
|
InsertRowBelowDoubleIcon,
|
|
@@ -30067,6 +30276,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
30067
30276
|
TodoListDoubleIcon,
|
|
30068
30277
|
UnderlineIcon,
|
|
30069
30278
|
UnorderIcon,
|
|
30279
|
+
ZoomInIcon,
|
|
30070
30280
|
DefaultTextColorIcon,
|
|
30071
30281
|
HeaderTextColorIcon,
|
|
30072
30282
|
MoreRightIcon,
|
|
@@ -31222,6 +31432,35 @@ const mobileButtonClassName = `
|
|
|
31222
31432
|
`;
|
|
31223
31433
|
const activeButtonClassName = "univer-bg-primary-100 univer-text-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-primary-400";
|
|
31224
31434
|
function MobileRichTextToolbar({ editorId, className }) {
|
|
31435
|
+
function resolveToolbarState(editor, defaultTextColor) {
|
|
31436
|
+
var _style$ul, _style$st, _style$cl;
|
|
31437
|
+
const body = editor === null || editor === void 0 ? void 0 : editor.getDocumentData().body;
|
|
31438
|
+
const ranges = (editor === null || editor === void 0 ? void 0 : editor.getSelectionRanges()) ?? [];
|
|
31439
|
+
const range = ranges.find((item) => item.isActive) ?? ranges[0];
|
|
31440
|
+
if (!body || !range) return {
|
|
31441
|
+
bold: false,
|
|
31442
|
+
italic: false,
|
|
31443
|
+
underline: false,
|
|
31444
|
+
strike: false,
|
|
31445
|
+
color: defaultTextColor,
|
|
31446
|
+
bulletList: false,
|
|
31447
|
+
orderList: false
|
|
31448
|
+
};
|
|
31449
|
+
const style = getStyleInTextRange(body, range, {});
|
|
31450
|
+
const listTypes = BuildTextUtils.range.getParagraphsInRanges([range], body.paragraphs ?? [], body.dataStream).map((paragraph) => {
|
|
31451
|
+
var _paragraph$bullet;
|
|
31452
|
+
return (_paragraph$bullet = paragraph.bullet) === null || _paragraph$bullet === void 0 ? void 0 : _paragraph$bullet.listType;
|
|
31453
|
+
}).filter((listType) => typeof listType === "string");
|
|
31454
|
+
return {
|
|
31455
|
+
bold: style.bl === BooleanNumber.TRUE,
|
|
31456
|
+
italic: style.it === BooleanNumber.TRUE,
|
|
31457
|
+
underline: ((_style$ul = style.ul) === null || _style$ul === void 0 ? void 0 : _style$ul.s) === BooleanNumber.TRUE,
|
|
31458
|
+
strike: ((_style$st = style.st) === null || _style$st === void 0 ? void 0 : _style$st.s) === BooleanNumber.TRUE,
|
|
31459
|
+
color: ((_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? defaultTextColor,
|
|
31460
|
+
bulletList: Boolean(listTypes.length && listTypes.every((listType) => listType.startsWith(PresetListType.BULLET_LIST))),
|
|
31461
|
+
orderList: Boolean(listTypes.length && listTypes.every((listType) => listType.startsWith(PresetListType.ORDER_LIST)))
|
|
31462
|
+
};
|
|
31463
|
+
}
|
|
31225
31464
|
const commandService = useDependency(ICommandService);
|
|
31226
31465
|
const editorService = useDependency(IEditorService);
|
|
31227
31466
|
const localeService = useDependency(LocaleService);
|
|
@@ -31235,12 +31474,11 @@ function MobileRichTextToolbar({ editorId, className }) {
|
|
|
31235
31474
|
return () => cancelAnimationFrame(frame);
|
|
31236
31475
|
}, [editorId, editorService]);
|
|
31237
31476
|
useEffect(() => {
|
|
31238
|
-
if (!editor) return
|
|
31477
|
+
if (!editor) return;
|
|
31239
31478
|
const subscription = merge$1(editor.input$, editor.selectionChange$).subscribe(() => setRevision((value) => value + 1));
|
|
31240
31479
|
return () => subscription.unsubscribe();
|
|
31241
31480
|
}, [editor]);
|
|
31242
|
-
const
|
|
31243
|
-
const state = resolveToolbarState(editor, defaultTextColor);
|
|
31481
|
+
const state = resolveToolbarState(editor, themeService.getColorFromTheme("gray.900"));
|
|
31244
31482
|
const colors = COLOR_TOKENS.map((token) => themeService.getColorFromTheme(token));
|
|
31245
31483
|
async function execute(commandId, params) {
|
|
31246
31484
|
const activeEditor = editorService.getEditor(editorId);
|
|
@@ -31339,18 +31577,23 @@ function MobileRichTextToolbar({ editorId, className }) {
|
|
|
31339
31577
|
style: { backgroundColor: color },
|
|
31340
31578
|
onClick: () => execute(SetInlineFormatTextColorCommand.id, { value: color })
|
|
31341
31579
|
}, color)),
|
|
31342
|
-
/* @__PURE__ */
|
|
31343
|
-
|
|
31344
|
-
|
|
31345
|
-
|
|
31580
|
+
/* @__PURE__ */ jsx(MobileDropdown, {
|
|
31581
|
+
overlay: /* @__PURE__ */ jsx("div", {
|
|
31582
|
+
className: "univer-px-4 univer-pb-2",
|
|
31583
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
31584
|
+
children: /* @__PURE__ */ jsx(MobileColorPicker, {
|
|
31585
|
+
value: state.color,
|
|
31586
|
+
onChange: (color) => execute(SetInlineFormatTextColorCommand.id, { value: color })
|
|
31587
|
+
})
|
|
31588
|
+
}),
|
|
31589
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
31590
|
+
type: "button",
|
|
31591
|
+
variant: "text",
|
|
31592
|
+
size: "icon",
|
|
31346
31593
|
"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
|
-
})]
|
|
31594
|
+
className: "univer-size-7 univer-justify-self-center",
|
|
31595
|
+
children: /* @__PURE__ */ jsx(ColorWheelMultiIcon, { className: "!univer-size-6" })
|
|
31596
|
+
})
|
|
31354
31597
|
})
|
|
31355
31598
|
]
|
|
31356
31599
|
})
|
|
@@ -31369,35 +31612,6 @@ function FormatButton(props) {
|
|
|
31369
31612
|
})
|
|
31370
31613
|
});
|
|
31371
31614
|
}
|
|
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
31615
|
|
|
31402
31616
|
//#endregion
|
|
31403
31617
|
//#region src/views/rich-text-editor/hooks/editor-undo-redo-keyboard.ts
|
|
@@ -32124,4 +32338,4 @@ function MobileRichTextEditor(props) {
|
|
|
32124
32338
|
}
|
|
32125
32339
|
|
|
32126
32340
|
//#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 };
|
|
32341
|
+
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 };
|