@univerjs/docs-drawing-ui 0.24.0 → 0.25.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 +411 -280
- package/lib/cjs/locale/ar-SA.js +66 -0
- package/lib/cjs/locale/ca-ES.js +13 -7
- package/lib/cjs/locale/de-DE.js +66 -0
- package/lib/cjs/locale/en-US.js +13 -7
- package/lib/cjs/locale/es-ES.js +13 -7
- package/lib/cjs/locale/fa-IR.js +13 -7
- package/lib/cjs/locale/fr-FR.js +13 -7
- package/lib/cjs/locale/id-ID.js +66 -0
- package/lib/cjs/locale/it-IT.js +66 -0
- package/lib/cjs/locale/ja-JP.js +13 -7
- package/lib/cjs/locale/ko-KR.js +13 -7
- package/lib/cjs/locale/pl-PL.js +66 -0
- package/lib/cjs/locale/pt-BR.js +66 -0
- package/lib/cjs/locale/ru-RU.js +13 -7
- package/lib/cjs/locale/sk-SK.js +13 -7
- package/lib/cjs/locale/vi-VN.js +13 -7
- package/lib/cjs/locale/zh-CN.js +13 -7
- package/lib/cjs/locale/zh-HK.js +66 -0
- package/lib/cjs/locale/zh-TW.js +13 -7
- package/lib/es/index.js +413 -284
- package/lib/es/locale/ar-SA.js +65 -0
- package/lib/es/locale/ca-ES.js +13 -7
- package/lib/es/locale/de-DE.js +65 -0
- package/lib/es/locale/en-US.js +13 -7
- package/lib/es/locale/es-ES.js +13 -7
- package/lib/es/locale/fa-IR.js +13 -7
- package/lib/es/locale/fr-FR.js +13 -7
- package/lib/es/locale/id-ID.js +65 -0
- package/lib/es/locale/it-IT.js +65 -0
- package/lib/es/locale/ja-JP.js +13 -7
- package/lib/es/locale/ko-KR.js +13 -7
- package/lib/es/locale/pl-PL.js +65 -0
- package/lib/es/locale/pt-BR.js +65 -0
- package/lib/es/locale/ru-RU.js +13 -7
- package/lib/es/locale/sk-SK.js +13 -7
- package/lib/es/locale/vi-VN.js +13 -7
- package/lib/es/locale/zh-CN.js +13 -7
- package/lib/es/locale/zh-HK.js +65 -0
- package/lib/es/locale/zh-TW.js +13 -7
- package/lib/index.js +413 -284
- package/lib/locale/ar-SA.js +65 -0
- package/lib/locale/ca-ES.js +13 -7
- package/lib/locale/de-DE.js +65 -0
- package/lib/locale/en-US.js +13 -7
- package/lib/locale/es-ES.js +13 -7
- package/lib/locale/fa-IR.js +13 -7
- package/lib/locale/fr-FR.js +13 -7
- package/lib/locale/id-ID.js +65 -0
- package/lib/locale/it-IT.js +65 -0
- package/lib/locale/ja-JP.js +13 -7
- package/lib/locale/ko-KR.js +13 -7
- package/lib/locale/pl-PL.js +65 -0
- package/lib/locale/pt-BR.js +65 -0
- package/lib/locale/ru-RU.js +13 -7
- package/lib/locale/sk-SK.js +13 -7
- package/lib/locale/vi-VN.js +13 -7
- package/lib/locale/zh-CN.js +13 -7
- package/lib/locale/zh-HK.js +65 -0
- package/lib/locale/zh-TW.js +13 -7
- package/lib/types/commands/commands/update-doc-drawing.command.d.ts +8 -0
- package/lib/types/controllers/doc-drawing-transformer-update.controller.d.ts +13 -0
- package/lib/types/controllers/render-controllers/doc-drawing-transform-update.controller.d.ts +6 -1
- package/lib/types/controllers/render-controllers/doc-drawing-update.render-controller.d.ts +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +57 -49
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/menu/drawing-popup-menu.controller.d.ts +5 -2
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -0
- 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 -0
- package/lib/umd/locale/it-IT.js +1 -0
- 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 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- 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 -0
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
package/lib/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ArrangeTypeEnum, BooleanNumber, BuildTextUtils, COLORS, CommandType, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DOC_DRAWING_PRINTING_COMPONENT_KEY, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, ICommandService, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, JSONX, LifecycleService, LifecycleStages, LocaleService, MemoryCursor, ObjectRelativeFromH, ObjectRelativeFromV, Plugin, PositionedObjectLayoutType, RedoCommand, RxDisposable, TextX, TextXActionType, Tools, UndoCommand, UniverInstanceType, WrapTextType, fromEventSubject, generateRandomId, isInternalEditorID, merge, throttle, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { IDocDrawingService, UniverDocsDrawingPlugin } from "@univerjs/docs-drawing";
|
|
3
3
|
import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from "@univerjs/docs";
|
|
4
|
-
import { DocCanvasPopManagerService, DocPrintInterceptorService, DocSelectionRenderService, IEditorService, NodePositionConvertToCursor, SetDocZoomRatioOperation, TEXT_RANGE_LAYER_INDEX, VIEWPORT_KEY, docDrawingPositionToTransform, getAnchorBounding, getCustomBlockIdsInSelections, getDocObject, getOneTextSelectionRange, getRichTextEditPath } from "@univerjs/docs-ui";
|
|
5
|
-
import { CURSOR_TYPE, DocumentEditArea, DocumentSkeletonPageType, IRenderManagerService, Liquid, PageLayoutType, Rect, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Vector2, getColor, getCurrentTypeOfRenderer } from "@univerjs/engine-render";
|
|
4
|
+
import { DOC_CONTENT_INSERT_MENU_ID, DocCanvasPopManagerService, DocContentInsertService, DocPrintInterceptorService, DocSelectionRenderService, EMPTY_PARAGRAPH_MENU_ID, IEditorService, INSERT_BELLOW_MENU_ID, NodePositionConvertToCursor, SetDocZoomRatioOperation, TEXT_RANGE_LAYER_INDEX, VIEWPORT_KEY, docDrawingPositionToTransform, getAnchorBounding, getCustomBlockIdsInSelections, getDocObject, getOneTextSelectionRange, getRichTextEditPath } from "@univerjs/docs-ui";
|
|
5
|
+
import { CURSOR_TYPE, DocumentEditArea, DocumentSkeletonPageType, IRenderManagerService, Liquid, PageLayoutType, Rect, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Vector2, getColor, getCurrentTypeOfRenderer, getDocsTableRenderViewport, getTableIdAndSliceIndex } from "@univerjs/engine-render";
|
|
6
6
|
import { Checkbox, InputNumber, MessageType, Radio, RadioGroup, Select, clsx, render, unmount } from "@univerjs/design";
|
|
7
7
|
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, IDrawingManagerService, IImageIoService, ImageUploadStatusType, UniverDrawingPlugin, getDrawingImageAllowSize, getDrawingShapeKeyByDrawingSearch, getImageSize } from "@univerjs/drawing";
|
|
8
|
-
import { CanvasFloatDomService, ComponentManager, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, UniverUIPlugin, connectInjector, getMenuHiddenObservable, useDependency } from "@univerjs/ui";
|
|
8
|
+
import { CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, UniverUIPlugin, connectInjector, getMenuHiddenObservable, useDependency } from "@univerjs/ui";
|
|
9
9
|
import { BehaviorSubject, Observable, debounceTime, filter, map, of, switchMap, takeUntil } from "rxjs";
|
|
10
10
|
import { COMPONENT_IMAGE_POPUP_MENU, DrawingCommonPanel, DrawingRenderService, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
|
|
11
11
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -129,17 +129,26 @@ const InsertDocDrawingCommand = {
|
|
|
129
129
|
id: "doc.command.insert-doc-image",
|
|
130
130
|
type: CommandType.COMMAND,
|
|
131
131
|
handler: (accessor, params) => {
|
|
132
|
-
var _documentDataModel$ge, _documentDataModel$ge2;
|
|
132
|
+
var _ref, _contentInsertRange$s, _documentDataModel$ge, _documentDataModel$ge2;
|
|
133
133
|
if (params == null) return false;
|
|
134
134
|
const commandService = accessor.get(ICommandService);
|
|
135
135
|
const docSelectionManagerService = accessor.get(DocSelectionManagerService);
|
|
136
136
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
137
137
|
const activeTextRange = docSelectionManagerService.getActiveTextRange();
|
|
138
138
|
const documentDataModel = univerInstanceService.getCurrentUniverDocInstance();
|
|
139
|
-
if (
|
|
139
|
+
if (documentDataModel == null) return false;
|
|
140
140
|
const unitId = documentDataModel.getUnitId();
|
|
141
|
+
const contentInsertRange = getContentInsertRange(accessor, unitId);
|
|
142
|
+
const targetTextRange = contentInsertRange ? {
|
|
143
|
+
...activeTextRange,
|
|
144
|
+
startOffset: contentInsertRange.startOffset,
|
|
145
|
+
endOffset: contentInsertRange.endOffset,
|
|
146
|
+
collapsed: contentInsertRange.startOffset === contentInsertRange.endOffset,
|
|
147
|
+
segmentId: (_ref = (_contentInsertRange$s = contentInsertRange.segmentId) !== null && _contentInsertRange$s !== void 0 ? _contentInsertRange$s : activeTextRange === null || activeTextRange === void 0 ? void 0 : activeTextRange.segmentId) !== null && _ref !== void 0 ? _ref : ""
|
|
148
|
+
} : activeTextRange;
|
|
149
|
+
if (targetTextRange == null) return false;
|
|
141
150
|
const { drawings } = params;
|
|
142
|
-
const { collapsed, startOffset, segmentId } =
|
|
151
|
+
const { collapsed, startOffset, segmentId = "" } = targetTextRange;
|
|
143
152
|
const body = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
|
|
144
153
|
if (body == null) return false;
|
|
145
154
|
const textX = new TextX();
|
|
@@ -154,9 +163,9 @@ const InsertDocDrawingCommand = {
|
|
|
154
163
|
});
|
|
155
164
|
} else {
|
|
156
165
|
var _documentDataModel$ge3, _documentDataModel$ge4;
|
|
157
|
-
const dos = BuildTextUtils.selection.delete([
|
|
166
|
+
const dos = BuildTextUtils.selection.delete([targetTextRange], body, 0, null, false);
|
|
158
167
|
textX.push(...dos);
|
|
159
|
-
const removedCustomBlockIds = getCustomBlockIdsInSelections(body, [
|
|
168
|
+
const removedCustomBlockIds = getCustomBlockIdsInSelections(body, [targetTextRange]);
|
|
160
169
|
const drawings = (_documentDataModel$ge3 = documentDataModel.getDrawings()) !== null && _documentDataModel$ge3 !== void 0 ? _documentDataModel$ge3 : {};
|
|
161
170
|
const drawingOrder = (_documentDataModel$ge4 = documentDataModel.getDrawingsOrder()) !== null && _documentDataModel$ge4 !== void 0 ? _documentDataModel$ge4 : [];
|
|
162
171
|
const sortedRemovedCustomBlockIds = removedCustomBlockIds.sort((a, b) => {
|
|
@@ -211,6 +220,20 @@ const InsertDocDrawingCommand = {
|
|
|
211
220
|
return Boolean(result);
|
|
212
221
|
}
|
|
213
222
|
};
|
|
223
|
+
function getContentInsertRange(accessor, unitId) {
|
|
224
|
+
try {
|
|
225
|
+
const range = accessor.get(DocContentInsertService).consumeInsertRange(unitId);
|
|
226
|
+
if (range == null) return null;
|
|
227
|
+
return {
|
|
228
|
+
startOffset: range.startOffset,
|
|
229
|
+
endOffset: range.endOffset,
|
|
230
|
+
collapsed: range.startOffset === range.endOffset,
|
|
231
|
+
segmentId: range.segmentId
|
|
232
|
+
};
|
|
233
|
+
} catch {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
214
237
|
|
|
215
238
|
//#endregion
|
|
216
239
|
//#region src/commands/commands/set-drawing-arrange.command.ts
|
|
@@ -283,7 +306,7 @@ const UngroupDocDrawingCommand = {
|
|
|
283
306
|
};
|
|
284
307
|
|
|
285
308
|
//#endregion
|
|
286
|
-
//#region \0@oxc-project+runtime@0.
|
|
309
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
|
|
287
310
|
function _typeof(o) {
|
|
288
311
|
"@babel/helpers - typeof";
|
|
289
312
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -294,7 +317,7 @@ function _typeof(o) {
|
|
|
294
317
|
}
|
|
295
318
|
|
|
296
319
|
//#endregion
|
|
297
|
-
//#region \0@oxc-project+runtime@0.
|
|
320
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
|
|
298
321
|
function toPrimitive(t, r) {
|
|
299
322
|
if ("object" != _typeof(t) || !t) return t;
|
|
300
323
|
var e = t[Symbol.toPrimitive];
|
|
@@ -307,14 +330,14 @@ function toPrimitive(t, r) {
|
|
|
307
330
|
}
|
|
308
331
|
|
|
309
332
|
//#endregion
|
|
310
|
-
//#region \0@oxc-project+runtime@0.
|
|
333
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
|
|
311
334
|
function toPropertyKey(t) {
|
|
312
335
|
var i = toPrimitive(t, "string");
|
|
313
336
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
314
337
|
}
|
|
315
338
|
|
|
316
339
|
//#endregion
|
|
317
|
-
//#region \0@oxc-project+runtime@0.
|
|
340
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
|
|
318
341
|
function _defineProperty(e, r, t) {
|
|
319
342
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
320
343
|
value: t,
|
|
@@ -337,7 +360,7 @@ var DocRefreshDrawingsService = class {
|
|
|
337
360
|
};
|
|
338
361
|
|
|
339
362
|
//#endregion
|
|
340
|
-
//#region \0@oxc-project+runtime@0.
|
|
363
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
|
|
341
364
|
function __decorateParam(paramIndex, decorator) {
|
|
342
365
|
return function(target, key) {
|
|
343
366
|
decorator(target, key, paramIndex);
|
|
@@ -345,7 +368,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
345
368
|
}
|
|
346
369
|
|
|
347
370
|
//#endregion
|
|
348
|
-
//#region \0@oxc-project+runtime@0.
|
|
371
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
|
|
349
372
|
function __decorate(decorators, target, key, desc) {
|
|
350
373
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
351
374
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -382,6 +405,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
382
405
|
delete this._context;
|
|
383
406
|
}
|
|
384
407
|
async insertDocImage() {
|
|
408
|
+
const insertPosition = this._getCurrentImageInsertPosition();
|
|
385
409
|
const files = await this._fileOpenerService.openFile({
|
|
386
410
|
multiple: true,
|
|
387
411
|
accept: DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image) => `.${image.replace("image/", "")}`).join(",")
|
|
@@ -390,14 +414,14 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
390
414
|
if (fileLength > DRAWING_IMAGE_COUNT_LIMIT) {
|
|
391
415
|
this._messageService.show({
|
|
392
416
|
type: MessageType.Error,
|
|
393
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(DRAWING_IMAGE_COUNT_LIMIT))
|
|
417
|
+
content: this._localeService.t("docs-drawing-ui.update-status.exceedMaxCount", String(DRAWING_IMAGE_COUNT_LIMIT))
|
|
394
418
|
});
|
|
395
419
|
return false;
|
|
396
420
|
} else if (fileLength === 0) return false;
|
|
397
|
-
await this._insertFloatImages(files);
|
|
421
|
+
await this._insertFloatImages(files, insertPosition);
|
|
398
422
|
return true;
|
|
399
423
|
}
|
|
400
|
-
async _insertFloatImages(files) {
|
|
424
|
+
async _insertFloatImages(files, insertPosition) {
|
|
401
425
|
let imageParams = [];
|
|
402
426
|
try {
|
|
403
427
|
imageParams = await Promise.all(files.map((file) => this._imageIoService.saveImage(file)));
|
|
@@ -406,13 +430,13 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
406
430
|
let content = "";
|
|
407
431
|
switch (type) {
|
|
408
432
|
case ImageUploadStatusType.ERROR_EXCEED_SIZE:
|
|
409
|
-
content = this._localeService.t("update-status.exceedMaxSize", String(getDrawingImageAllowSize() / (1024 * 1024)));
|
|
433
|
+
content = this._localeService.t("docs-drawing-ui.update-status.exceedMaxSize", String(getDrawingImageAllowSize() / (1024 * 1024)));
|
|
410
434
|
break;
|
|
411
435
|
case ImageUploadStatusType.ERROR_IMAGE_TYPE:
|
|
412
|
-
content = this._localeService.t("update-status.invalidImageType");
|
|
436
|
+
content = this._localeService.t("docs-drawing-ui.update-status.invalidImageType");
|
|
413
437
|
break;
|
|
414
438
|
case ImageUploadStatusType.ERROR_IMAGE:
|
|
415
|
-
content = this._localeService.t("update-status.invalidImage");
|
|
439
|
+
content = this._localeService.t("docs-drawing-ui.update-status.invalidImage");
|
|
416
440
|
break;
|
|
417
441
|
default: break;
|
|
418
442
|
}
|
|
@@ -435,8 +459,11 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
435
459
|
const scaleHeight = DRAWING_IMAGE_HEIGHT_LIMIT / height;
|
|
436
460
|
scale = Math.min(scaleWidth, scaleHeight);
|
|
437
461
|
}
|
|
438
|
-
const
|
|
462
|
+
const imagePosition = insertPosition !== null && insertPosition !== void 0 ? insertPosition : this._getCurrentImageInsertPosition();
|
|
463
|
+
const docTransform = this._getImagePosition(width * scale, height * scale, imagePosition);
|
|
439
464
|
if (docTransform == null) return;
|
|
465
|
+
const transform = docDrawingPositionToTransform(docTransform);
|
|
466
|
+
if (transform != null && imagePosition != null) transform.top = imagePosition.top;
|
|
440
467
|
const docDrawingParam = {
|
|
441
468
|
unitId,
|
|
442
469
|
subUnitId: unitId,
|
|
@@ -444,7 +471,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
444
471
|
drawingType: DrawingTypeEnum.DRAWING_IMAGE,
|
|
445
472
|
imageSourceType,
|
|
446
473
|
source,
|
|
447
|
-
transform
|
|
474
|
+
transform,
|
|
448
475
|
docTransform,
|
|
449
476
|
behindDoc: BooleanNumber.FALSE,
|
|
450
477
|
title: "",
|
|
@@ -474,9 +501,9 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
474
501
|
const editArea = viewModel === null || viewModel === void 0 ? void 0 : viewModel.getEditArea();
|
|
475
502
|
return editArea === DocumentEditArea.HEADER || editArea === DocumentEditArea.FOOTER;
|
|
476
503
|
}
|
|
477
|
-
_getImagePosition(imageWidth, imageHeight) {
|
|
478
|
-
|
|
479
|
-
const position = (
|
|
504
|
+
_getImagePosition(imageWidth, imageHeight, insertPosition) {
|
|
505
|
+
var _ref;
|
|
506
|
+
const position = (_ref = insertPosition !== null && insertPosition !== void 0 ? insertPosition : this._getCurrentImageInsertPosition()) !== null && _ref !== void 0 ? _ref : {
|
|
480
507
|
left: 0,
|
|
481
508
|
top: 0
|
|
482
509
|
};
|
|
@@ -496,6 +523,15 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
496
523
|
angle: 0
|
|
497
524
|
};
|
|
498
525
|
}
|
|
526
|
+
_getCurrentImageInsertPosition() {
|
|
527
|
+
var _this$_docSelectionRe;
|
|
528
|
+
const position = (_this$_docSelectionRe = this._docSelectionRenderService.getActiveTextRange()) === null || _this$_docSelectionRe === void 0 ? void 0 : _this$_docSelectionRe.getAbsolutePosition();
|
|
529
|
+
if (position == null) return null;
|
|
530
|
+
return {
|
|
531
|
+
left: position.left,
|
|
532
|
+
top: position.top
|
|
533
|
+
};
|
|
534
|
+
}
|
|
499
535
|
_updateOrderListener() {
|
|
500
536
|
this.disposeWithMe(this._drawingManagerService.featurePluginOrderUpdate$.subscribe((params) => {
|
|
501
537
|
const { unitId, subUnitId, drawingIds, arrangeType } = params;
|
|
@@ -678,6 +714,19 @@ const WRAPPING_STYLE_TO_LAYOUT_TYPE = {
|
|
|
678
714
|
["inFrontOfText"]: PositionedObjectLayoutType.WRAP_NONE,
|
|
679
715
|
["behindText"]: PositionedObjectLayoutType.WRAP_NONE
|
|
680
716
|
};
|
|
717
|
+
function findDrawingAnchorInPage(page, drawingId, pageMarginTop, pageMarginLeft) {
|
|
718
|
+
const skeDrawing = page.skeDrawings.get(drawingId);
|
|
719
|
+
if (skeDrawing) return {
|
|
720
|
+
skeDrawing,
|
|
721
|
+
pageMarginTop,
|
|
722
|
+
pageMarginLeft
|
|
723
|
+
};
|
|
724
|
+
for (const table of page.skeTables.values()) for (const row of table.rows) for (const cell of row.cells) {
|
|
725
|
+
const cellAnchor = findDrawingAnchorInPage(cell, drawingId, cell.marginTop, cell.marginLeft);
|
|
726
|
+
if (cellAnchor) return cellAnchor;
|
|
727
|
+
}
|
|
728
|
+
return null;
|
|
729
|
+
}
|
|
681
730
|
function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPage, offset, drawingId, documentDataModel, docSelectionRenderManager) {
|
|
682
731
|
var _oldBody$customBlocks;
|
|
683
732
|
const textX = new TextX();
|
|
@@ -828,43 +877,30 @@ const UpdateDocDrawingWrappingStyleCommand = {
|
|
|
828
877
|
}
|
|
829
878
|
}
|
|
830
879
|
if (wrappingStyle === "inline") continue;
|
|
831
|
-
let
|
|
832
|
-
let pageMarginTop = 0;
|
|
833
|
-
let pageMarginLeft = 0;
|
|
880
|
+
let drawingAnchor = null;
|
|
834
881
|
for (const page of pages) {
|
|
835
882
|
const { headerId, footerId, marginTop, marginLeft, marginBottom, pageWidth, pageHeight } = page;
|
|
836
883
|
switch (editArea) {
|
|
837
884
|
case DocumentEditArea.HEADER: {
|
|
838
885
|
var _skeHeaders$get;
|
|
839
886
|
const headerSke = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
840
|
-
if (headerSke != null
|
|
841
|
-
skeDrawing = headerSke.skeDrawings.get(drawingId);
|
|
842
|
-
pageMarginTop = headerSke.marginTop;
|
|
843
|
-
pageMarginLeft = marginLeft;
|
|
844
|
-
}
|
|
887
|
+
if (headerSke != null) drawingAnchor = findDrawingAnchorInPage(headerSke, drawingId, headerSke.marginTop, marginLeft);
|
|
845
888
|
break;
|
|
846
889
|
}
|
|
847
890
|
case DocumentEditArea.FOOTER: {
|
|
848
891
|
var _skeFooters$get;
|
|
849
892
|
const footerSke = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
850
|
-
if (footerSke != null
|
|
851
|
-
skeDrawing = footerSke.skeDrawings.get(drawingId);
|
|
852
|
-
pageMarginTop = pageHeight - marginBottom + footerSke.marginTop;
|
|
853
|
-
pageMarginLeft = marginLeft;
|
|
854
|
-
}
|
|
893
|
+
if (footerSke != null) drawingAnchor = findDrawingAnchorInPage(footerSke, drawingId, pageHeight - marginBottom + footerSke.marginTop, marginLeft);
|
|
855
894
|
break;
|
|
856
895
|
}
|
|
857
896
|
case DocumentEditArea.BODY:
|
|
858
|
-
|
|
859
|
-
skeDrawing = page.skeDrawings.get(drawingId);
|
|
860
|
-
pageMarginTop = marginTop;
|
|
861
|
-
pageMarginLeft = marginLeft;
|
|
862
|
-
}
|
|
897
|
+
drawingAnchor = findDrawingAnchorInPage(page, drawingId, marginTop, marginLeft);
|
|
863
898
|
break;
|
|
864
899
|
}
|
|
865
|
-
if (
|
|
900
|
+
if (drawingAnchor != null) break;
|
|
866
901
|
}
|
|
867
|
-
if (
|
|
902
|
+
if (drawingAnchor != null) {
|
|
903
|
+
const { skeDrawing, pageMarginTop, pageMarginLeft } = drawingAnchor;
|
|
868
904
|
const { aTop, aLeft } = skeDrawing;
|
|
869
905
|
const oldPositionH = oldDrawings[drawingId].docTransform.positionH;
|
|
870
906
|
let posOffsetH = aLeft;
|
|
@@ -1290,7 +1326,7 @@ const SidebarDocDrawingOperation = {
|
|
|
1290
1326
|
switch (params.value) {
|
|
1291
1327
|
case "open":
|
|
1292
1328
|
sidebarService.open({
|
|
1293
|
-
header: { title: localeService.t("
|
|
1329
|
+
header: { title: localeService.t("docs-drawing-ui.panel.title") },
|
|
1294
1330
|
children: { label: COMPONENT_DOC_DRAWING_PANEL },
|
|
1295
1331
|
onClose: () => {
|
|
1296
1332
|
drawingManagerService.focusDrawing(null);
|
|
@@ -1586,7 +1622,7 @@ function ImageMenuFactory(accessor) {
|
|
|
1586
1622
|
id: DOCS_IMAGE_MENU_ID,
|
|
1587
1623
|
type: MenuItemType.SUBITEMS,
|
|
1588
1624
|
icon: "AddImageIcon",
|
|
1589
|
-
tooltip: "
|
|
1625
|
+
tooltip: "docs-drawing-ui.title",
|
|
1590
1626
|
disabled$: getDisableWhenSelectionInTableObservable(accessor),
|
|
1591
1627
|
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, void 0, DOCS_ZEN_EDITOR_UNIT_ID_KEY)
|
|
1592
1628
|
};
|
|
@@ -1594,8 +1630,9 @@ function ImageMenuFactory(accessor) {
|
|
|
1594
1630
|
function UploadFloatImageMenuFactory(_accessor) {
|
|
1595
1631
|
return {
|
|
1596
1632
|
id: IMAGE_MENU_UPLOAD_FLOAT_ID,
|
|
1597
|
-
title: "
|
|
1633
|
+
title: "docs-drawing-ui.upload.float",
|
|
1598
1634
|
type: MenuItemType.BUTTON,
|
|
1635
|
+
icon: "AddImageIcon",
|
|
1599
1636
|
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_DOC, void 0, DOCS_ZEN_EDITOR_UNIT_ID_KEY)
|
|
1600
1637
|
};
|
|
1601
1638
|
}
|
|
@@ -1603,7 +1640,7 @@ function UploadFloatImageMenuFactory(_accessor) {
|
|
|
1603
1640
|
//#endregion
|
|
1604
1641
|
//#region package.json
|
|
1605
1642
|
var name = "@univerjs/docs-drawing-ui";
|
|
1606
|
-
var version = "0.
|
|
1643
|
+
var version = "0.25.0";
|
|
1607
1644
|
|
|
1608
1645
|
//#endregion
|
|
1609
1646
|
//#region src/config/config.ts
|
|
@@ -1871,12 +1908,219 @@ DocDrawingPrintingController = __decorate([
|
|
|
1871
1908
|
__decorateParam(4, Inject(Injector))
|
|
1872
1909
|
], DocDrawingPrintingController);
|
|
1873
1910
|
|
|
1911
|
+
//#endregion
|
|
1912
|
+
//#region src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
|
|
1913
|
+
function getDocsTableCellDrawingOffset(unitId, table, row, cell) {
|
|
1914
|
+
const sourceTableId = getTableIdAndSliceIndex(table.tableId).tableId;
|
|
1915
|
+
const viewport = getDocsTableRenderViewport(unitId, sourceTableId);
|
|
1916
|
+
const scrollLeft = viewport && viewport.contentWidth > viewport.viewportWidth ? viewport.scrollLeft : 0;
|
|
1917
|
+
return {
|
|
1918
|
+
left: table.left + cell.left - scrollLeft + cell.marginLeft,
|
|
1919
|
+
top: table.top + row.top + cell.marginTop
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateController extends Disposable {
|
|
1923
|
+
constructor(_context, _docSkeletonManagerService, _commandService, _editorService, _drawingManagerService, _docRefreshDrawingsService, _univerInstanceService, _lifecycleService) {
|
|
1924
|
+
super();
|
|
1925
|
+
this._context = _context;
|
|
1926
|
+
this._docSkeletonManagerService = _docSkeletonManagerService;
|
|
1927
|
+
this._commandService = _commandService;
|
|
1928
|
+
this._editorService = _editorService;
|
|
1929
|
+
this._drawingManagerService = _drawingManagerService;
|
|
1930
|
+
this._docRefreshDrawingsService = _docRefreshDrawingsService;
|
|
1931
|
+
this._univerInstanceService = _univerInstanceService;
|
|
1932
|
+
this._lifecycleService = _lifecycleService;
|
|
1933
|
+
_defineProperty(this, "_liquid", new Liquid());
|
|
1934
|
+
this._initialize();
|
|
1935
|
+
this._commandExecutedListener();
|
|
1936
|
+
}
|
|
1937
|
+
_initialize() {
|
|
1938
|
+
this._initialRenderRefresh();
|
|
1939
|
+
this._drawingInitializeListener();
|
|
1940
|
+
this._initResize();
|
|
1941
|
+
}
|
|
1942
|
+
_initialRenderRefresh() {
|
|
1943
|
+
this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe((documentSkeleton) => {
|
|
1944
|
+
if (documentSkeleton == null) return;
|
|
1945
|
+
this._refreshDrawing(documentSkeleton);
|
|
1946
|
+
}));
|
|
1947
|
+
this.disposeWithMe(this._docRefreshDrawingsService.refreshDrawings$.subscribe((skeleton) => {
|
|
1948
|
+
if (skeleton == null) return;
|
|
1949
|
+
this._refreshDrawing(skeleton);
|
|
1950
|
+
}));
|
|
1951
|
+
}
|
|
1952
|
+
_commandExecutedListener() {
|
|
1953
|
+
const updateCommandList = [RichTextEditingMutation.id, SetDocZoomRatioOperation.id];
|
|
1954
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
1955
|
+
if (updateCommandList.includes(command.id)) {
|
|
1956
|
+
const { unitId: commandUnitId } = command.params;
|
|
1957
|
+
const { unitId, mainComponent } = this._context;
|
|
1958
|
+
if (commandUnitId !== unitId) return;
|
|
1959
|
+
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
1960
|
+
if (skeleton == null) return;
|
|
1961
|
+
if (this._editorService.isEditor(unitId) && unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) {
|
|
1962
|
+
mainComponent === null || mainComponent === void 0 || mainComponent.makeDirty();
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
this._refreshDrawing(skeleton);
|
|
1966
|
+
}
|
|
1967
|
+
}));
|
|
1968
|
+
}
|
|
1969
|
+
_initResize() {
|
|
1970
|
+
this.disposeWithMe(fromEventSubject(this._context.engine.onTransformChange$).pipe(filter((evt) => evt.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize), debounceTime(16)).subscribe(() => {
|
|
1971
|
+
var _scene$getTransformer;
|
|
1972
|
+
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
1973
|
+
const { scene } = this._context;
|
|
1974
|
+
(_scene$getTransformer = scene.getTransformer()) === null || _scene$getTransformer === void 0 || _scene$getTransformer.refreshControls();
|
|
1975
|
+
this._refreshDrawing(skeleton);
|
|
1976
|
+
}));
|
|
1977
|
+
}
|
|
1978
|
+
_refreshDrawing(skeleton) {
|
|
1979
|
+
const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
|
|
1980
|
+
const { mainComponent, unitId } = this._context;
|
|
1981
|
+
const documentComponent = mainComponent;
|
|
1982
|
+
if (!skeletonData) return;
|
|
1983
|
+
const { left: docsLeft, top: docsTop, pageLayoutType, pageMarginLeft, pageMarginTop } = documentComponent;
|
|
1984
|
+
const { pages, skeHeaders, skeFooters } = skeletonData;
|
|
1985
|
+
const updateDrawingMap = {};
|
|
1986
|
+
this._liquid.reset();
|
|
1987
|
+
/**
|
|
1988
|
+
* TODO: @DR-Univer We should not refresh all floating elements, but instead make a diff.
|
|
1989
|
+
*/
|
|
1990
|
+
for (let i = 0, len = pages.length; i < len; i++) {
|
|
1991
|
+
const page = pages[i];
|
|
1992
|
+
const { headerId, footerId, pageWidth } = page;
|
|
1993
|
+
if (headerId) {
|
|
1994
|
+
var _skeHeaders$get;
|
|
1995
|
+
const headerPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
1996
|
+
if (headerPage) {
|
|
1997
|
+
this._calculateDrawingPosition(unitId, headerPage, docsLeft, docsTop, updateDrawingMap, headerPage.marginTop, page.marginLeft);
|
|
1998
|
+
this._calculateTableCellDrawingPositions(unitId, headerPage, docsLeft, docsTop, updateDrawingMap, headerPage.marginTop, page.marginLeft);
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
if (footerId) {
|
|
2002
|
+
var _skeFooters$get;
|
|
2003
|
+
const footerPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
2004
|
+
if (footerPage) {
|
|
2005
|
+
const footerTop = page.pageHeight - page.marginBottom + footerPage.marginTop;
|
|
2006
|
+
this._calculateDrawingPosition(unitId, footerPage, docsLeft, docsTop, updateDrawingMap, footerTop, page.marginLeft);
|
|
2007
|
+
this._calculateTableCellDrawingPositions(unitId, footerPage, docsLeft, docsTop, updateDrawingMap, footerTop, page.marginLeft);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
this._calculateDrawingPosition(unitId, page, docsLeft, docsTop, updateDrawingMap, page.marginTop, page.marginLeft);
|
|
2011
|
+
this._calculateTableCellDrawingPositions(unitId, page, docsLeft, docsTop, updateDrawingMap, page.marginTop, page.marginLeft);
|
|
2012
|
+
this._liquid.translatePage(page, pageLayoutType, pageMarginLeft, pageMarginTop);
|
|
2013
|
+
}
|
|
2014
|
+
const updateDrawings = Object.values(updateDrawingMap);
|
|
2015
|
+
const nonMultiDrawings = updateDrawings.filter((drawing) => !drawing.isMultiTransform);
|
|
2016
|
+
const multiDrawings = updateDrawings.filter((drawing) => drawing.isMultiTransform);
|
|
2017
|
+
if (nonMultiDrawings.length > 0) this._drawingManagerService.refreshTransform(nonMultiDrawings);
|
|
2018
|
+
this._handleMultiDrawingsTransform(multiDrawings);
|
|
2019
|
+
}
|
|
2020
|
+
_handleMultiDrawingsTransform(multiDrawings) {
|
|
2021
|
+
const { scene, unitId } = this._context;
|
|
2022
|
+
const transformer = scene.getTransformerByCreate();
|
|
2023
|
+
multiDrawings.forEach((updateParam) => {
|
|
2024
|
+
const param = this._drawingManagerService.getDrawingByParam(updateParam);
|
|
2025
|
+
if (param == null) return;
|
|
2026
|
+
param.transform = updateParam.transform;
|
|
2027
|
+
param.transforms = updateParam.transforms;
|
|
2028
|
+
param.isMultiTransform = updateParam.isMultiTransform;
|
|
2029
|
+
});
|
|
2030
|
+
const selectedObjectKeys = [...transformer.getSelectedObjectMap().keys()];
|
|
2031
|
+
const allMultiDrawings = Object.values(this._drawingManagerService.getDrawingData(unitId, unitId)).filter((drawing) => drawing.isMultiTransform === BooleanNumber.TRUE);
|
|
2032
|
+
this._drawingManagerService.removeNotification(allMultiDrawings);
|
|
2033
|
+
if (multiDrawings.length > 0) this._drawingManagerService.addNotification(multiDrawings);
|
|
2034
|
+
for (const key of selectedObjectKeys) {
|
|
2035
|
+
const drawingShape = scene.getObject(key);
|
|
2036
|
+
if (drawingShape) transformer.setSelectedControl(drawingShape);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
_calculateDrawingPosition(unitId, page, docsLeft, docsTop, updateDrawingMap, marginTop, marginLeft) {
|
|
2040
|
+
const { skeDrawings } = page;
|
|
2041
|
+
this._liquid.translatePagePadding({
|
|
2042
|
+
marginTop,
|
|
2043
|
+
marginLeft
|
|
2044
|
+
});
|
|
2045
|
+
skeDrawings.forEach((drawing) => {
|
|
2046
|
+
const { aLeft, aTop, height, width, angle, drawingId, drawingOrigin } = drawing;
|
|
2047
|
+
const behindText = drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_NONE && drawingOrigin.behindDoc === BooleanNumber.TRUE;
|
|
2048
|
+
const { isMultiTransform = BooleanNumber.FALSE } = drawingOrigin;
|
|
2049
|
+
const transform = {
|
|
2050
|
+
left: aLeft + docsLeft + this._liquid.x,
|
|
2051
|
+
top: aTop + docsTop + this._liquid.y,
|
|
2052
|
+
width,
|
|
2053
|
+
height,
|
|
2054
|
+
angle
|
|
2055
|
+
};
|
|
2056
|
+
if (updateDrawingMap[drawingId] == null) updateDrawingMap[drawingId] = {
|
|
2057
|
+
unitId,
|
|
2058
|
+
subUnitId: unitId,
|
|
2059
|
+
drawingId,
|
|
2060
|
+
behindText,
|
|
2061
|
+
transform,
|
|
2062
|
+
transforms: [transform],
|
|
2063
|
+
isMultiTransform
|
|
2064
|
+
};
|
|
2065
|
+
else if (isMultiTransform === BooleanNumber.TRUE) updateDrawingMap[drawingId].transforms.push(transform);
|
|
2066
|
+
});
|
|
2067
|
+
this._liquid.restorePagePadding({
|
|
2068
|
+
marginTop,
|
|
2069
|
+
marginLeft
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
_calculateTableCellDrawingPositions(unitId, page, docsLeft, docsTop, updateDrawingMap, baseMarginTop, baseMarginLeft) {
|
|
2073
|
+
var _page$skeTables;
|
|
2074
|
+
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table) => {
|
|
2075
|
+
table.rows.forEach((row) => {
|
|
2076
|
+
row.cells.forEach((cell) => {
|
|
2077
|
+
const cellOffset = getDocsTableCellDrawingOffset(unitId, table, row, cell);
|
|
2078
|
+
const marginTop = baseMarginTop + cellOffset.top;
|
|
2079
|
+
const marginLeft = baseMarginLeft + cellOffset.left;
|
|
2080
|
+
this._calculateDrawingPosition(unitId, cell, docsLeft, docsTop, updateDrawingMap, marginTop, marginLeft);
|
|
2081
|
+
this._calculateTableCellDrawingPositions(unitId, cell, docsLeft, docsTop, updateDrawingMap, marginTop, marginLeft);
|
|
2082
|
+
});
|
|
2083
|
+
});
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
_drawingInitializeListener() {
|
|
2087
|
+
const init = () => {
|
|
2088
|
+
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
2089
|
+
if (skeleton == null) return;
|
|
2090
|
+
this._refreshDrawing(skeleton);
|
|
2091
|
+
this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
2092
|
+
};
|
|
2093
|
+
if (this._lifecycleService.stage >= LifecycleStages.Rendered) if (this._docSkeletonManagerService.getSkeleton()) init();
|
|
2094
|
+
else setTimeout(init, 500);
|
|
2095
|
+
else this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(filter((stage) => stage === LifecycleStages.Rendered)).subscribe(init));
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
DocDrawingTransformUpdateController = __decorate([
|
|
2099
|
+
__decorateParam(1, Inject(DocSkeletonManagerService)),
|
|
2100
|
+
__decorateParam(2, ICommandService),
|
|
2101
|
+
__decorateParam(3, IEditorService),
|
|
2102
|
+
__decorateParam(4, IDrawingManagerService),
|
|
2103
|
+
__decorateParam(5, Inject(DocRefreshDrawingsService)),
|
|
2104
|
+
__decorateParam(6, IUniverInstanceService),
|
|
2105
|
+
__decorateParam(7, Inject(LifecycleService))
|
|
2106
|
+
], DocDrawingTransformUpdateController);
|
|
2107
|
+
|
|
1874
2108
|
//#endregion
|
|
1875
2109
|
//#region src/controllers/doc-drawing-transformer-update.controller.ts
|
|
1876
2110
|
const INLINE_DRAWING_ANCHOR_KEY_PREFIX = "__InlineDrawingAnchor__";
|
|
1877
|
-
function
|
|
1878
|
-
|
|
1879
|
-
|
|
2111
|
+
function getDocsTableCellAnchorContext(unitId, cell) {
|
|
2112
|
+
var _row$cells;
|
|
2113
|
+
const row = cell.parent;
|
|
2114
|
+
const table = row === null || row === void 0 ? void 0 : row.parent;
|
|
2115
|
+
const hostPage = table === null || table === void 0 ? void 0 : table.parent;
|
|
2116
|
+
if (!row || !table || !hostPage || !((_row$cells = row.cells) === null || _row$cells === void 0 ? void 0 : _row$cells.includes(cell))) return null;
|
|
2117
|
+
return {
|
|
2118
|
+
cell,
|
|
2119
|
+
hostPage,
|
|
2120
|
+
offset: getDocsTableCellDrawingOffset(unitId, table, row, cell),
|
|
2121
|
+
row,
|
|
2122
|
+
table
|
|
2123
|
+
};
|
|
1880
2124
|
}
|
|
1881
2125
|
let DocDrawingTransformerController = class DocDrawingTransformerController extends Disposable {
|
|
1882
2126
|
constructor(_commandService, _univerInstanceService, _drawingManagerService, _renderManagerService) {
|
|
@@ -2076,7 +2320,6 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
|
|
|
2076
2320
|
const nodePosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.findPositionByGlyph(glyphAnchor, segmentPageIndex);
|
|
2077
2321
|
const docObject = this._getDocObject();
|
|
2078
2322
|
if (nodePosition == null || skeleton == null || docObject == null) return;
|
|
2079
|
-
if (isInTableCell(nodePosition)) return;
|
|
2080
2323
|
const positionWithIsBack = {
|
|
2081
2324
|
...nodePosition,
|
|
2082
2325
|
isBack
|
|
@@ -2092,7 +2335,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
|
|
|
2092
2335
|
};
|
|
2093
2336
|
}
|
|
2094
2337
|
_getDrawingAnchor(drawing, object) {
|
|
2095
|
-
var _this$_renderManagerS2, _glyphAnchor$parent, _column$lines$find, _column$parent, _getOneTextSelectionR2;
|
|
2338
|
+
var _this$_renderManagerS2, _glyphAnchor$parent, _column$lines$find, _column$parent, _tableCellContext$hos, _getOneTextSelectionR2;
|
|
2096
2339
|
const currentRender = this._renderManagerService.getRenderById(drawing.unitId);
|
|
2097
2340
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
|
|
2098
2341
|
const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
|
|
@@ -2143,7 +2386,9 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
|
|
|
2143
2386
|
const page = column === null || column === void 0 || (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : _column$parent.parent;
|
|
2144
2387
|
if (line == null || column == null || paragraphStartLine == null || page == null) return;
|
|
2145
2388
|
this._liquid.reset();
|
|
2146
|
-
const
|
|
2389
|
+
const tableCellContext = page.type === DocumentSkeletonPageType.CELL ? getDocsTableCellAnchorContext(drawing.unitId, page) : null;
|
|
2390
|
+
const anchorPage = (_tableCellContext$hos = tableCellContext === null || tableCellContext === void 0 ? void 0 : tableCellContext.hostPage) !== null && _tableCellContext$hos !== void 0 ? _tableCellContext$hos : page;
|
|
2391
|
+
const pageType = anchorPage.type;
|
|
2147
2392
|
for (const p of pages) {
|
|
2148
2393
|
const { headerId, footerId, pageHeight, pageWidth, marginLeft, marginBottom } = p;
|
|
2149
2394
|
const pIndex = pages.indexOf(p);
|
|
@@ -2169,14 +2414,18 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
|
|
|
2169
2414
|
else throw new Error("footer skeleton not found");
|
|
2170
2415
|
break;
|
|
2171
2416
|
}
|
|
2417
|
+
default:
|
|
2418
|
+
this._liquid.translatePagePadding(p);
|
|
2419
|
+
break;
|
|
2172
2420
|
}
|
|
2173
2421
|
break;
|
|
2174
2422
|
}
|
|
2175
2423
|
this._liquid.translatePagePadding(p);
|
|
2176
|
-
if (p ===
|
|
2424
|
+
if (p === anchorPage) break;
|
|
2177
2425
|
this._liquid.restorePagePadding(p);
|
|
2178
2426
|
this._liquid.translatePage(p, pageLayoutType, pageMarginLeft, pageMarginTop);
|
|
2179
2427
|
}
|
|
2428
|
+
if (tableCellContext) this._liquid.translate(tableCellContext.offset.left, tableCellContext.offset.top);
|
|
2180
2429
|
if (positionV.relativeFrom === ObjectRelativeFromV.LINE) glyphAnchor = line.divides[0].glyphGroup[0];
|
|
2181
2430
|
else {
|
|
2182
2431
|
var _paragraphStartLine$d, _paragraphStartLine$d2;
|
|
@@ -2213,7 +2462,6 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
|
|
|
2213
2462
|
const nodePosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.findPositionByGlyph(glyphAnchor, segmentPage);
|
|
2214
2463
|
const docObject = this._getDocObject();
|
|
2215
2464
|
if (nodePosition == null || skeleton == null || docObject == null) return;
|
|
2216
|
-
if (isInTableCell(nodePosition)) return;
|
|
2217
2465
|
const positionWithIsBack = {
|
|
2218
2466
|
...nodePosition,
|
|
2219
2467
|
isBack
|
|
@@ -2404,14 +2652,30 @@ DocDrawingTransformerController = __decorate([
|
|
|
2404
2652
|
|
|
2405
2653
|
//#endregion
|
|
2406
2654
|
//#region src/menu/schema.ts
|
|
2407
|
-
const menuSchema = {
|
|
2408
|
-
|
|
2409
|
-
menuItemFactory: ImageMenuFactory,
|
|
2410
|
-
[IMAGE_MENU_UPLOAD_FLOAT_ID]: {
|
|
2655
|
+
const menuSchema = {
|
|
2656
|
+
[RibbonInsertGroup.MEDIA]: { [DOCS_IMAGE_MENU_ID]: {
|
|
2411
2657
|
order: 0,
|
|
2412
|
-
menuItemFactory:
|
|
2658
|
+
menuItemFactory: ImageMenuFactory,
|
|
2659
|
+
[IMAGE_MENU_UPLOAD_FLOAT_ID]: {
|
|
2660
|
+
order: 0,
|
|
2661
|
+
menuItemFactory: UploadFloatImageMenuFactory
|
|
2662
|
+
}
|
|
2663
|
+
} },
|
|
2664
|
+
[ContextMenuPosition.PARAGRAPH]: {
|
|
2665
|
+
[ContextMenuGroup.LAYOUT]: { [INSERT_BELLOW_MENU_ID]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
|
|
2666
|
+
order: 5,
|
|
2667
|
+
menuItemFactory: UploadFloatImageMenuFactory
|
|
2668
|
+
} } },
|
|
2669
|
+
[EMPTY_PARAGRAPH_MENU_ID]: { [ContextMenuGroup.LAYOUT]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
|
|
2670
|
+
order: 5,
|
|
2671
|
+
menuItemFactory: UploadFloatImageMenuFactory
|
|
2672
|
+
} } },
|
|
2673
|
+
[DOC_CONTENT_INSERT_MENU_ID]: { [ContextMenuGroup.LAYOUT]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
|
|
2674
|
+
order: 5,
|
|
2675
|
+
menuItemFactory: UploadFloatImageMenuFactory
|
|
2676
|
+
} } }
|
|
2413
2677
|
}
|
|
2414
|
-
}
|
|
2678
|
+
};
|
|
2415
2679
|
|
|
2416
2680
|
//#endregion
|
|
2417
2681
|
//#region src/views/doc-image-panel/DocDrawingPosition.tsx
|
|
@@ -2435,36 +2699,36 @@ const DocDrawingPosition = (props) => {
|
|
|
2435
2699
|
const transformer = scene.getTransformerByCreate();
|
|
2436
2700
|
const HORIZONTAL_RELATIVE_FROM = [
|
|
2437
2701
|
{
|
|
2438
|
-
label: localeService.t("image-position.column"),
|
|
2702
|
+
label: localeService.t("docs-drawing-ui.image-position.column"),
|
|
2439
2703
|
value: String(ObjectRelativeFromH.COLUMN)
|
|
2440
2704
|
},
|
|
2441
2705
|
{
|
|
2442
|
-
label: localeService.t("image-position.page"),
|
|
2706
|
+
label: localeService.t("docs-drawing-ui.image-position.page"),
|
|
2443
2707
|
value: String(ObjectRelativeFromH.PAGE)
|
|
2444
2708
|
},
|
|
2445
2709
|
{
|
|
2446
|
-
label: localeService.t("image-position.margin"),
|
|
2710
|
+
label: localeService.t("docs-drawing-ui.image-position.margin"),
|
|
2447
2711
|
value: String(ObjectRelativeFromH.MARGIN)
|
|
2448
2712
|
}
|
|
2449
2713
|
];
|
|
2450
2714
|
const VERTICAL_RELATIVE_FROM = [
|
|
2451
2715
|
{
|
|
2452
|
-
label: localeService.t("image-position.line"),
|
|
2716
|
+
label: localeService.t("docs-drawing-ui.image-position.line"),
|
|
2453
2717
|
value: String(ObjectRelativeFromV.LINE),
|
|
2454
2718
|
disabled: documentFlavor === DocumentFlavor.MODERN
|
|
2455
2719
|
},
|
|
2456
2720
|
{
|
|
2457
|
-
label: localeService.t("image-position.page"),
|
|
2721
|
+
label: localeService.t("docs-drawing-ui.image-position.page"),
|
|
2458
2722
|
value: String(ObjectRelativeFromV.PAGE),
|
|
2459
2723
|
disabled: documentFlavor === DocumentFlavor.MODERN
|
|
2460
2724
|
},
|
|
2461
2725
|
{
|
|
2462
|
-
label: localeService.t("image-position.margin"),
|
|
2726
|
+
label: localeService.t("docs-drawing-ui.image-position.margin"),
|
|
2463
2727
|
value: String(ObjectRelativeFromV.MARGIN),
|
|
2464
2728
|
disabled: documentFlavor === DocumentFlavor.MODERN
|
|
2465
2729
|
},
|
|
2466
2730
|
{
|
|
2467
|
-
label: localeService.t("image-position.paragraph"),
|
|
2731
|
+
label: localeService.t("docs-drawing-ui.image-position.paragraph"),
|
|
2468
2732
|
value: String(ObjectRelativeFromV.PARAGRAPH)
|
|
2469
2733
|
}
|
|
2470
2734
|
];
|
|
@@ -2633,15 +2897,15 @@ const DocDrawingPosition = (props) => {
|
|
|
2633
2897
|
children: [
|
|
2634
2898
|
/* @__PURE__ */ jsx("header", {
|
|
2635
2899
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2636
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-position.title") })
|
|
2900
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-position.title") })
|
|
2637
2901
|
}),
|
|
2638
2902
|
/* @__PURE__ */ jsx("div", {
|
|
2639
2903
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2640
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-position.horizontal") })
|
|
2904
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-position.horizontal") })
|
|
2641
2905
|
}),
|
|
2642
2906
|
/* @__PURE__ */ jsxs("div", {
|
|
2643
2907
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
2644
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-position.absolutePosition") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2908
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-position.absolutePosition") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2645
2909
|
min: MIN_OFFSET,
|
|
2646
2910
|
max: MAX_OFFSET,
|
|
2647
2911
|
precision: 1,
|
|
@@ -2653,7 +2917,7 @@ const DocDrawingPosition = (props) => {
|
|
|
2653
2917
|
posOffset: val
|
|
2654
2918
|
});
|
|
2655
2919
|
}
|
|
2656
|
-
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-position.toTheRightOf") }), /* @__PURE__ */ jsx(Select, {
|
|
2920
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-position.toTheRightOf") }), /* @__PURE__ */ jsx(Select, {
|
|
2657
2921
|
value: String(hPosition.relativeFrom),
|
|
2658
2922
|
disabled,
|
|
2659
2923
|
options: HORIZONTAL_RELATIVE_FROM,
|
|
@@ -2662,11 +2926,11 @@ const DocDrawingPosition = (props) => {
|
|
|
2662
2926
|
}),
|
|
2663
2927
|
/* @__PURE__ */ jsx("div", {
|
|
2664
2928
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2665
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-position.vertical") })
|
|
2929
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-position.vertical") })
|
|
2666
2930
|
}),
|
|
2667
2931
|
/* @__PURE__ */ jsxs("div", {
|
|
2668
2932
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
2669
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-position.absolutePosition") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2933
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-position.absolutePosition") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2670
2934
|
min: MIN_OFFSET,
|
|
2671
2935
|
max: MAX_OFFSET,
|
|
2672
2936
|
precision: 1,
|
|
@@ -2678,7 +2942,7 @@ const DocDrawingPosition = (props) => {
|
|
|
2678
2942
|
posOffset: val
|
|
2679
2943
|
});
|
|
2680
2944
|
}
|
|
2681
|
-
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-position.bellow") }), /* @__PURE__ */ jsx(Select, {
|
|
2945
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-position.bellow") }), /* @__PURE__ */ jsx(Select, {
|
|
2682
2946
|
disabled,
|
|
2683
2947
|
value: String(vPosition.relativeFrom),
|
|
2684
2948
|
options: VERTICAL_RELATIVE_FROM,
|
|
@@ -2687,13 +2951,13 @@ const DocDrawingPosition = (props) => {
|
|
|
2687
2951
|
}),
|
|
2688
2952
|
/* @__PURE__ */ jsx("div", {
|
|
2689
2953
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2690
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-position.options") })
|
|
2954
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-position.options") })
|
|
2691
2955
|
}),
|
|
2692
2956
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Checkbox, {
|
|
2693
2957
|
disabled,
|
|
2694
2958
|
checked: followTextMove,
|
|
2695
2959
|
onChange: handleFollowTextMoveCheck,
|
|
2696
|
-
children: localeService.t("image-position.moveObjectWithText")
|
|
2960
|
+
children: localeService.t("docs-drawing-ui.image-position.moveObjectWithText")
|
|
2697
2961
|
}) })
|
|
2698
2962
|
]
|
|
2699
2963
|
});
|
|
@@ -2845,11 +3109,11 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2845
3109
|
children: [
|
|
2846
3110
|
/* @__PURE__ */ jsx("header", {
|
|
2847
3111
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2848
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-text-wrap.title") })
|
|
3112
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-text-wrap.title") })
|
|
2849
3113
|
}),
|
|
2850
3114
|
/* @__PURE__ */ jsx("div", {
|
|
2851
3115
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2852
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-text-wrap.wrappingStyle") })
|
|
3116
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-text-wrap.wrappingStyle") })
|
|
2853
3117
|
}),
|
|
2854
3118
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(RadioGroup, {
|
|
2855
3119
|
value: wrappingStyle,
|
|
@@ -2858,29 +3122,29 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2858
3122
|
children: [
|
|
2859
3123
|
/* @__PURE__ */ jsx(Radio, {
|
|
2860
3124
|
value: "inline",
|
|
2861
|
-
children: localeService.t("image-text-wrap.inline")
|
|
3125
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.inline")
|
|
2862
3126
|
}),
|
|
2863
3127
|
/* @__PURE__ */ jsx(Radio, {
|
|
2864
3128
|
value: "wrapSquare",
|
|
2865
|
-
children: localeService.t("image-text-wrap.square")
|
|
3129
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.square")
|
|
2866
3130
|
}),
|
|
2867
3131
|
/* @__PURE__ */ jsx(Radio, {
|
|
2868
3132
|
value: "wrapTopAndBottom",
|
|
2869
|
-
children: localeService.t("image-text-wrap.topAndBottom")
|
|
3133
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.topAndBottom")
|
|
2870
3134
|
}),
|
|
2871
3135
|
/* @__PURE__ */ jsx(Radio, {
|
|
2872
3136
|
value: "behindText",
|
|
2873
|
-
children: localeService.t("image-text-wrap.behindText")
|
|
3137
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.behindText")
|
|
2874
3138
|
}),
|
|
2875
3139
|
/* @__PURE__ */ jsx(Radio, {
|
|
2876
3140
|
value: "inFrontOfText",
|
|
2877
|
-
children: localeService.t("image-text-wrap.inFrontText")
|
|
3141
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.inFrontText")
|
|
2878
3142
|
})
|
|
2879
3143
|
]
|
|
2880
3144
|
}) }),
|
|
2881
3145
|
/* @__PURE__ */ jsx("div", {
|
|
2882
3146
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2883
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-text-wrap.wrapText") })
|
|
3147
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-text-wrap.wrapText") })
|
|
2884
3148
|
}),
|
|
2885
3149
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(RadioGroup, {
|
|
2886
3150
|
disabled: disableWrapText,
|
|
@@ -2890,25 +3154,25 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2890
3154
|
children: [
|
|
2891
3155
|
/* @__PURE__ */ jsx(Radio, {
|
|
2892
3156
|
value: WrapTextType.BOTH_SIDES,
|
|
2893
|
-
children: localeService.t("image-text-wrap.bothSide")
|
|
3157
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.bothSide")
|
|
2894
3158
|
}),
|
|
2895
3159
|
/* @__PURE__ */ jsx(Radio, {
|
|
2896
3160
|
value: WrapTextType.LEFT,
|
|
2897
|
-
children: localeService.t("image-text-wrap.leftOnly")
|
|
3161
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.leftOnly")
|
|
2898
3162
|
}),
|
|
2899
3163
|
/* @__PURE__ */ jsx(Radio, {
|
|
2900
3164
|
value: WrapTextType.RIGHT,
|
|
2901
|
-
children: localeService.t("image-text-wrap.rightOnly")
|
|
3165
|
+
children: localeService.t("docs-drawing-ui.image-text-wrap.rightOnly")
|
|
2902
3166
|
})
|
|
2903
3167
|
]
|
|
2904
3168
|
}) }),
|
|
2905
3169
|
/* @__PURE__ */ jsx("div", {
|
|
2906
3170
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
2907
|
-
children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-text-wrap.distanceFromText") })
|
|
3171
|
+
children: /* @__PURE__ */ jsx("div", { children: localeService.t("docs-drawing-ui.image-text-wrap.distanceFromText") })
|
|
2908
3172
|
}),
|
|
2909
3173
|
/* @__PURE__ */ jsxs("div", {
|
|
2910
3174
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
2911
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-text-wrap.top") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
3175
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-text-wrap.top") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2912
3176
|
min: MIN_MARGIN,
|
|
2913
3177
|
max: MAX_MARGIN,
|
|
2914
3178
|
disabled: disableDistTB,
|
|
@@ -2917,7 +3181,7 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2917
3181
|
onChange: (val) => {
|
|
2918
3182
|
handleDistToTextChange(val, "distT");
|
|
2919
3183
|
}
|
|
2920
|
-
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-text-wrap.left") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
3184
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-text-wrap.left") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2921
3185
|
min: MIN_MARGIN,
|
|
2922
3186
|
max: MAX_MARGIN,
|
|
2923
3187
|
disabled: disableDistLR,
|
|
@@ -2930,7 +3194,7 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2930
3194
|
}),
|
|
2931
3195
|
/* @__PURE__ */ jsxs("div", {
|
|
2932
3196
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
2933
|
-
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-text-wrap.bottom") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
3197
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-text-wrap.bottom") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2934
3198
|
min: MIN_MARGIN,
|
|
2935
3199
|
max: MAX_MARGIN,
|
|
2936
3200
|
disabled: disableDistTB,
|
|
@@ -2939,7 +3203,7 @@ const DocDrawingTextWrap = (props) => {
|
|
|
2939
3203
|
onChange: (val) => {
|
|
2940
3204
|
handleDistToTextChange(val, "distB");
|
|
2941
3205
|
}
|
|
2942
|
-
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("image-text-wrap.right") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
3206
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", { children: localeService.t("docs-drawing-ui.image-text-wrap.right") }), /* @__PURE__ */ jsx(InputNumber, {
|
|
2943
3207
|
min: MIN_MARGIN,
|
|
2944
3208
|
max: MAX_MARGIN,
|
|
2945
3209
|
disabled: disableDistLR,
|
|
@@ -2973,7 +3237,7 @@ const DocDrawingPanel = () => {
|
|
|
2973
3237
|
/* @__PURE__ */ jsx(DrawingCommonPanel, {
|
|
2974
3238
|
drawings,
|
|
2975
3239
|
hasAlign: false,
|
|
2976
|
-
hasCropper:
|
|
3240
|
+
hasCropper: true,
|
|
2977
3241
|
hasGroup: false,
|
|
2978
3242
|
hasTransform: false
|
|
2979
3243
|
}),
|
|
@@ -2990,8 +3254,9 @@ function whenDocDrawingFocused(contextService) {
|
|
|
2990
3254
|
}
|
|
2991
3255
|
const MoveDrawingDownShortcutItem = {
|
|
2992
3256
|
id: MoveDocDrawingsCommand.id,
|
|
2993
|
-
description: "shortcut.drawing-move-down",
|
|
3257
|
+
description: "docs-drawing-ui.shortcut.drawing-move-down",
|
|
2994
3258
|
group: "4_drawing-view",
|
|
3259
|
+
groupTitle: "docs-drawing-ui.shortcut.drawing-view",
|
|
2995
3260
|
binding: KeyCode.ARROW_DOWN,
|
|
2996
3261
|
priority: 100,
|
|
2997
3262
|
preconditions: whenDocDrawingFocused,
|
|
@@ -2999,8 +3264,9 @@ const MoveDrawingDownShortcutItem = {
|
|
|
2999
3264
|
};
|
|
3000
3265
|
const MoveDrawingUpShortcutItem = {
|
|
3001
3266
|
id: MoveDocDrawingsCommand.id,
|
|
3002
|
-
description: "shortcut.drawing-move-up",
|
|
3267
|
+
description: "docs-drawing-ui.shortcut.drawing-move-up",
|
|
3003
3268
|
group: "4_drawing-view",
|
|
3269
|
+
groupTitle: "docs-drawing-ui.shortcut.drawing-view",
|
|
3004
3270
|
binding: KeyCode.ARROW_UP,
|
|
3005
3271
|
priority: 100,
|
|
3006
3272
|
preconditions: whenDocDrawingFocused,
|
|
@@ -3008,8 +3274,9 @@ const MoveDrawingUpShortcutItem = {
|
|
|
3008
3274
|
};
|
|
3009
3275
|
const MoveDrawingLeftShortcutItem = {
|
|
3010
3276
|
id: MoveDocDrawingsCommand.id,
|
|
3011
|
-
description: "shortcut.drawing-move-left",
|
|
3277
|
+
description: "docs-drawing-ui.shortcut.drawing-move-left",
|
|
3012
3278
|
group: "4_drawing-view",
|
|
3279
|
+
groupTitle: "docs-drawing-ui.shortcut.drawing-view",
|
|
3013
3280
|
binding: KeyCode.ARROW_LEFT,
|
|
3014
3281
|
priority: 100,
|
|
3015
3282
|
preconditions: whenDocDrawingFocused,
|
|
@@ -3017,8 +3284,9 @@ const MoveDrawingLeftShortcutItem = {
|
|
|
3017
3284
|
};
|
|
3018
3285
|
const MoveDrawingRightShortcutItem = {
|
|
3019
3286
|
id: MoveDocDrawingsCommand.id,
|
|
3020
|
-
description: "shortcut.drawing-move-right",
|
|
3287
|
+
description: "docs-drawing-ui.shortcut.drawing-move-right",
|
|
3021
3288
|
group: "4_drawing-view",
|
|
3289
|
+
groupTitle: "docs-drawing-ui.shortcut.drawing-view",
|
|
3022
3290
|
binding: KeyCode.ARROW_RIGHT,
|
|
3023
3291
|
priority: 100,
|
|
3024
3292
|
preconditions: whenDocDrawingFocused,
|
|
@@ -3026,8 +3294,9 @@ const MoveDrawingRightShortcutItem = {
|
|
|
3026
3294
|
};
|
|
3027
3295
|
const DeleteDrawingsShortcutItem = {
|
|
3028
3296
|
id: DeleteDocDrawingsCommand.id,
|
|
3029
|
-
description: "shortcut.drawing-delete",
|
|
3297
|
+
description: "docs-drawing-ui.shortcut.drawing-delete",
|
|
3030
3298
|
group: "4_drawing-view",
|
|
3299
|
+
groupTitle: "docs-drawing-ui.shortcut.drawing-view",
|
|
3031
3300
|
preconditions: whenDocDrawingFocused,
|
|
3032
3301
|
binding: KeyCode.DELETE,
|
|
3033
3302
|
mac: KeyCode.BACKSPACE
|
|
@@ -3112,199 +3381,50 @@ DocDrawingUIController = __decorate([
|
|
|
3112
3381
|
__decorateParam(3, IShortcutService)
|
|
3113
3382
|
], DocDrawingUIController);
|
|
3114
3383
|
|
|
3115
|
-
//#endregion
|
|
3116
|
-
//#region src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
|
|
3117
|
-
let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateController extends Disposable {
|
|
3118
|
-
constructor(_context, _docSkeletonManagerService, _commandService, _editorService, _drawingManagerService, _docRefreshDrawingsService, _univerInstanceService, _lifecycleService) {
|
|
3119
|
-
super();
|
|
3120
|
-
this._context = _context;
|
|
3121
|
-
this._docSkeletonManagerService = _docSkeletonManagerService;
|
|
3122
|
-
this._commandService = _commandService;
|
|
3123
|
-
this._editorService = _editorService;
|
|
3124
|
-
this._drawingManagerService = _drawingManagerService;
|
|
3125
|
-
this._docRefreshDrawingsService = _docRefreshDrawingsService;
|
|
3126
|
-
this._univerInstanceService = _univerInstanceService;
|
|
3127
|
-
this._lifecycleService = _lifecycleService;
|
|
3128
|
-
_defineProperty(this, "_liquid", new Liquid());
|
|
3129
|
-
this._initialize();
|
|
3130
|
-
this._commandExecutedListener();
|
|
3131
|
-
}
|
|
3132
|
-
_initialize() {
|
|
3133
|
-
this._initialRenderRefresh();
|
|
3134
|
-
this._drawingInitializeListener();
|
|
3135
|
-
this._initResize();
|
|
3136
|
-
}
|
|
3137
|
-
_initialRenderRefresh() {
|
|
3138
|
-
this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe((documentSkeleton) => {
|
|
3139
|
-
if (documentSkeleton == null) return;
|
|
3140
|
-
this._refreshDrawing(documentSkeleton);
|
|
3141
|
-
}));
|
|
3142
|
-
this.disposeWithMe(this._docRefreshDrawingsService.refreshDrawings$.subscribe((skeleton) => {
|
|
3143
|
-
if (skeleton == null) return;
|
|
3144
|
-
this._refreshDrawing(skeleton);
|
|
3145
|
-
}));
|
|
3146
|
-
}
|
|
3147
|
-
_commandExecutedListener() {
|
|
3148
|
-
const updateCommandList = [RichTextEditingMutation.id, SetDocZoomRatioOperation.id];
|
|
3149
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
3150
|
-
if (updateCommandList.includes(command.id)) {
|
|
3151
|
-
const { unitId: commandUnitId } = command.params;
|
|
3152
|
-
const { unitId, mainComponent } = this._context;
|
|
3153
|
-
if (commandUnitId !== unitId) return;
|
|
3154
|
-
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
3155
|
-
if (skeleton == null) return;
|
|
3156
|
-
if (this._editorService.isEditor(unitId) && unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) {
|
|
3157
|
-
mainComponent === null || mainComponent === void 0 || mainComponent.makeDirty();
|
|
3158
|
-
return;
|
|
3159
|
-
}
|
|
3160
|
-
this._refreshDrawing(skeleton);
|
|
3161
|
-
}
|
|
3162
|
-
}));
|
|
3163
|
-
}
|
|
3164
|
-
_initResize() {
|
|
3165
|
-
this.disposeWithMe(fromEventSubject(this._context.engine.onTransformChange$).pipe(filter((evt) => evt.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize), debounceTime(16)).subscribe(() => {
|
|
3166
|
-
var _scene$getTransformer;
|
|
3167
|
-
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
3168
|
-
const { scene } = this._context;
|
|
3169
|
-
(_scene$getTransformer = scene.getTransformer()) === null || _scene$getTransformer === void 0 || _scene$getTransformer.refreshControls();
|
|
3170
|
-
this._refreshDrawing(skeleton);
|
|
3171
|
-
}));
|
|
3172
|
-
}
|
|
3173
|
-
_refreshDrawing(skeleton) {
|
|
3174
|
-
const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
|
|
3175
|
-
const { mainComponent, unitId } = this._context;
|
|
3176
|
-
const documentComponent = mainComponent;
|
|
3177
|
-
if (!skeletonData) return;
|
|
3178
|
-
const { left: docsLeft, top: docsTop, pageLayoutType, pageMarginLeft, pageMarginTop } = documentComponent;
|
|
3179
|
-
const { pages, skeHeaders, skeFooters } = skeletonData;
|
|
3180
|
-
const updateDrawingMap = {};
|
|
3181
|
-
this._liquid.reset();
|
|
3182
|
-
/**
|
|
3183
|
-
* TODO: @DR-Univer We should not refresh all floating elements, but instead make a diff.
|
|
3184
|
-
*/
|
|
3185
|
-
for (let i = 0, len = pages.length; i < len; i++) {
|
|
3186
|
-
const page = pages[i];
|
|
3187
|
-
const { headerId, footerId, pageWidth } = page;
|
|
3188
|
-
if (headerId) {
|
|
3189
|
-
var _skeHeaders$get;
|
|
3190
|
-
const headerPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
3191
|
-
if (headerPage) this._calculateDrawingPosition(unitId, headerPage, docsLeft, docsTop, updateDrawingMap, headerPage.marginTop, page.marginLeft);
|
|
3192
|
-
}
|
|
3193
|
-
if (footerId) {
|
|
3194
|
-
var _skeFooters$get;
|
|
3195
|
-
const footerPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
3196
|
-
if (footerPage) this._calculateDrawingPosition(unitId, footerPage, docsLeft, docsTop, updateDrawingMap, page.pageHeight - page.marginBottom + footerPage.marginTop, page.marginLeft);
|
|
3197
|
-
}
|
|
3198
|
-
this._calculateDrawingPosition(unitId, page, docsLeft, docsTop, updateDrawingMap, page.marginTop, page.marginLeft);
|
|
3199
|
-
this._liquid.translatePage(page, pageLayoutType, pageMarginLeft, pageMarginTop);
|
|
3200
|
-
}
|
|
3201
|
-
const updateDrawings = Object.values(updateDrawingMap);
|
|
3202
|
-
const nonMultiDrawings = updateDrawings.filter((drawing) => !drawing.isMultiTransform);
|
|
3203
|
-
const multiDrawings = updateDrawings.filter((drawing) => drawing.isMultiTransform);
|
|
3204
|
-
if (nonMultiDrawings.length > 0) this._drawingManagerService.refreshTransform(nonMultiDrawings);
|
|
3205
|
-
this._handleMultiDrawingsTransform(multiDrawings);
|
|
3206
|
-
}
|
|
3207
|
-
_handleMultiDrawingsTransform(multiDrawings) {
|
|
3208
|
-
const { scene, unitId } = this._context;
|
|
3209
|
-
const transformer = scene.getTransformerByCreate();
|
|
3210
|
-
multiDrawings.forEach((updateParam) => {
|
|
3211
|
-
const param = this._drawingManagerService.getDrawingByParam(updateParam);
|
|
3212
|
-
if (param == null) return;
|
|
3213
|
-
param.transform = updateParam.transform;
|
|
3214
|
-
param.transforms = updateParam.transforms;
|
|
3215
|
-
param.isMultiTransform = updateParam.isMultiTransform;
|
|
3216
|
-
});
|
|
3217
|
-
const selectedObjectKeys = [...transformer.getSelectedObjectMap().keys()];
|
|
3218
|
-
const allMultiDrawings = Object.values(this._drawingManagerService.getDrawingData(unitId, unitId)).filter((drawing) => drawing.isMultiTransform === BooleanNumber.TRUE);
|
|
3219
|
-
this._drawingManagerService.removeNotification(allMultiDrawings);
|
|
3220
|
-
if (multiDrawings.length > 0) this._drawingManagerService.addNotification(multiDrawings);
|
|
3221
|
-
for (const key of selectedObjectKeys) {
|
|
3222
|
-
const drawingShape = scene.getObject(key);
|
|
3223
|
-
if (drawingShape) transformer.setSelectedControl(drawingShape);
|
|
3224
|
-
}
|
|
3225
|
-
}
|
|
3226
|
-
_calculateDrawingPosition(unitId, page, docsLeft, docsTop, updateDrawingMap, marginTop, marginLeft) {
|
|
3227
|
-
const { skeDrawings } = page;
|
|
3228
|
-
this._liquid.translatePagePadding({
|
|
3229
|
-
marginTop,
|
|
3230
|
-
marginLeft
|
|
3231
|
-
});
|
|
3232
|
-
skeDrawings.forEach((drawing) => {
|
|
3233
|
-
const { aLeft, aTop, height, width, angle, drawingId, drawingOrigin } = drawing;
|
|
3234
|
-
const behindText = drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_NONE && drawingOrigin.behindDoc === BooleanNumber.TRUE;
|
|
3235
|
-
const { isMultiTransform = BooleanNumber.FALSE } = drawingOrigin;
|
|
3236
|
-
const transform = {
|
|
3237
|
-
left: aLeft + docsLeft + this._liquid.x,
|
|
3238
|
-
top: aTop + docsTop + this._liquid.y,
|
|
3239
|
-
width,
|
|
3240
|
-
height,
|
|
3241
|
-
angle
|
|
3242
|
-
};
|
|
3243
|
-
if (updateDrawingMap[drawingId] == null) updateDrawingMap[drawingId] = {
|
|
3244
|
-
unitId,
|
|
3245
|
-
subUnitId: unitId,
|
|
3246
|
-
drawingId,
|
|
3247
|
-
behindText,
|
|
3248
|
-
transform,
|
|
3249
|
-
transforms: [transform],
|
|
3250
|
-
isMultiTransform
|
|
3251
|
-
};
|
|
3252
|
-
else if (isMultiTransform === BooleanNumber.TRUE) updateDrawingMap[drawingId].transforms.push(transform);
|
|
3253
|
-
});
|
|
3254
|
-
this._liquid.restorePagePadding({
|
|
3255
|
-
marginTop,
|
|
3256
|
-
marginLeft
|
|
3257
|
-
});
|
|
3258
|
-
}
|
|
3259
|
-
_drawingInitializeListener() {
|
|
3260
|
-
const init = () => {
|
|
3261
|
-
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
3262
|
-
if (skeleton == null) return;
|
|
3263
|
-
this._refreshDrawing(skeleton);
|
|
3264
|
-
this._drawingManagerService.initializeNotification(this._context.unitId);
|
|
3265
|
-
};
|
|
3266
|
-
if (this._lifecycleService.stage >= LifecycleStages.Rendered) if (this._docSkeletonManagerService.getSkeleton()) init();
|
|
3267
|
-
else setTimeout(init, 500);
|
|
3268
|
-
else this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(filter((stage) => stage === LifecycleStages.Rendered)).subscribe(init));
|
|
3269
|
-
}
|
|
3270
|
-
};
|
|
3271
|
-
DocDrawingTransformUpdateController = __decorate([
|
|
3272
|
-
__decorateParam(1, Inject(DocSkeletonManagerService)),
|
|
3273
|
-
__decorateParam(2, ICommandService),
|
|
3274
|
-
__decorateParam(3, IEditorService),
|
|
3275
|
-
__decorateParam(4, IDrawingManagerService),
|
|
3276
|
-
__decorateParam(5, Inject(DocRefreshDrawingsService)),
|
|
3277
|
-
__decorateParam(6, IUniverInstanceService),
|
|
3278
|
-
__decorateParam(7, Inject(LifecycleService))
|
|
3279
|
-
], DocDrawingTransformUpdateController);
|
|
3280
|
-
|
|
3281
3384
|
//#endregion
|
|
3282
3385
|
//#region src/menu/drawing-popup-menu.controller.ts
|
|
3283
3386
|
let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends RxDisposable {
|
|
3284
|
-
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService) {
|
|
3387
|
+
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _commandService) {
|
|
3285
3388
|
super();
|
|
3286
3389
|
this._drawingManagerService = _drawingManagerService;
|
|
3287
3390
|
this._canvasPopManagerService = _canvasPopManagerService;
|
|
3288
3391
|
this._renderManagerService = _renderManagerService;
|
|
3289
3392
|
this._univerInstanceService = _univerInstanceService;
|
|
3290
3393
|
this._contextService = _contextService;
|
|
3394
|
+
this._commandService = _commandService;
|
|
3291
3395
|
_defineProperty(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
3292
3396
|
_defineProperty(this, "_disposePopups", []);
|
|
3397
|
+
_defineProperty(this, "_isDrawingPanelOpen", false);
|
|
3293
3398
|
this._init();
|
|
3294
3399
|
}
|
|
3295
3400
|
_init() {
|
|
3401
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
3402
|
+
if (command.id === EditDocDrawingOperation.id) {
|
|
3403
|
+
this._isDrawingPanelOpen = true;
|
|
3404
|
+
this._clearPopups();
|
|
3405
|
+
}
|
|
3406
|
+
if (command.id === SidebarDocDrawingOperation.id) {
|
|
3407
|
+
const params = command.params;
|
|
3408
|
+
this._isDrawingPanelOpen = (params === null || params === void 0 ? void 0 : params.value) === "open";
|
|
3409
|
+
if (this._isDrawingPanelOpen) this._clearPopups();
|
|
3410
|
+
}
|
|
3411
|
+
}));
|
|
3412
|
+
this.disposeWithMe(this._drawingManagerService.focus$.subscribe((params) => {
|
|
3413
|
+
if (params.length === 0) this._isDrawingPanelOpen = false;
|
|
3414
|
+
}));
|
|
3296
3415
|
this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentDataModel) => this._create(documentDataModel)));
|
|
3297
3416
|
this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((documentDataModel) => this._dispose(documentDataModel)));
|
|
3298
3417
|
this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_DOC).forEach((documentDataModel) => this._create(documentDataModel));
|
|
3299
3418
|
}
|
|
3300
3419
|
_dispose(documentDataModel) {
|
|
3301
3420
|
const unitId = documentDataModel.getUnitId();
|
|
3302
|
-
|
|
3303
|
-
this._disposePopups.forEach((dispose) => dispose.dispose());
|
|
3304
|
-
this._disposePopups.length = 0;
|
|
3305
|
-
}
|
|
3421
|
+
this._clearPopups();
|
|
3306
3422
|
this._renderManagerService.removeRender(unitId);
|
|
3307
3423
|
}
|
|
3424
|
+
_clearPopups() {
|
|
3425
|
+
this._disposePopups.forEach((dispose) => dispose.dispose());
|
|
3426
|
+
this._disposePopups.length = 0;
|
|
3427
|
+
}
|
|
3308
3428
|
_create(documentDataModel) {
|
|
3309
3429
|
if (!documentDataModel) return;
|
|
3310
3430
|
const unitId = documentDataModel.getUnitId();
|
|
@@ -3331,18 +3451,26 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
3331
3451
|
const selectedObjects = transformer.getSelectedObjectMap();
|
|
3332
3452
|
disposePopups.forEach((dispose) => dispose.dispose());
|
|
3333
3453
|
disposePopups.length = 0;
|
|
3454
|
+
if (this._isDrawingPanelOpen) return;
|
|
3334
3455
|
if (selectedObjects.size > 1) return;
|
|
3335
3456
|
const object = selectedObjects.values().next().value;
|
|
3336
3457
|
if (!object) return;
|
|
3337
3458
|
const oKey = object.oKey;
|
|
3338
3459
|
const drawingParam = this._drawingManagerService.getDrawingOKey(oKey);
|
|
3339
|
-
if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM) return;
|
|
3460
|
+
if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM || drawingParam.drawingType === DrawingTypeEnum.DRAWING_SHAPE) return;
|
|
3340
3461
|
const { unitId, subUnitId, drawingId, drawingType } = drawingParam;
|
|
3462
|
+
const isImage = drawingType === DrawingTypeEnum.DRAWING_IMAGE;
|
|
3341
3463
|
const popup = this._canvasPopManagerService.attachPopupToObject(object, {
|
|
3342
3464
|
componentKey: COMPONENT_IMAGE_POPUP_MENU,
|
|
3343
|
-
direction: "horizontal",
|
|
3344
|
-
offset: [2, 0],
|
|
3345
|
-
extraProps: {
|
|
3465
|
+
direction: isImage ? "top-center" : "horizontal",
|
|
3466
|
+
offset: isImage ? [0, 8] : [2, 0],
|
|
3467
|
+
extraProps: {
|
|
3468
|
+
menuItems: this._getImageMenuItems(unitId, subUnitId, drawingId, drawingType),
|
|
3469
|
+
variant: isImage ? "doc-floating-toolbar" : void 0,
|
|
3470
|
+
unitId,
|
|
3471
|
+
subUnitId,
|
|
3472
|
+
drawingId
|
|
3473
|
+
}
|
|
3346
3474
|
}, unitId);
|
|
3347
3475
|
disposePopups.push(this.disposeWithMe(popup));
|
|
3348
3476
|
if (this._drawingManagerService.getFocusDrawings().find((drawing) => drawing.unitId === unitId && drawing.subUnitId === subUnitId && drawing.drawingId === drawingId)) return;
|
|
@@ -3370,7 +3498,7 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
3370
3498
|
_getImageMenuItems(unitId, subUnitId, drawingId, drawingType) {
|
|
3371
3499
|
return [
|
|
3372
3500
|
{
|
|
3373
|
-
label: "image-popup.edit",
|
|
3501
|
+
label: "docs-drawing-ui.image-popup.edit",
|
|
3374
3502
|
index: 0,
|
|
3375
3503
|
commandId: EditDocDrawingOperation.id,
|
|
3376
3504
|
commandParams: {
|
|
@@ -3378,10 +3506,10 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
3378
3506
|
subUnitId,
|
|
3379
3507
|
drawingId
|
|
3380
3508
|
},
|
|
3381
|
-
disable:
|
|
3509
|
+
disable: drawingType === DrawingTypeEnum.DRAWING_DOM
|
|
3382
3510
|
},
|
|
3383
3511
|
{
|
|
3384
|
-
label: "image-popup.delete",
|
|
3512
|
+
label: "docs-drawing-ui.image-popup.delete",
|
|
3385
3513
|
index: 1,
|
|
3386
3514
|
commandId: RemoveDocDrawingCommand.id,
|
|
3387
3515
|
commandParams: {
|
|
@@ -3395,7 +3523,7 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
3395
3523
|
disable: false
|
|
3396
3524
|
},
|
|
3397
3525
|
{
|
|
3398
|
-
label: "image-popup.crop",
|
|
3526
|
+
label: "docs-drawing-ui.image-popup.crop",
|
|
3399
3527
|
index: 2,
|
|
3400
3528
|
commandId: OpenImageCropOperation.id,
|
|
3401
3529
|
commandParams: {
|
|
@@ -3403,10 +3531,10 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
3403
3531
|
subUnitId,
|
|
3404
3532
|
drawingId
|
|
3405
3533
|
},
|
|
3406
|
-
disable:
|
|
3534
|
+
disable: drawingType === DrawingTypeEnum.DRAWING_DOM
|
|
3407
3535
|
},
|
|
3408
3536
|
{
|
|
3409
|
-
label: "image-popup.reset",
|
|
3537
|
+
label: "docs-drawing-ui.image-popup.reset",
|
|
3410
3538
|
index: 3,
|
|
3411
3539
|
commandId: ImageResetSizeOperation.id,
|
|
3412
3540
|
commandParams: [{
|
|
@@ -3424,7 +3552,8 @@ DocDrawingPopupMenuController = __decorate([
|
|
|
3424
3552
|
__decorateParam(1, Inject(DocCanvasPopManagerService)),
|
|
3425
3553
|
__decorateParam(2, IRenderManagerService),
|
|
3426
3554
|
__decorateParam(3, IUniverInstanceService),
|
|
3427
|
-
__decorateParam(4, IContextService)
|
|
3555
|
+
__decorateParam(4, IContextService),
|
|
3556
|
+
__decorateParam(5, ICommandService)
|
|
3428
3557
|
], DocDrawingPopupMenuController);
|
|
3429
3558
|
|
|
3430
3559
|
//#endregion
|
|
@@ -3474,4 +3603,4 @@ UniverDocsDrawingUIPlugin = __decorate([
|
|
|
3474
3603
|
], UniverDocsDrawingUIPlugin);
|
|
3475
3604
|
|
|
3476
3605
|
//#endregion
|
|
3477
|
-
export { ClearDocDrawingTransformerOperation, DOCS_IMAGE_MENU_ID, DeleteDocDrawingsCommand, DocFloatDomController, EditDocDrawingOperation, GroupDocDrawingCommand, InsertDocDrawingCommand, InsertDocImageCommand, MoveDocDrawingsCommand, RemoveDocDrawingCommand, SetDocDrawingArrangeCommand, SidebarDocDrawingOperation, UngroupDocDrawingCommand, UniverDocsDrawingUIPlugin };
|
|
3606
|
+
export { ClearDocDrawingTransformerOperation, DOCS_IMAGE_MENU_ID, DeleteDocDrawingsCommand, DocDrawingPosition, DocDrawingTextWrap, DocFloatDomController, EditDocDrawingOperation, GroupDocDrawingCommand, InsertDocDrawingCommand, InsertDocImageCommand, MoveDocDrawingsCommand, RemoveDocDrawingCommand, SetDocDrawingArrangeCommand, SidebarDocDrawingOperation, UngroupDocDrawingCommand, UniverDocsDrawingUIPlugin };
|