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