@univerjs/docs-ui 1.0.0-alpha.6 → 1.0.0-alpha.8
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 +1102 -427
- package/lib/cjs/locale/ar-SA.js +39 -26
- package/lib/cjs/locale/ca-ES.js +39 -26
- package/lib/cjs/locale/de-DE.js +39 -26
- package/lib/cjs/locale/en-US.js +14 -1
- package/lib/cjs/locale/es-ES.js +39 -26
- package/lib/cjs/locale/fa-IR.js +41 -28
- package/lib/cjs/locale/fr-FR.js +42 -29
- package/lib/cjs/locale/id-ID.js +39 -26
- package/lib/cjs/locale/it-IT.js +39 -26
- package/lib/cjs/locale/ja-JP.js +39 -26
- package/lib/cjs/locale/ko-KR.js +39 -26
- package/lib/cjs/locale/pl-PL.js +38 -25
- package/lib/cjs/locale/pt-BR.js +39 -26
- package/lib/cjs/locale/ru-RU.js +39 -26
- package/lib/cjs/locale/sk-SK.js +39 -26
- package/lib/cjs/locale/vi-VN.js +60 -47
- package/lib/cjs/locale/zh-CN.js +14 -1
- package/lib/cjs/locale/zh-HK.js +66 -53
- package/lib/cjs/locale/zh-TW.js +48 -35
- package/lib/es/index.js +1108 -388
- package/lib/es/locale/ar-SA.js +39 -26
- package/lib/es/locale/ca-ES.js +39 -26
- package/lib/es/locale/de-DE.js +39 -26
- package/lib/es/locale/en-US.js +14 -1
- package/lib/es/locale/es-ES.js +39 -26
- package/lib/es/locale/fa-IR.js +41 -28
- package/lib/es/locale/fr-FR.js +42 -29
- package/lib/es/locale/id-ID.js +39 -26
- package/lib/es/locale/it-IT.js +39 -26
- package/lib/es/locale/ja-JP.js +39 -26
- package/lib/es/locale/ko-KR.js +39 -26
- package/lib/es/locale/pl-PL.js +38 -25
- package/lib/es/locale/pt-BR.js +39 -26
- package/lib/es/locale/ru-RU.js +39 -26
- package/lib/es/locale/sk-SK.js +39 -26
- package/lib/es/locale/vi-VN.js +60 -47
- package/lib/es/locale/zh-CN.js +14 -1
- package/lib/es/locale/zh-HK.js +66 -53
- package/lib/es/locale/zh-TW.js +48 -35
- package/lib/index.css +4 -8
- package/lib/index.js +1108 -388
- package/lib/locale/ar-SA.js +39 -26
- package/lib/locale/ca-ES.js +39 -26
- package/lib/locale/de-DE.js +39 -26
- package/lib/locale/en-US.js +14 -1
- package/lib/locale/es-ES.js +39 -26
- package/lib/locale/fa-IR.js +41 -28
- package/lib/locale/fr-FR.js +42 -29
- package/lib/locale/id-ID.js +39 -26
- package/lib/locale/it-IT.js +39 -26
- package/lib/locale/ja-JP.js +39 -26
- package/lib/locale/ko-KR.js +39 -26
- package/lib/locale/pl-PL.js +38 -25
- package/lib/locale/pt-BR.js +39 -26
- package/lib/locale/ru-RU.js +39 -26
- package/lib/locale/sk-SK.js +39 -26
- package/lib/locale/vi-VN.js +60 -47
- package/lib/locale/zh-CN.js +14 -1
- package/lib/locale/zh-HK.js +66 -53
- package/lib/locale/zh-TW.js +48 -35
- package/lib/types/basics/component-tools.d.ts +3 -5
- package/lib/types/basics/doc-custom-range-chrome.d.ts +31 -0
- package/lib/types/basics/paragraph.d.ts +1 -0
- package/lib/types/commands/commands/clipboard.inner.command.d.ts +2 -0
- package/lib/types/commands/commands/insert-special-character.command.d.ts +19 -0
- package/lib/types/commands/commands/replace-content.command.d.ts +10 -14
- package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +2 -0
- package/lib/types/commands/operations/insert-break.operation.d.ts +21 -0
- package/lib/types/controllers/doc-move-cursor.controller.d.ts +0 -1
- package/lib/types/controllers/doc-section-setting.controller.d.ts +4 -1
- package/lib/types/controllers/render-controllers/doc-paragraph-placeholder.render-controller.d.ts +11 -2
- package/lib/types/index.d.ts +10 -9
- package/lib/types/locale/en-US.d.ts +13 -0
- package/lib/types/menu/menu.d.ts +17 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +14 -4
- package/lib/types/services/clipboard/doc-paste-mutation-adapter.service.d.ts +11 -1
- package/lib/types/services/editor/editor-manager.service.d.ts +1 -0
- package/lib/types/services/editor/editor.d.ts +7 -26
- package/lib/types/services/float-menu.service.d.ts +5 -2
- package/lib/types/services/selection/convert-text-range.d.ts +1 -1
- package/lib/types/services/selection/doc-selection-render.service.d.ts +2 -3
- package/lib/types/views/ParagraphMenu.d.ts +1 -0
- package/lib/types/views/float-toolbar/FloatToolbar.d.ts +10 -3
- package/lib/types/views/paragraph-setting/hook/utils.d.ts +2 -0
- package/lib/types/views/rich-text-editor/hooks/use-keyboard-event.d.ts +2 -1
- package/lib/types/views/section-setting/use-section-setting.d.ts +33 -2
- package/lib/umd/index.js +10 -9
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +10 -10
package/lib/cjs/index.js
CHANGED
|
@@ -55,23 +55,8 @@ function neoGetDocObject(renderContext) {
|
|
|
55
55
|
engine
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
/** @deprecated After migrating to `RenderUnit`, use `neoGetDocObject` instead. */
|
|
59
|
-
function getDocObject(univerInstanceService, renderManagerService) {
|
|
60
|
-
const documentModel = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
61
|
-
if (!documentModel) return null;
|
|
62
|
-
const unitId = documentModel.getUnitId();
|
|
63
|
-
const currentRender = renderManagerService.getRenderById(unitId);
|
|
64
|
-
if (currentRender == null) return;
|
|
65
|
-
const { mainComponent, scene, engine, components } = currentRender;
|
|
66
|
-
return {
|
|
67
|
-
document: mainComponent,
|
|
68
|
-
docBackground: components.get("__Document_Render_Background__"),
|
|
69
|
-
scene,
|
|
70
|
-
engine
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
58
|
function getDocObjectById(unitId, renderManagerService) {
|
|
74
|
-
const currentRender = renderManagerService.
|
|
59
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
75
60
|
if (currentRender == null) return;
|
|
76
61
|
const { mainComponent, scene, engine, components } = currentRender;
|
|
77
62
|
return {
|
|
@@ -149,8 +134,36 @@ function deleteCustomDecorationFactory(accessor, params) {
|
|
|
149
134
|
return doMutation;
|
|
150
135
|
}
|
|
151
136
|
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/basics/doc-custom-range-chrome.ts
|
|
139
|
+
const DOC_CUSTOM_RANGE_CHROME_RADIUS = 1;
|
|
140
|
+
const DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA = .07;
|
|
141
|
+
function resolveDocCustomRangeChromeTheme(themeService) {
|
|
142
|
+
const primary = themeService.getColorFromTheme("primary.600");
|
|
143
|
+
return {
|
|
144
|
+
background: new _univerjs_core.ColorKit(primary).setAlpha(DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA).toRgbString(),
|
|
145
|
+
border: primary
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function drawDocCustomRangeChrome(ctx, rect, theme) {
|
|
149
|
+
ctx.save();
|
|
150
|
+
ctx.fillStyle = theme.background;
|
|
151
|
+
ctx.strokeStyle = theme.border;
|
|
152
|
+
ctx.lineWidth = 1;
|
|
153
|
+
ctx.beginPath();
|
|
154
|
+
ctx.roundRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 1);
|
|
155
|
+
ctx.fill();
|
|
156
|
+
ctx.stroke();
|
|
157
|
+
ctx.restore();
|
|
158
|
+
}
|
|
159
|
+
|
|
152
160
|
//#endregion
|
|
153
161
|
//#region src/basics/paragraph.ts
|
|
162
|
+
function isTopLevelStructuralGap(dataStream, offset) {
|
|
163
|
+
const previousToken = dataStream[offset - 1];
|
|
164
|
+
const nextToken = dataStream[offset];
|
|
165
|
+
return previousToken === _univerjs_core.DataStreamTreeTokenType.BLOCK_END || previousToken === _univerjs_core.DataStreamTreeTokenType.TABLE_END || previousToken === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_END || nextToken === _univerjs_core.DataStreamTreeTokenType.BLOCK_START || nextToken === _univerjs_core.DataStreamTreeTokenType.TABLE_START || nextToken === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_START;
|
|
166
|
+
}
|
|
154
167
|
function hasParagraphInTable(paragraph, tables) {
|
|
155
168
|
return tables.some((table) => paragraph.startIndex > table.startIndex && paragraph.startIndex < table.endIndex);
|
|
156
169
|
}
|
|
@@ -201,7 +214,7 @@ function getCustomDecorationAtPosition(customDecorations, position) {
|
|
|
201
214
|
}
|
|
202
215
|
|
|
203
216
|
//#endregion
|
|
204
|
-
//#region \0@oxc-project+runtime@0.
|
|
217
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
205
218
|
function _typeof(o) {
|
|
206
219
|
"@babel/helpers - typeof";
|
|
207
220
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -212,7 +225,7 @@ function _typeof(o) {
|
|
|
212
225
|
}
|
|
213
226
|
|
|
214
227
|
//#endregion
|
|
215
|
-
//#region \0@oxc-project+runtime@0.
|
|
228
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
216
229
|
function toPrimitive(t, r) {
|
|
217
230
|
if ("object" != _typeof(t) || !t) return t;
|
|
218
231
|
var e = t[Symbol.toPrimitive];
|
|
@@ -225,14 +238,14 @@ function toPrimitive(t, r) {
|
|
|
225
238
|
}
|
|
226
239
|
|
|
227
240
|
//#endregion
|
|
228
|
-
//#region \0@oxc-project+runtime@0.
|
|
241
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
229
242
|
function toPropertyKey(t) {
|
|
230
243
|
var i = toPrimitive(t, "string");
|
|
231
244
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
232
245
|
}
|
|
233
246
|
|
|
234
247
|
//#endregion
|
|
235
|
-
//#region \0@oxc-project+runtime@0.
|
|
248
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
236
249
|
function _defineProperty(e, r, t) {
|
|
237
250
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
238
251
|
value: t,
|
|
@@ -243,7 +256,7 @@ function _defineProperty(e, r, t) {
|
|
|
243
256
|
}
|
|
244
257
|
|
|
245
258
|
//#endregion
|
|
246
|
-
//#region \0@oxc-project+runtime@0.
|
|
259
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
247
260
|
function __decorateParam(paramIndex, decorator) {
|
|
248
261
|
return function(target, key) {
|
|
249
262
|
decorator(target, key, paramIndex);
|
|
@@ -251,7 +264,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
251
264
|
}
|
|
252
265
|
|
|
253
266
|
//#endregion
|
|
254
|
-
//#region \0@oxc-project+runtime@0.
|
|
267
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
255
268
|
function __decorate(decorators, target, key, desc) {
|
|
256
269
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
257
270
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -376,7 +389,7 @@ let DocMenuStyleService = class DocMenuStyleService extends _univerjs_core.Dispo
|
|
|
376
389
|
const docDataModel = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
377
390
|
if (docDataModel == null) return { ...DEFAULT_TEXT_STYLE };
|
|
378
391
|
const unitId = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId();
|
|
379
|
-
const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.
|
|
392
|
+
const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService);
|
|
380
393
|
const docViewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
|
|
381
394
|
if (docViewModel == null) return { ...DEFAULT_TEXT_STYLE };
|
|
382
395
|
if (docViewModel.getEditArea() === _univerjs_engine_render.DocumentEditArea.BODY) return { ...DEFAULT_TEXT_STYLE };
|
|
@@ -524,11 +537,6 @@ const BreakLineCommand = {
|
|
|
524
537
|
return Boolean(result);
|
|
525
538
|
}
|
|
526
539
|
};
|
|
527
|
-
function isTopLevelStructuralGap(dataStream, offset) {
|
|
528
|
-
const previousToken = dataStream[offset - 1];
|
|
529
|
-
const nextToken = dataStream[offset];
|
|
530
|
-
return previousToken === _univerjs_core.DataStreamTreeTokenType.BLOCK_END || previousToken === _univerjs_core.DataStreamTreeTokenType.TABLE_END || previousToken === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_END || nextToken === _univerjs_core.DataStreamTreeTokenType.BLOCK_START || nextToken === _univerjs_core.DataStreamTreeTokenType.TABLE_START || nextToken === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_START;
|
|
531
|
-
}
|
|
532
540
|
|
|
533
541
|
//#endregion
|
|
534
542
|
//#region src/services/clipboard/doc-paste-mutation-adapter.service.ts
|
|
@@ -569,7 +577,7 @@ var DocClipboardPasteAdapterService = class {
|
|
|
569
577
|
*/
|
|
570
578
|
function getCommandSkeleton(accessor, unitId) {
|
|
571
579
|
var _renderManagerService;
|
|
572
|
-
return (_renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService).
|
|
580
|
+
return (_renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs.DocSkeletonManagerService);
|
|
573
581
|
}
|
|
574
582
|
|
|
575
583
|
//#endregion
|
|
@@ -1082,8 +1090,8 @@ const InnerPasteCommand = {
|
|
|
1082
1090
|
id: "doc.command.inner-paste",
|
|
1083
1091
|
type: _univerjs_core.CommandType.COMMAND,
|
|
1084
1092
|
handler: async (accessor, params) => {
|
|
1085
|
-
var _docDataModel$getSelf, _body$tables, _body$customBlocks;
|
|
1086
|
-
const { segmentId, textRanges, doc } = params;
|
|
1093
|
+
var _docDataModel$getSelf, _body$tables, _body$customBlocks, _body$blockRanges;
|
|
1094
|
+
const { customRangeMappings = [], segmentId, textRanges, doc } = params;
|
|
1087
1095
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
1088
1096
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
1089
1097
|
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
@@ -1116,6 +1124,7 @@ const InnerPasteCommand = {
|
|
|
1116
1124
|
const resourceMutationGroups = [];
|
|
1117
1125
|
const hasTable = !!((_body$tables = body.tables) === null || _body$tables === void 0 ? void 0 : _body$tables.length);
|
|
1118
1126
|
const hasCustomBlock = !!((_body$customBlocks = body.customBlocks) === null || _body$customBlocks === void 0 ? void 0 : _body$customBlocks.length);
|
|
1127
|
+
const hasBlockRange = !!((_body$blockRanges = body.blockRanges) === null || _body$blockRanges === void 0 ? void 0 : _body$blockRanges.length);
|
|
1119
1128
|
if (hasTable && segmentId) return false;
|
|
1120
1129
|
if (hasTable && hasRangeInTable(selections)) return false;
|
|
1121
1130
|
if (selections.length && (rectRanges === null || rectRanges === void 0 ? void 0 : rectRanges.length)) return false;
|
|
@@ -1125,6 +1134,21 @@ const InnerPasteCommand = {
|
|
|
1125
1134
|
const { startOffset, endOffset, collapsed } = selection;
|
|
1126
1135
|
const len = startOffset - memoryCursor.cursor;
|
|
1127
1136
|
const cloneBody = _univerjs_core.Tools.deepClone(body);
|
|
1137
|
+
const blockRangeMappings = [];
|
|
1138
|
+
const customBlockMappings = [];
|
|
1139
|
+
const selectionCustomRangeMappings = customRangeMappings.map(({ sourceRange }) => ({
|
|
1140
|
+
sourceRange,
|
|
1141
|
+
targetRange: _univerjs_core.BuildTextUtils.customRange.copyCustomRange(sourceRange)
|
|
1142
|
+
}));
|
|
1143
|
+
if (selectionCustomRangeMappings.length > 0) cloneBody.customRanges = selectionCustomRangeMappings.map(({ targetRange }) => targetRange);
|
|
1144
|
+
if (hasBlockRange) cloneBody.blockRanges.forEach((targetBlockRange, index) => {
|
|
1145
|
+
const sourceBlockRange = body.blockRanges[index];
|
|
1146
|
+
targetBlockRange.blockId = (0, _univerjs_core.generateRandomId)(6);
|
|
1147
|
+
blockRangeMappings.push({
|
|
1148
|
+
sourceBlockRange,
|
|
1149
|
+
targetBlockRange
|
|
1150
|
+
});
|
|
1151
|
+
});
|
|
1128
1152
|
if (hasTable) for (const t of cloneBody.tables) {
|
|
1129
1153
|
const { tableId: oldTableId } = t;
|
|
1130
1154
|
const tableId = (0, _univerjs_core.generateRandomId)(6);
|
|
@@ -1137,7 +1161,6 @@ const InnerPasteCommand = {
|
|
|
1137
1161
|
if (hasCustomBlock && drawings) {
|
|
1138
1162
|
var _docDataModel$getSnap, _docDataModel$getSnap2;
|
|
1139
1163
|
const drawingLen = (_docDataModel$getSnap = (_docDataModel$getSnap2 = docDataModel.getSnapshot().drawingsOrder) === null || _docDataModel$getSnap2 === void 0 ? void 0 : _docDataModel$getSnap2.length) !== null && _docDataModel$getSnap !== void 0 ? _docDataModel$getSnap : 0;
|
|
1140
|
-
const customBlockMappings = [];
|
|
1141
1164
|
for (const block of cloneBody.customBlocks) {
|
|
1142
1165
|
const { blockId } = block;
|
|
1143
1166
|
const drawingId = (0, _univerjs_core.generateRandomId)(6);
|
|
@@ -1152,21 +1175,6 @@ const InnerPasteCommand = {
|
|
|
1152
1175
|
targetDrawing: drawing
|
|
1153
1176
|
});
|
|
1154
1177
|
}
|
|
1155
|
-
if (customBlockMappings.length > 0 && pasteAdapterService) {
|
|
1156
|
-
const mutationInfos = pasteAdapterService.getPasteMutationInfos({
|
|
1157
|
-
unitId,
|
|
1158
|
-
segmentId,
|
|
1159
|
-
doc,
|
|
1160
|
-
sourceBody: body,
|
|
1161
|
-
targetBody: cloneBody,
|
|
1162
|
-
customBlockMappings
|
|
1163
|
-
});
|
|
1164
|
-
if (mutationInfos.redoMutations.length > 0 || mutationInfos.undoMutations.length > 0) {
|
|
1165
|
-
resourceRedoMutations.push(...mutationInfos.redoMutations);
|
|
1166
|
-
resourceUndoMutations.push(...mutationInfos.undoMutations);
|
|
1167
|
-
resourceMutationGroups.push(mutationInfos);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
1178
|
customBlockMappings.forEach(({ targetBlockId, targetDrawing }) => {
|
|
1171
1179
|
const action = jsonX.insertOp(["drawings", targetBlockId], targetDrawing);
|
|
1172
1180
|
const orderAction = jsonX.insertOp(["drawingsOrder", drawingLen], targetBlockId);
|
|
@@ -1174,6 +1182,23 @@ const InnerPasteCommand = {
|
|
|
1174
1182
|
rawActions.push(orderAction);
|
|
1175
1183
|
});
|
|
1176
1184
|
}
|
|
1185
|
+
if ((blockRangeMappings.length > 0 || customBlockMappings.length > 0 || selectionCustomRangeMappings.length > 0) && pasteAdapterService) {
|
|
1186
|
+
const mutationInfos = pasteAdapterService.getPasteMutationInfos({
|
|
1187
|
+
unitId,
|
|
1188
|
+
segmentId,
|
|
1189
|
+
doc,
|
|
1190
|
+
sourceBody: body,
|
|
1191
|
+
targetBody: cloneBody,
|
|
1192
|
+
blockRangeMappings,
|
|
1193
|
+
customRangeMappings: selectionCustomRangeMappings,
|
|
1194
|
+
customBlockMappings
|
|
1195
|
+
});
|
|
1196
|
+
if (mutationInfos.redoMutations.length > 0 || mutationInfos.undoMutations.length > 0) {
|
|
1197
|
+
resourceRedoMutations.push(...mutationInfos.redoMutations);
|
|
1198
|
+
resourceUndoMutations.push(...mutationInfos.undoMutations);
|
|
1199
|
+
resourceMutationGroups.push(mutationInfos);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1177
1202
|
const customRange = getCustomRangeAtPosition((_originBody$customRan = originBody.customRanges) !== null && _originBody$customRan !== void 0 ? _originBody$customRan : [], endOffset, UNITS.includes(unitId));
|
|
1178
1203
|
const customDecorations = getCustomDecorationAtPosition((_originBody$customDec = originBody.customDecorations) !== null && _originBody$customDec !== void 0 ? _originBody$customDec : [], endOffset);
|
|
1179
1204
|
if (customRange) cloneBody.customRanges = [{
|
|
@@ -3729,18 +3754,19 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3729
3754
|
this._clipboardInterfaceService = _clipboardInterfaceService;
|
|
3730
3755
|
this._docSelectionManagerService = _docSelectionManagerService;
|
|
3731
3756
|
_defineProperty(this, "_clipboardHooks", []);
|
|
3757
|
+
_defineProperty(this, "_memoryClipboardData", null);
|
|
3732
3758
|
_defineProperty(this, "_htmlToUDM", new HtmlToUDMService());
|
|
3733
3759
|
_defineProperty(this, "_umdToHtml", void 0);
|
|
3734
3760
|
this._umdToHtml = new UDMToHtmlService(docHtmlExportService);
|
|
3735
3761
|
}
|
|
3736
3762
|
async copy(sliceType = _univerjs_core.SliceBodyType.copy, ranges) {
|
|
3737
3763
|
var _this$_getDocumentBod;
|
|
3738
|
-
const { newSnapshotList = [], needCache = false, snapshot, ranges: allRanges } = (_this$_getDocumentBod = this._getDocumentBodyInRanges(sliceType, ranges)) !== null && _this$_getDocumentBod !== void 0 ? _this$_getDocumentBod : {};
|
|
3764
|
+
const { newSnapshotList = [], needCache = false, plainTextList, snapshot, ranges: allRanges } = (_this$_getDocumentBod = this._getDocumentBodyInRanges(sliceType, ranges)) !== null && _this$_getDocumentBod !== void 0 ? _this$_getDocumentBod : {};
|
|
3739
3765
|
if (newSnapshotList.length === 0 || snapshot == null) return false;
|
|
3740
3766
|
try {
|
|
3741
3767
|
var _allRanges$;
|
|
3742
3768
|
const isCopyInHeaderFooter = !!(allRanges === null || allRanges === void 0 || (_allRanges$ = allRanges[0]) === null || _allRanges$ === void 0 ? void 0 : _allRanges$.segmentId);
|
|
3743
|
-
this._setClipboardData(newSnapshotList, !isCopyInHeaderFooter && needCache);
|
|
3769
|
+
await this._setClipboardData(newSnapshotList, !isCopyInHeaderFooter && needCache, plainTextList);
|
|
3744
3770
|
} catch (e) {
|
|
3745
3771
|
this._logService.error("[DocClipboardService] copy failed", e);
|
|
3746
3772
|
return false;
|
|
@@ -3751,6 +3777,7 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3751
3777
|
return this._cut(ranges);
|
|
3752
3778
|
}
|
|
3753
3779
|
async paste(items) {
|
|
3780
|
+
if (!(items === null || items === void 0 ? void 0 : items.length)) return this._memoryClipboardData ? this._paste(_univerjs_core.Tools.deepClone(this._memoryClipboardData)) : false;
|
|
3754
3781
|
const partDocData = await this._genDocDataFromClipboardItems(items);
|
|
3755
3782
|
return this._paste(partDocData);
|
|
3756
3783
|
}
|
|
@@ -3808,15 +3835,25 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3808
3835
|
}
|
|
3809
3836
|
}
|
|
3810
3837
|
async _paste(docData) {
|
|
3811
|
-
var
|
|
3838
|
+
var _body$customRanges$ma, _body$customRanges, _body$paragraphs, _currentDocument$getS;
|
|
3812
3839
|
const { body: _body } = docData;
|
|
3813
3840
|
if (_body == null) return false;
|
|
3814
3841
|
let body = (0, _univerjs_core.normalizeBody)(_body);
|
|
3815
|
-
|
|
3842
|
+
const currentDocument = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
3843
|
+
if (!currentDocument) return false;
|
|
3816
3844
|
this._clipboardHooks.forEach((hook) => {
|
|
3817
|
-
if (hook.onBeforePaste) body = hook.onBeforePaste(body
|
|
3845
|
+
if (hook.onBeforePaste) body = hook.onBeforePaste(body, {
|
|
3846
|
+
documentData: docData,
|
|
3847
|
+
targetUnitId: currentDocument.getUnitId()
|
|
3848
|
+
});
|
|
3818
3849
|
});
|
|
3819
|
-
|
|
3850
|
+
const customRangeMappings = (_body$customRanges$ma = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.map((sourceRange) => {
|
|
3851
|
+
return {
|
|
3852
|
+
sourceRange,
|
|
3853
|
+
targetRange: _univerjs_core.BuildTextUtils.customRange.copyCustomRange(sourceRange)
|
|
3854
|
+
};
|
|
3855
|
+
})) !== null && _body$customRanges$ma !== void 0 ? _body$customRanges$ma : [];
|
|
3856
|
+
body.customRanges = customRangeMappings.map(({ targetRange }) => targetRange);
|
|
3820
3857
|
(_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 || _body$paragraphs.forEach((copy) => {
|
|
3821
3858
|
var _copy$paragraphStyle;
|
|
3822
3859
|
if ((_copy$paragraphStyle = copy.paragraphStyle) === null || _copy$paragraphStyle === void 0 ? void 0 : _copy$paragraphStyle.headingId) copy.paragraphStyle.headingId = (0, _univerjs_core.generateRandomId)(6);
|
|
@@ -3825,6 +3862,8 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3825
3862
|
const ranges = this._docSelectionManagerService.getTextRanges();
|
|
3826
3863
|
if (segmentId == null) this._logService.error("[DocClipboardController] segmentId does not exist!");
|
|
3827
3864
|
if (activeEndOffset == null || ranges == null) return false;
|
|
3865
|
+
const originBody = segmentId == null ? null : (_currentDocument$getS = currentDocument.getSelfOrHeaderFooterModel(segmentId)) === null || _currentDocument$getS === void 0 ? void 0 : _currentDocument$getS.getBody();
|
|
3866
|
+
if (originBody) ensureParagraphAtStructuralGap(body, originBody, ranges);
|
|
3828
3867
|
try {
|
|
3829
3868
|
let cursor = activeEndOffset;
|
|
3830
3869
|
for (const range of ranges) {
|
|
@@ -3842,6 +3881,7 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3842
3881
|
...docData,
|
|
3843
3882
|
body
|
|
3844
3883
|
},
|
|
3884
|
+
customRangeMappings,
|
|
3845
3885
|
segmentId,
|
|
3846
3886
|
textRanges
|
|
3847
3887
|
});
|
|
@@ -3850,10 +3890,10 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3850
3890
|
return false;
|
|
3851
3891
|
}
|
|
3852
3892
|
}
|
|
3853
|
-
async _setClipboardData(documentList, needCache = true) {
|
|
3893
|
+
async _setClipboardData(documentList, needCache = true, plainTextList) {
|
|
3854
3894
|
var _documentList$0$body;
|
|
3855
3895
|
const copyId = (0, _univerjs_core.generateRandomId)(6);
|
|
3856
|
-
const text = (documentList.length > 1 ? documentList.map((doc) => {
|
|
3896
|
+
const text = (plainTextList ? plainTextList.join("\n") : documentList.length > 1 ? documentList.map((doc) => {
|
|
3857
3897
|
var _doc$body;
|
|
3858
3898
|
return ((_doc$body = doc.body) === null || _doc$body === void 0 ? void 0 : _doc$body.dataStream) || "";
|
|
3859
3899
|
}).join("\n") : ((_documentList$0$body = documentList[0].body) === null || _documentList$0$body === void 0 ? void 0 : _documentList$0$body.dataStream) || "").replaceAll(_univerjs_core.DataStreamTreeTokenType.TABLE_START, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.TABLE_END, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.TABLE_ROW_START, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.TABLE_ROW_END, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.TABLE_CELL_START, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.TABLE_CELL_END, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.BLOCK_START, "").replaceAll(_univerjs_core.DataStreamTreeTokenType.BLOCK_END, "").replaceAll("\r\n", " ").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "");
|
|
@@ -3873,7 +3913,8 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3873
3913
|
html = embedInternalClipboardFragment(html, internalJson);
|
|
3874
3914
|
}
|
|
3875
3915
|
html = wrapClipboardHtml(html);
|
|
3876
|
-
|
|
3916
|
+
await this._clipboardInterfaceService.write(text, html, internalJson ? { [DOC_INTERNAL_FRAGMENT_MIME]: internalJson } : void 0);
|
|
3917
|
+
this._memoryClipboardData = _univerjs_core.Tools.deepClone(internalDocData);
|
|
3877
3918
|
}
|
|
3878
3919
|
addClipboardHook(hook) {
|
|
3879
3920
|
this._clipboardHooks.push(hook);
|
|
@@ -3889,10 +3930,12 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3889
3930
|
}, doc);
|
|
3890
3931
|
}
|
|
3891
3932
|
_getDocumentBodyInRanges(sliceType, ranges) {
|
|
3892
|
-
var _docDataModel$getSelf;
|
|
3933
|
+
var _this$_clipboardHooks, _docDataModel$getSelf;
|
|
3893
3934
|
const docDataModel = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
3894
3935
|
const allRanges = ranges !== null && ranges !== void 0 ? ranges : this._docSelectionManagerService.getDocRanges();
|
|
3895
3936
|
const results = [];
|
|
3937
|
+
const plainTextResults = [];
|
|
3938
|
+
const copyContentHook = (_this$_clipboardHooks = this._clipboardHooks.find((hook) => hook.onCopyContent)) === null || _this$_clipboardHooks === void 0 ? void 0 : _this$_clipboardHooks.onCopyContent;
|
|
3896
3939
|
let needCache = true;
|
|
3897
3940
|
if (docDataModel == null || allRanges.length === 0) return;
|
|
3898
3941
|
const segmentId = allRanges[0].segmentId;
|
|
@@ -3900,13 +3943,14 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3900
3943
|
const snapshot = docDataModel.getSnapshot();
|
|
3901
3944
|
if (body == null) return;
|
|
3902
3945
|
for (const range of allRanges) {
|
|
3903
|
-
var _docDataModel$getSelf2;
|
|
3946
|
+
var _docDataModel$getSelf2, _copyContentHook;
|
|
3904
3947
|
const { startOffset, endOffset, collapsed, rangeType } = range;
|
|
3905
3948
|
if (collapsed || startOffset == null || endOffset == null) continue;
|
|
3906
3949
|
if (rangeType === _univerjs_core.DOC_RANGE_TYPE.RECT) {
|
|
3907
3950
|
needCache = false;
|
|
3908
3951
|
const bodySlice = getTableClipboardBodySlice(body, range);
|
|
3909
3952
|
results.push(bodySlice);
|
|
3953
|
+
plainTextResults.push(bodySlice.dataStream);
|
|
3910
3954
|
continue;
|
|
3911
3955
|
}
|
|
3912
3956
|
const deleteRange = {
|
|
@@ -3917,6 +3961,11 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3917
3961
|
const docBody = (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.sliceBody(deleteRange.startOffset, deleteRange.endOffset, sliceType);
|
|
3918
3962
|
if (docBody == null) continue;
|
|
3919
3963
|
results.push(docBody);
|
|
3964
|
+
plainTextResults.push((_copyContentHook = copyContentHook === null || copyContentHook === void 0 ? void 0 : copyContentHook(deleteRange.startOffset, deleteRange.endOffset, {
|
|
3965
|
+
body,
|
|
3966
|
+
segmentId,
|
|
3967
|
+
unitId: docDataModel.getUnitId()
|
|
3968
|
+
})) !== null && _copyContentHook !== void 0 ? _copyContentHook : docBody.dataStream);
|
|
3920
3969
|
}
|
|
3921
3970
|
return {
|
|
3922
3971
|
newSnapshotList: results.map((e) => ({
|
|
@@ -3924,6 +3973,7 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3924
3973
|
body: e
|
|
3925
3974
|
})),
|
|
3926
3975
|
needCache,
|
|
3976
|
+
plainTextList: plainTextResults,
|
|
3927
3977
|
snapshot,
|
|
3928
3978
|
ranges: allRanges
|
|
3929
3979
|
};
|
|
@@ -3982,16 +4032,17 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
3982
4032
|
return doc;
|
|
3983
4033
|
}
|
|
3984
4034
|
async _uploadBase64ImagesInHtml(html) {
|
|
3985
|
-
var _this$
|
|
4035
|
+
var _this$_clipboardHooks2;
|
|
3986
4036
|
if (!html || !html.includes("data:image/")) return html;
|
|
3987
|
-
const onBeforePasteImage = (_this$
|
|
4037
|
+
const onBeforePasteImage = (_this$_clipboardHooks2 = this._clipboardHooks.find((e) => e.onBeforePasteImage)) === null || _this$_clipboardHooks2 === void 0 ? void 0 : _this$_clipboardHooks2.onBeforePasteImage;
|
|
3988
4038
|
if (!onBeforePasteImage) return html;
|
|
3989
4039
|
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
3990
4040
|
const images = Array.from(doc.querySelectorAll("img[src^=\"data:image/\"]"));
|
|
3991
4041
|
if (images.length === 0) return html;
|
|
3992
4042
|
await Promise.all(images.map(async (image, index) => {
|
|
3993
4043
|
if (image.dataset.imageSourceType && image.dataset.imageSourceType !== _univerjs_core.ImageSourceType.BASE64) return;
|
|
3994
|
-
const
|
|
4044
|
+
const file = dataUrlToFile(image.getAttribute("src") || image.src, `pasted_image_${index}`);
|
|
4045
|
+
const uploaded = await onBeforePasteImage(file);
|
|
3995
4046
|
if (!uploaded) return;
|
|
3996
4047
|
image.dataset.imageSourceType = uploaded.imageSourceType;
|
|
3997
4048
|
if (uploaded.imageSourceType === _univerjs_core.ImageSourceType.UUID) {
|
|
@@ -4005,7 +4056,7 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
4005
4056
|
return doc.documentElement.outerHTML;
|
|
4006
4057
|
}
|
|
4007
4058
|
async _createImagePasteHtml(files) {
|
|
4008
|
-
var _this$
|
|
4059
|
+
var _this$_clipboardHooks3, _this$_clipboardHooks4;
|
|
4009
4060
|
const doc = {
|
|
4010
4061
|
id: "",
|
|
4011
4062
|
documentStyle: {},
|
|
@@ -4041,7 +4092,7 @@ let DocClipboardService = class DocClipboardService extends _univerjs_core.Dispo
|
|
|
4041
4092
|
};
|
|
4042
4093
|
});
|
|
4043
4094
|
};
|
|
4044
|
-
const onBeforePasteImage = (_this$
|
|
4095
|
+
const onBeforePasteImage = (_this$_clipboardHooks3 = (_this$_clipboardHooks4 = this._clipboardHooks.find((e) => e.onBeforePasteImage)) === null || _this$_clipboardHooks4 === void 0 ? void 0 : _this$_clipboardHooks4.onBeforePasteImage) !== null && _this$_clipboardHooks3 !== void 0 ? _this$_clipboardHooks3 : fileToBase64;
|
|
4045
4096
|
await Promise.all(files.map(async (file, index) => {
|
|
4046
4097
|
var _body$customBlocks;
|
|
4047
4098
|
const image = await onBeforePasteImage(file);
|
|
@@ -4098,6 +4149,21 @@ DocClipboardService = __decorate([
|
|
|
4098
4149
|
__decorateParam(4, (0, _univerjs_core.Inject)(DocHtmlExportService)),
|
|
4099
4150
|
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_docs.DocSelectionManagerService))
|
|
4100
4151
|
], DocClipboardService);
|
|
4152
|
+
function endsAtDocumentBoundary(dataStream) {
|
|
4153
|
+
const lastToken = dataStream[dataStream.length - 1];
|
|
4154
|
+
return lastToken === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH || lastToken === _univerjs_core.DataStreamTreeTokenType.SECTION_BREAK || lastToken === _univerjs_core.DataStreamTreeTokenType.BLOCK_END || lastToken === _univerjs_core.DataStreamTreeTokenType.TABLE_END || lastToken === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_END;
|
|
4155
|
+
}
|
|
4156
|
+
function ensureParagraphAtStructuralGap(body, originBody, ranges) {
|
|
4157
|
+
var _body$paragraphs$map, _body$paragraphs2, _body$paragraphs3;
|
|
4158
|
+
if (endsAtDocumentBoundary(body.dataStream) || !ranges.every((range) => range.collapsed && isTopLevelStructuralGap(originBody.dataStream, range.startOffset))) return;
|
|
4159
|
+
const paragraphIndex = body.dataStream.length;
|
|
4160
|
+
const paragraphIds = new Set((_body$paragraphs$map = (_body$paragraphs2 = body.paragraphs) === null || _body$paragraphs2 === void 0 ? void 0 : _body$paragraphs2.map((paragraph) => paragraph.paragraphId)) !== null && _body$paragraphs$map !== void 0 ? _body$paragraphs$map : []);
|
|
4161
|
+
body.dataStream += _univerjs_core.DataStreamTreeTokenType.PARAGRAPH;
|
|
4162
|
+
body.paragraphs = [...(_body$paragraphs3 = body.paragraphs) !== null && _body$paragraphs3 !== void 0 ? _body$paragraphs3 : [], {
|
|
4163
|
+
startIndex: paragraphIndex,
|
|
4164
|
+
paragraphId: (0, _univerjs_core.createParagraphId)(paragraphIds)
|
|
4165
|
+
}];
|
|
4166
|
+
}
|
|
4101
4167
|
function dataUrlToFile(dataUrl, fallbackName) {
|
|
4102
4168
|
const match = /^data:([^;,]+)(;base64)?,(.*)$/i.exec(dataUrl);
|
|
4103
4169
|
if (!match) throw new Error("[DocClipboardService] invalid image data url.");
|
|
@@ -4173,8 +4239,8 @@ const DocPasteCommand = {
|
|
|
4173
4239
|
preconditions: whenDocOrEditor,
|
|
4174
4240
|
handler: async (accessor) => {
|
|
4175
4241
|
const docClipboardService = accessor.get(IDocClipboardService);
|
|
4176
|
-
const
|
|
4177
|
-
|
|
4242
|
+
const clipboardInterfaceService = accessor.get(_univerjs_ui.IClipboardInterfaceService);
|
|
4243
|
+
const clipboardItems = clipboardInterfaceService.supportClipboard ? await clipboardInterfaceService.read() : [];
|
|
4178
4244
|
return docClipboardService.paste(clipboardItems);
|
|
4179
4245
|
}
|
|
4180
4246
|
};
|
|
@@ -4770,7 +4836,7 @@ const IMEInputCommand = {
|
|
|
4770
4836
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
4771
4837
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
4772
4838
|
const docMenuStyleService = accessor.get(DocMenuStyleService);
|
|
4773
|
-
const imeInputManagerService = (_renderManagerService = renderManagerService.
|
|
4839
|
+
const imeInputManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocIMEInputManagerService);
|
|
4774
4840
|
const docDataModel = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
4775
4841
|
if (docDataModel == null || imeInputManagerService == null) return false;
|
|
4776
4842
|
const previousActiveRange = imeInputManagerService.getActiveRange();
|
|
@@ -4863,7 +4929,8 @@ const SetInlineFormatBoldCommand = {
|
|
|
4863
4929
|
id: SetInlineFormatBoldCommandId,
|
|
4864
4930
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4865
4931
|
handler: async (accessor, params) => {
|
|
4866
|
-
|
|
4932
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4933
|
+
return handleInlineFormat(SetInlineFormatBoldCommandId, params, commandService);
|
|
4867
4934
|
}
|
|
4868
4935
|
};
|
|
4869
4936
|
const SetInlineFormatItalicCommandId = "doc.command.set-inline-format-italic";
|
|
@@ -4871,7 +4938,8 @@ const SetInlineFormatItalicCommand = {
|
|
|
4871
4938
|
id: SetInlineFormatItalicCommandId,
|
|
4872
4939
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4873
4940
|
handler: async (accessor, params) => {
|
|
4874
|
-
|
|
4941
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4942
|
+
return handleInlineFormat(SetInlineFormatItalicCommandId, params, commandService);
|
|
4875
4943
|
}
|
|
4876
4944
|
};
|
|
4877
4945
|
const SetInlineFormatUnderlineCommandId = "doc.command.set-inline-format-underline";
|
|
@@ -4879,7 +4947,8 @@ const SetInlineFormatUnderlineCommand = {
|
|
|
4879
4947
|
id: SetInlineFormatUnderlineCommandId,
|
|
4880
4948
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4881
4949
|
handler: async (accessor, params) => {
|
|
4882
|
-
|
|
4950
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4951
|
+
return handleInlineFormat(SetInlineFormatUnderlineCommandId, params, commandService);
|
|
4883
4952
|
}
|
|
4884
4953
|
};
|
|
4885
4954
|
const SetInlineFormatStrikethroughCommandId = "doc.command.set-inline-format-strikethrough";
|
|
@@ -4887,7 +4956,8 @@ const SetInlineFormatStrikethroughCommand = {
|
|
|
4887
4956
|
id: SetInlineFormatStrikethroughCommandId,
|
|
4888
4957
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4889
4958
|
handler: async (accessor, params) => {
|
|
4890
|
-
|
|
4959
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4960
|
+
return handleInlineFormat(SetInlineFormatStrikethroughCommandId, params, commandService);
|
|
4891
4961
|
}
|
|
4892
4962
|
};
|
|
4893
4963
|
const SetInlineFormatSubscriptCommandId = "doc.command.set-inline-format-subscript";
|
|
@@ -4895,7 +4965,8 @@ const SetInlineFormatSubscriptCommand = {
|
|
|
4895
4965
|
id: SetInlineFormatSubscriptCommandId,
|
|
4896
4966
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4897
4967
|
handler: async (accessor, params) => {
|
|
4898
|
-
|
|
4968
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4969
|
+
return handleInlineFormat(SetInlineFormatSubscriptCommandId, params, commandService);
|
|
4899
4970
|
}
|
|
4900
4971
|
};
|
|
4901
4972
|
const SetInlineFormatSuperscriptCommandId = "doc.command.set-inline-format-superscript";
|
|
@@ -4903,7 +4974,8 @@ const SetInlineFormatSuperscriptCommand = {
|
|
|
4903
4974
|
id: SetInlineFormatSuperscriptCommandId,
|
|
4904
4975
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4905
4976
|
handler: async (accessor, params) => {
|
|
4906
|
-
|
|
4977
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4978
|
+
return handleInlineFormat(SetInlineFormatSuperscriptCommandId, params, commandService);
|
|
4907
4979
|
}
|
|
4908
4980
|
};
|
|
4909
4981
|
const SetInlineFormatFontSizeCommandId = "doc.command.set-inline-format-fontsize";
|
|
@@ -4911,7 +4983,8 @@ const SetInlineFormatFontSizeCommand = {
|
|
|
4911
4983
|
id: SetInlineFormatFontSizeCommandId,
|
|
4912
4984
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4913
4985
|
handler: async (accessor, params) => {
|
|
4914
|
-
|
|
4986
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4987
|
+
return handleInlineFormat(SetInlineFormatFontSizeCommandId, params, commandService);
|
|
4915
4988
|
}
|
|
4916
4989
|
};
|
|
4917
4990
|
const SetInlineFormatFontFamilyCommandId = "doc.command.set-inline-format-font-family";
|
|
@@ -4919,7 +4992,8 @@ const SetInlineFormatFontFamilyCommand = {
|
|
|
4919
4992
|
id: SetInlineFormatFontFamilyCommandId,
|
|
4920
4993
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4921
4994
|
handler: async (accessor, params) => {
|
|
4922
|
-
|
|
4995
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
4996
|
+
return handleInlineFormat(SetInlineFormatFontFamilyCommandId, params, commandService);
|
|
4923
4997
|
}
|
|
4924
4998
|
};
|
|
4925
4999
|
const SetInlineFormatTextColorCommandId = "doc.command.set-inline-format-text-color";
|
|
@@ -4927,7 +5001,8 @@ const SetInlineFormatTextColorCommand = {
|
|
|
4927
5001
|
id: SetInlineFormatTextColorCommandId,
|
|
4928
5002
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4929
5003
|
handler: async (accessor, params) => {
|
|
4930
|
-
|
|
5004
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5005
|
+
return handleInlineFormat(SetInlineFormatTextColorCommandId, params, commandService);
|
|
4931
5006
|
}
|
|
4932
5007
|
};
|
|
4933
5008
|
const ResetInlineFormatTextColorCommandId = "doc.command.reset-inline-format-text-color";
|
|
@@ -4935,7 +5010,8 @@ const ResetInlineFormatTextColorCommand = {
|
|
|
4935
5010
|
id: ResetInlineFormatTextColorCommandId,
|
|
4936
5011
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4937
5012
|
handler: async (accessor, params) => {
|
|
4938
|
-
|
|
5013
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5014
|
+
return handleInlineFormat(ResetInlineFormatTextColorCommandId, params, commandService);
|
|
4939
5015
|
}
|
|
4940
5016
|
};
|
|
4941
5017
|
const SetInlineFormatTextFillCommandId = "doc.command.set-inline-format-text-fill";
|
|
@@ -4943,7 +5019,8 @@ const SetInlineFormatTextFillCommand = {
|
|
|
4943
5019
|
id: SetInlineFormatTextFillCommandId,
|
|
4944
5020
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4945
5021
|
handler: async (accessor, params) => {
|
|
4946
|
-
|
|
5022
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5023
|
+
return handleInlineFormat(SetInlineFormatTextFillCommandId, params, commandService);
|
|
4947
5024
|
}
|
|
4948
5025
|
};
|
|
4949
5026
|
const SetInlineFormatTextBackgroundColorCommandId = "doc.command.set-inline-format-text-background-color";
|
|
@@ -4951,7 +5028,8 @@ const SetInlineFormatTextBackgroundColorCommand = {
|
|
|
4951
5028
|
id: SetInlineFormatTextBackgroundColorCommandId,
|
|
4952
5029
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4953
5030
|
handler: async (accessor, params) => {
|
|
4954
|
-
|
|
5031
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5032
|
+
return handleInlineFormat(SetInlineFormatTextBackgroundColorCommandId, params, commandService);
|
|
4955
5033
|
}
|
|
4956
5034
|
};
|
|
4957
5035
|
const ResetInlineFormatTextBackgroundColorCommandId = "doc.command.reset-inline-format-text-background-color";
|
|
@@ -4959,7 +5037,8 @@ const ResetInlineFormatTextBackgroundColorCommand = {
|
|
|
4959
5037
|
id: ResetInlineFormatTextBackgroundColorCommandId,
|
|
4960
5038
|
type: _univerjs_core.CommandType.COMMAND,
|
|
4961
5039
|
handler: async (accessor, params) => {
|
|
4962
|
-
|
|
5040
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5041
|
+
return handleInlineFormat(ResetInlineFormatTextBackgroundColorCommandId, params, commandService);
|
|
4963
5042
|
}
|
|
4964
5043
|
};
|
|
4965
5044
|
const COMMAND_ID_TO_FORMAT_KEY_MAP = {
|
|
@@ -5257,35 +5336,6 @@ function collectTopLevelReplaceAction(jsonX, rawActions, path, previousValue, va
|
|
|
5257
5336
|
const action = jsonX.replaceOp(path, previousValue, value);
|
|
5258
5337
|
if (action != null) rawActions.push(action);
|
|
5259
5338
|
}
|
|
5260
|
-
/**
|
|
5261
|
-
* @deprecated please use ReplaceSnapshotCommand instead.
|
|
5262
|
-
*/
|
|
5263
|
-
const ReplaceContentCommand = {
|
|
5264
|
-
id: "doc.command-replace-content",
|
|
5265
|
-
type: _univerjs_core.CommandType.COMMAND,
|
|
5266
|
-
handler: async (accessor, params) => {
|
|
5267
|
-
var _docDataModel$getSelf2;
|
|
5268
|
-
const { unitId, body, textRanges, segmentId = "", options } = params;
|
|
5269
|
-
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5270
|
-
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5271
|
-
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
5272
|
-
const docDataModel = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
5273
|
-
const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.getBody();
|
|
5274
|
-
if (docDataModel == null || prevBody == null) return false;
|
|
5275
|
-
const doMutation = getMutationParams(unitId, segmentId, docDataModel, prevBody, body);
|
|
5276
|
-
doMutation.params.textRanges = textRanges;
|
|
5277
|
-
if (options) doMutation.params.options = options;
|
|
5278
|
-
if (doMutation.params.actions == null && textRanges) {
|
|
5279
|
-
docSelectionManagerService.replaceDocRanges(textRanges, {
|
|
5280
|
-
unitId,
|
|
5281
|
-
subUnitId: unitId
|
|
5282
|
-
}, false);
|
|
5283
|
-
return true;
|
|
5284
|
-
}
|
|
5285
|
-
const result = commandService.syncExecuteCommand(doMutation.id, doMutation.params);
|
|
5286
|
-
return Boolean(result);
|
|
5287
|
-
}
|
|
5288
|
-
};
|
|
5289
5339
|
const CoverContentCommand = {
|
|
5290
5340
|
id: "doc.command-cover-content",
|
|
5291
5341
|
type: _univerjs_core.CommandType.COMMAND,
|
|
@@ -5369,13 +5419,13 @@ const ReplaceTextRunsCommand = {
|
|
|
5369
5419
|
id: "doc.command.replace-text-runs",
|
|
5370
5420
|
type: _univerjs_core.CommandType.COMMAND,
|
|
5371
5421
|
handler: (accessor, params) => {
|
|
5372
|
-
var _docDataModel$
|
|
5422
|
+
var _docDataModel$getSelf2;
|
|
5373
5423
|
const { unitId, body, textRanges, segmentId = "", options } = params;
|
|
5374
5424
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5375
5425
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
5376
5426
|
const themeService = accessor.get(_univerjs_core.ThemeService);
|
|
5377
5427
|
const docDataModel = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
5378
|
-
const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$
|
|
5428
|
+
const prevBody = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf2 = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf2 === void 0 ? void 0 : _docDataModel$getSelf2.getBody();
|
|
5379
5429
|
if (docDataModel == null || prevBody == null) return false;
|
|
5380
5430
|
const textX = _univerjs_core.BuildTextUtils.selection.replaceTextRuns({
|
|
5381
5431
|
doc: docDataModel,
|
|
@@ -6051,10 +6101,10 @@ function insertNamedStyleParagraph(accessor, doc, namedStyleType, startOffset, e
|
|
|
6051
6101
|
segmentId,
|
|
6052
6102
|
unitId: doc.getUnitId()
|
|
6053
6103
|
}));
|
|
6054
|
-
if (success) accessor.get(_univerjs_docs.DocSelectionManagerService).
|
|
6104
|
+
if (success) accessor.get(_univerjs_docs.DocSelectionManagerService).replaceDocRanges([{
|
|
6055
6105
|
startOffset,
|
|
6056
6106
|
endOffset: startOffset
|
|
6057
|
-
}], false);
|
|
6107
|
+
}], void 0, false);
|
|
6058
6108
|
return success;
|
|
6059
6109
|
}
|
|
6060
6110
|
const QuickHeadingCommand = {
|
|
@@ -6416,7 +6466,7 @@ var NodePositionConvertToCursor = class {
|
|
|
6416
6466
|
const rawAnchorGlyph = isStartBack ? preGlyph !== null && preGlyph !== void 0 ? preGlyph : firstGlyph : firstGlyph;
|
|
6417
6467
|
const anchorGlyph = this._getCaretGlyph(rawAnchorGlyph, glyphGroup, start_sp);
|
|
6418
6468
|
const selectedGlyphs = glyphGroup.slice(start_sp, end_sp + 1);
|
|
6419
|
-
const
|
|
6469
|
+
const isSelectionOnlyNonInlineDrawing = !collapsed && selectedGlyphs.length > 0 && selectedGlyphs.every((glyph) => this._isNonInlineDrawingGlyph(glyph));
|
|
6420
6470
|
const borderBoxStartY = startY;
|
|
6421
6471
|
const borderBoxEndY = contentHeight == null ? startY + lineHeight - marginTop - marginBottom : startY + paddingTop + contentHeight + paddingBottom;
|
|
6422
6472
|
if (start_sp === 0 && end_sp === glyphGroup.length - 1) {
|
|
@@ -6449,8 +6499,8 @@ var NodePositionConvertToCursor = class {
|
|
|
6449
6499
|
}
|
|
6450
6500
|
const clippedBorderBoxPosition = clipPositionToHorizontalRange(borderBoxPosition, this._horizontalClip);
|
|
6451
6501
|
const clippedContentBoxPosition = clipPositionToHorizontalRange(contentBoxPosition, this._horizontalClip);
|
|
6452
|
-
if (clippedBorderBoxPosition && !
|
|
6453
|
-
if (clippedContentBoxPosition && !
|
|
6502
|
+
if (clippedBorderBoxPosition && !isSelectionOnlyNonInlineDrawing) borderBoxPointGroup.push(pushToPoints(clippedBorderBoxPosition));
|
|
6503
|
+
if (clippedContentBoxPosition && !isSelectionOnlyNonInlineDrawing) contentBoxPointGroup.push(pushToPoints(clippedContentBoxPosition));
|
|
6454
6504
|
cursorList.push({
|
|
6455
6505
|
startOffset: isStartBack ? startOffset : startOffset + firstGlyph.count,
|
|
6456
6506
|
endOffset: isEndBack ? endOffset : endOffset + lastGlyph.count,
|
|
@@ -6465,7 +6515,7 @@ var NodePositionConvertToCursor = class {
|
|
|
6465
6515
|
}
|
|
6466
6516
|
_getCaretGlyph(glyph, glyphGroup, glyphIndex) {
|
|
6467
6517
|
var _this$_findTextLikeGl;
|
|
6468
|
-
if (!glyph || !this.
|
|
6518
|
+
if (!glyph || !this._isNonInlineDrawingGlyph(glyph)) return glyph;
|
|
6469
6519
|
const neighbor = (_this$_findTextLikeGl = this._findTextLikeGlyph(glyphGroup, glyphIndex - 1, -1)) !== null && _this$_findTextLikeGl !== void 0 ? _this$_findTextLikeGl : this._findTextLikeGlyph(glyphGroup, glyphIndex + 1, 1);
|
|
6470
6520
|
return neighbor !== null && neighbor !== void 0 ? neighbor : {
|
|
6471
6521
|
...glyph,
|
|
@@ -6475,13 +6525,14 @@ var NodePositionConvertToCursor = class {
|
|
|
6475
6525
|
_findTextLikeGlyph(glyphGroup, startIndex, step) {
|
|
6476
6526
|
for (let index = startIndex; index >= 0 && index < glyphGroup.length; index += step) {
|
|
6477
6527
|
const glyph = glyphGroup[index];
|
|
6478
|
-
if (!this.
|
|
6528
|
+
if (!this._isNonInlineDrawingGlyph(glyph)) return glyph;
|
|
6479
6529
|
}
|
|
6480
6530
|
}
|
|
6481
|
-
|
|
6531
|
+
_isNonInlineDrawingGlyph(glyph) {
|
|
6482
6532
|
var _this$_docSkeleton$ge, _this$_docSkeleton, _this$_docSkeleton$ge2, _this$_docSkeleton$ge3, _this$_docSkeleton$ge4, _this$_docSkeleton$ge5;
|
|
6483
6533
|
if (!(glyph === null || glyph === void 0 ? void 0 : glyph.drawingId) || glyph.streamType !== _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) return false;
|
|
6484
|
-
|
|
6534
|
+
const drawing = (_this$_docSkeleton$ge = (_this$_docSkeleton = this._docSkeleton).getViewModel) === null || _this$_docSkeleton$ge === void 0 || (_this$_docSkeleton$ge3 = (_this$_docSkeleton$ge2 = _this$_docSkeleton$ge.call(_this$_docSkeleton)).getDataModel) === null || _this$_docSkeleton$ge3 === void 0 || (_this$_docSkeleton$ge5 = (_this$_docSkeleton$ge4 = _this$_docSkeleton$ge3.call(_this$_docSkeleton$ge2)).getSnapshot) === null || _this$_docSkeleton$ge5 === void 0 || (_this$_docSkeleton$ge5 = _this$_docSkeleton$ge5.call(_this$_docSkeleton$ge4).drawings) === null || _this$_docSkeleton$ge5 === void 0 ? void 0 : _this$_docSkeleton$ge5[glyph.drawingId];
|
|
6535
|
+
return (drawing === null || drawing === void 0 ? void 0 : drawing.layoutType) == null ? !(0, _univerjs_docs.shouldUseInlineTextSelectionForDocsCustomBlockDrawing)(drawing) : drawing.layoutType !== _univerjs_core.PositionedObjectLayoutType.INLINE;
|
|
6485
6536
|
}
|
|
6486
6537
|
_isValidPosition(startOrigin, endOrigin) {
|
|
6487
6538
|
const { segmentPage: startPage, pageType: startPageType } = startOrigin;
|
|
@@ -7169,6 +7220,12 @@ const TEXT_ANCHOR_KEY_PREFIX = "__TestSelectionAnchor__";
|
|
|
7169
7220
|
const ID_LENGTH$1 = 6;
|
|
7170
7221
|
const BLINK_ON = 500;
|
|
7171
7222
|
const TEXT_RANGE_LAYER_INDEX = 3;
|
|
7223
|
+
function cursorConvertToTextRange(scene, range, docSkeleton, document) {
|
|
7224
|
+
const { startOffset, endOffset, style = _univerjs_engine_render.NORMAL_TEXT_SELECTION_PLUGIN_STYLE, segmentId = "", segmentPage } = range;
|
|
7225
|
+
const anchorNodePosition = docSkeleton.findNodePositionByCharIndex(startOffset, true, segmentId, segmentPage);
|
|
7226
|
+
const focusNodePosition = startOffset !== endOffset ? docSkeleton.findNodePositionByCharIndex(endOffset, true, segmentId, segmentPage) : null;
|
|
7227
|
+
return new TextRange(scene, document, docSkeleton, anchorNodePosition, focusNodePosition, style, segmentId, segmentPage);
|
|
7228
|
+
}
|
|
7172
7229
|
function getAnchorBounding(pointsGroup) {
|
|
7173
7230
|
const points = pointsGroup[0];
|
|
7174
7231
|
const startPoint = points[0];
|
|
@@ -7923,7 +7980,7 @@ function getParagraphInfoByGlyph(node) {
|
|
|
7923
7980
|
};
|
|
7924
7981
|
}
|
|
7925
7982
|
function serializeTextRange(textRange) {
|
|
7926
|
-
const { startOffset, endOffset, collapsed, rangeType, startNodePosition, endNodePosition, direction, segmentId, segmentPage } = textRange;
|
|
7983
|
+
const { startOffset, endOffset, collapsed, rangeType, startNodePosition, endNodePosition, direction, segmentId, segmentPage, style } = textRange;
|
|
7927
7984
|
return {
|
|
7928
7985
|
startOffset,
|
|
7929
7986
|
endOffset,
|
|
@@ -7934,6 +7991,7 @@ function serializeTextRange(textRange) {
|
|
|
7934
7991
|
direction,
|
|
7935
7992
|
segmentId,
|
|
7936
7993
|
segmentPage,
|
|
7994
|
+
style,
|
|
7937
7995
|
isActive: textRange.isActive()
|
|
7938
7996
|
};
|
|
7939
7997
|
}
|
|
@@ -8123,27 +8181,37 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8123
8181
|
const { scene, mainComponent } = this._context;
|
|
8124
8182
|
const document = mainComponent;
|
|
8125
8183
|
const docSkeleton = this._docSkeletonManagerService.getSkeleton();
|
|
8126
|
-
const generalAddRange = (startOffset, endOffset) => {
|
|
8127
|
-
const rangeList = getRangeListFromCharIndex(startOffset, endOffset, scene, document, docSkeleton,
|
|
8184
|
+
const generalAddRange = (startOffset, endOffset, rangeStyle) => {
|
|
8185
|
+
const rangeList = getRangeListFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
|
|
8128
8186
|
if (rangeList == null) return;
|
|
8129
8187
|
const { textRanges, rectRanges } = rangeList;
|
|
8130
8188
|
for (const textRange of textRanges) this._addTextRange(textRange);
|
|
8131
8189
|
this._addRectRanges(rectRanges);
|
|
8132
8190
|
};
|
|
8133
8191
|
for (const range of ranges) {
|
|
8192
|
+
var _range$style;
|
|
8134
8193
|
const { startOffset, endOffset, rangeType, startNodePosition, endNodePosition } = range;
|
|
8135
|
-
|
|
8136
|
-
|
|
8194
|
+
const rangeStyle = (_range$style = range.style) !== null && _range$style !== void 0 ? _range$style : style;
|
|
8195
|
+
if (rangeType !== _univerjs_core.DOC_RANGE_TYPE.RECT && startOffset === endOffset) {
|
|
8196
|
+
const textRange = cursorConvertToTextRange(scene, {
|
|
8197
|
+
...range,
|
|
8198
|
+
segmentId,
|
|
8199
|
+
segmentPage,
|
|
8200
|
+
style: rangeStyle
|
|
8201
|
+
}, docSkeleton, document);
|
|
8202
|
+
if (textRange) this._addTextRange(textRange);
|
|
8203
|
+
} else if (rangeType === _univerjs_core.DOC_RANGE_TYPE.RECT) {
|
|
8204
|
+
const rectRange = getRectRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
|
|
8137
8205
|
if (rectRange) this._addRectRanges([rectRange]);
|
|
8138
8206
|
} else if (rangeType === _univerjs_core.DOC_RANGE_TYPE.TEXT) try {
|
|
8139
8207
|
let textRange = null;
|
|
8140
|
-
if (startNodePosition && endNodePosition) textRange = getTextRangeFromCharIndex(startNodePosition.isBack ? startOffset : startOffset - 1, endNodePosition.isBack ? endOffset : endOffset - 1, scene, document, docSkeleton,
|
|
8141
|
-
else textRange = getTextRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton,
|
|
8208
|
+
if (startNodePosition && endNodePosition) textRange = getTextRangeFromCharIndex(startNodePosition.isBack ? startOffset : startOffset - 1, endNodePosition.isBack ? endOffset : endOffset - 1, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage, startNodePosition.isBack, endNodePosition.isBack);
|
|
8209
|
+
else textRange = getTextRangeFromCharIndex(startOffset, endOffset, scene, document, docSkeleton, rangeStyle, segmentId, segmentPage);
|
|
8142
8210
|
if (textRange) this._addTextRange(textRange);
|
|
8143
8211
|
} catch (_e) {
|
|
8144
|
-
generalAddRange(startOffset, endOffset);
|
|
8212
|
+
generalAddRange(startOffset, endOffset, rangeStyle);
|
|
8145
8213
|
}
|
|
8146
|
-
else generalAddRange(startOffset, endOffset);
|
|
8214
|
+
else generalAddRange(startOffset, endOffset, rangeStyle);
|
|
8147
8215
|
}
|
|
8148
8216
|
this._textSelectionInner$.next({
|
|
8149
8217
|
textRanges: this._getAllTextRanges(),
|
|
@@ -8182,8 +8250,16 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8182
8250
|
sync() {
|
|
8183
8251
|
this._updateInputPosition();
|
|
8184
8252
|
}
|
|
8253
|
+
setInputPosition(x, y) {
|
|
8254
|
+
this._positionInput(x, y);
|
|
8255
|
+
}
|
|
8185
8256
|
activate(x, y, force = false) {
|
|
8257
|
+
this._positionInput(x, y);
|
|
8258
|
+
if (force && !this._shouldPreserveExternalFocus() || !force && this.canFocusing) this.focus();
|
|
8259
|
+
}
|
|
8260
|
+
_positionInput(x, y) {
|
|
8186
8261
|
this._ensureHostContainer();
|
|
8262
|
+
this._container.style.position = "fixed";
|
|
8187
8263
|
let left = x;
|
|
8188
8264
|
let top = y;
|
|
8189
8265
|
const fixedContainer = this._container.offsetParent;
|
|
@@ -8195,7 +8271,6 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8195
8271
|
this._container.style.left = `${left}px`;
|
|
8196
8272
|
this._container.style.top = `${top}px`;
|
|
8197
8273
|
this._container.style.zIndex = "1000";
|
|
8198
|
-
if (force && !this._shouldPreserveExternalFocus() || !force && this.canFocusing) this.focus();
|
|
8199
8274
|
}
|
|
8200
8275
|
hasFocus() {
|
|
8201
8276
|
return this._getOwnerDocument().activeElement === this._input;
|
|
@@ -8207,9 +8282,6 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8207
8282
|
blur() {
|
|
8208
8283
|
this._input.blur();
|
|
8209
8284
|
}
|
|
8210
|
-
/**
|
|
8211
|
-
* @deprecated
|
|
8212
|
-
*/
|
|
8213
8285
|
deactivate() {
|
|
8214
8286
|
this._container.style.left = "0px";
|
|
8215
8287
|
this._container.style.top = "0px";
|
|
@@ -8666,7 +8738,7 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8666
8738
|
const scrollStop = viewport.onScrollEnd$.subscribeEvent((param) => {
|
|
8667
8739
|
const viewport = param.viewport;
|
|
8668
8740
|
if (!viewport) return;
|
|
8669
|
-
const bounds = viewport.
|
|
8741
|
+
const bounds = viewport.calcViewportInfo();
|
|
8670
8742
|
const activeRangeInstance = this._getActiveRangeInstance();
|
|
8671
8743
|
const anchor = activeRangeInstance === null || activeRangeInstance === void 0 ? void 0 : activeRangeInstance.getAnchor();
|
|
8672
8744
|
if (!anchor || anchor && !anchor.visible) return;
|
|
@@ -8877,8 +8949,8 @@ const SwitchDocModeCommand = {
|
|
|
8877
8949
|
const docDataModel = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
8878
8950
|
if (docDataModel == null) return false;
|
|
8879
8951
|
const unitId = docDataModel.getUnitId();
|
|
8880
|
-
const skeleton = (_renderManagerService = renderManagerService.
|
|
8881
|
-
const docSelectionRenderService = (_renderManagerService2 = renderManagerService.
|
|
8952
|
+
const skeleton = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
8953
|
+
const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
|
|
8882
8954
|
if (skeleton == null || docSelectionRenderService == null) return false;
|
|
8883
8955
|
const segmentId = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegment();
|
|
8884
8956
|
const segmentPage = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegmentPage();
|
|
@@ -9240,13 +9312,14 @@ const DocTableDeleteColumnsCommand = {
|
|
|
9240
9312
|
const DocTableDeleteTableCommand = {
|
|
9241
9313
|
id: "doc.table.delete-table",
|
|
9242
9314
|
type: _univerjs_core.CommandType.COMMAND,
|
|
9243
|
-
handler: async (accessor) => {
|
|
9244
|
-
var _docDataModel$getSelf3;
|
|
9315
|
+
handler: async (accessor, params) => {
|
|
9316
|
+
var _params$targetRange, _docDataModel$getSelf3;
|
|
9245
9317
|
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
9246
9318
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
9247
9319
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
9248
9320
|
const activeRectRanges = docSelectionManagerService.getRectRanges();
|
|
9249
|
-
const
|
|
9321
|
+
const activeTextRange = docSelectionManagerService.getActiveTextRange();
|
|
9322
|
+
const rangeInfo = getRangeInfoFromRanges((_params$targetRange = params === null || params === void 0 ? void 0 : params.targetRange) !== null && _params$targetRange !== void 0 ? _params$targetRange : activeTextRange, (params === null || params === void 0 ? void 0 : params.targetRange) ? [] : activeRectRanges);
|
|
9250
9323
|
if (rangeInfo == null) return false;
|
|
9251
9324
|
const { segmentId } = rangeInfo;
|
|
9252
9325
|
const docDataModel = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -9739,7 +9812,7 @@ var Editor = class extends _univerjs_core.Disposable {
|
|
|
9739
9812
|
return docSelectionRenderService.isFocusing && Boolean(docSelectionRenderService.getActiveTextRange());
|
|
9740
9813
|
}
|
|
9741
9814
|
/**
|
|
9742
|
-
*
|
|
9815
|
+
* Focus the input element directly. This is for internal usage.
|
|
9743
9816
|
*/
|
|
9744
9817
|
focus() {
|
|
9745
9818
|
const curDoc = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -9748,7 +9821,7 @@ var Editor = class extends _univerjs_core.Disposable {
|
|
|
9748
9821
|
this._param.render.with(DocSelectionRenderService).focus();
|
|
9749
9822
|
}
|
|
9750
9823
|
/**
|
|
9751
|
-
*
|
|
9824
|
+
* Blur the input element directly. This is for internal usage.
|
|
9752
9825
|
*/
|
|
9753
9826
|
blur() {
|
|
9754
9827
|
this._param.render.with(DocSelectionRenderService).blur();
|
|
@@ -9828,21 +9901,17 @@ var Editor = class extends _univerjs_core.Disposable {
|
|
|
9828
9901
|
const docDataModel = this._getDocDataModel();
|
|
9829
9902
|
docDataModel === null || docDataModel === void 0 || docDataModel.dispose();
|
|
9830
9903
|
}
|
|
9831
|
-
/**
|
|
9832
|
-
* @deprecated use getEditorId.
|
|
9833
|
-
*/
|
|
9834
|
-
get editorUnitId() {
|
|
9835
|
-
return this._param.editorUnitId;
|
|
9836
|
-
}
|
|
9837
|
-
/**
|
|
9838
|
-
* @deprecated @TODO: @JOCS remove this in the future.
|
|
9839
|
-
*/
|
|
9840
|
-
get params() {
|
|
9841
|
-
return this._param;
|
|
9842
|
-
}
|
|
9843
9904
|
get cancelDefaultResizeListener() {
|
|
9844
9905
|
return this._param.cancelDefaultResizeListener;
|
|
9845
9906
|
}
|
|
9907
|
+
getRenderConfig() {
|
|
9908
|
+
var _this$_param$canvasSt;
|
|
9909
|
+
return {
|
|
9910
|
+
canvasStyle: (_this$_param$canvasSt = this._param.canvasStyle) !== null && _this$_param$canvasSt !== void 0 ? _this$_param$canvasSt : {},
|
|
9911
|
+
scrollBar: this._param.scrollBar,
|
|
9912
|
+
...this._param.backScrollOffset === void 0 ? {} : { backScrollOffset: this._param.backScrollOffset }
|
|
9913
|
+
};
|
|
9914
|
+
}
|
|
9846
9915
|
get render() {
|
|
9847
9916
|
return this._param.render;
|
|
9848
9917
|
}
|
|
@@ -9860,47 +9929,11 @@ var Editor = class extends _univerjs_core.Disposable {
|
|
|
9860
9929
|
}
|
|
9861
9930
|
getSkeleton() {
|
|
9862
9931
|
var _this$_injector$get$g;
|
|
9863
|
-
return (_this$_injector$get$g = this._injector.get(_univerjs_engine_render.IRenderManagerService).
|
|
9932
|
+
return (_this$_injector$get$g = this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(this._getEditorId())) === null || _this$_injector$get$g === void 0 ? void 0 : _this$_injector$get$g.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
9864
9933
|
}
|
|
9865
9934
|
isSheetEditor() {
|
|
9866
9935
|
return (0, _univerjs_core.isInternalEditorID)(this._getEditorId());
|
|
9867
9936
|
}
|
|
9868
|
-
/**
|
|
9869
|
-
* @deprecated use getDocumentData.
|
|
9870
|
-
*/
|
|
9871
|
-
getValue() {
|
|
9872
|
-
var _docDataModel$getBody;
|
|
9873
|
-
return (((_docDataModel$getBody = this._getDocDataModel().getBody()) === null || _docDataModel$getBody === void 0 ? void 0 : _docDataModel$getBody.dataStream) || "").replace(/\r\n/g, "").replace(/\n/g, "").replace(/\n/g, "");
|
|
9874
|
-
}
|
|
9875
|
-
/**
|
|
9876
|
-
* @deprecated use getDocumentData.
|
|
9877
|
-
*/
|
|
9878
|
-
getBody() {
|
|
9879
|
-
return this._getDocDataModel().getBody();
|
|
9880
|
-
}
|
|
9881
|
-
/**
|
|
9882
|
-
* @deprecated.
|
|
9883
|
-
*/
|
|
9884
|
-
update(param) {
|
|
9885
|
-
this._param = {
|
|
9886
|
-
...this._param,
|
|
9887
|
-
...param
|
|
9888
|
-
};
|
|
9889
|
-
}
|
|
9890
|
-
/**
|
|
9891
|
-
* @deprecated.
|
|
9892
|
-
*/
|
|
9893
|
-
updateCanvasStyle() {
|
|
9894
|
-
var _this$_param$canvasSt;
|
|
9895
|
-
const docDataModel = this._getDocDataModel();
|
|
9896
|
-
if (docDataModel == null) return;
|
|
9897
|
-
const documentStyle = {};
|
|
9898
|
-
if ((_this$_param$canvasSt = this._param.canvasStyle) === null || _this$_param$canvasSt === void 0 ? void 0 : _this$_param$canvasSt.fontSize) {
|
|
9899
|
-
if (documentStyle.textStyle == null) documentStyle.textStyle = {};
|
|
9900
|
-
documentStyle.textStyle.fs = this._param.canvasStyle.fontSize;
|
|
9901
|
-
}
|
|
9902
|
-
docDataModel.updateDocumentStyle(documentStyle);
|
|
9903
|
-
}
|
|
9904
9937
|
_getDocDataModel() {
|
|
9905
9938
|
const editorUnitId = this._getEditorId();
|
|
9906
9939
|
return this._univerInstanceService.getUnit(editorUnitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
@@ -9974,13 +10007,14 @@ let EditorService = class EditorService extends _univerjs_core.Disposable {
|
|
|
9974
10007
|
this._blur$.next(null);
|
|
9975
10008
|
}
|
|
9976
10009
|
focus(editorUnitId) {
|
|
10010
|
+
var _editor$getDocumentDa, _editor$getDocumentDa2;
|
|
9977
10011
|
if (editorUnitId === this._focusEditorUnitId) return;
|
|
9978
10012
|
if (this._focusEditorUnitId) this.blur();
|
|
9979
10013
|
if (editorUnitId == null) return;
|
|
9980
10014
|
const editor = this.getEditor(editorUnitId);
|
|
9981
10015
|
if (editor == null) return;
|
|
9982
10016
|
this._univerInstanceService.setCurrentUnitForType(editorUnitId);
|
|
9983
|
-
const valueCount = editor.
|
|
10017
|
+
const valueCount = ((_editor$getDocumentDa = (_editor$getDocumentDa2 = editor.getDocumentData().body) === null || _editor$getDocumentDa2 === void 0 ? void 0 : _editor$getDocumentDa2.dataStream) !== null && _editor$getDocumentDa !== void 0 ? _editor$getDocumentDa : "").replace(/\r?\n/g, "").length;
|
|
9984
10018
|
this._contextService.setContextValue(_univerjs_core.EDITOR_ACTIVATED, true);
|
|
9985
10019
|
if (!(0, _univerjs_core.isInternalEditorID)(editorUnitId)) this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_STANDALONE, true);
|
|
9986
10020
|
if ((0, _univerjs_core.isCommentEditorID)(editorUnitId)) this._contextService.setContextValue(_univerjs_core.FOCUSING_COMMENT_EDITOR, true);
|
|
@@ -10003,32 +10037,23 @@ let EditorService = class EditorService extends _univerjs_core.Disposable {
|
|
|
10003
10037
|
return this._editors;
|
|
10004
10038
|
}
|
|
10005
10039
|
getEditorRenderConfig(editorUnitId) {
|
|
10006
|
-
var _this$_editorRenderCo;
|
|
10040
|
+
var _ref, _this$_editorRenderCo;
|
|
10007
10041
|
const editor = this._editors.get(editorUnitId);
|
|
10008
|
-
|
|
10009
|
-
var _editor$params$canvas;
|
|
10010
|
-
return {
|
|
10011
|
-
canvasStyle: (_editor$params$canvas = editor.params.canvasStyle) !== null && _editor$params$canvas !== void 0 ? _editor$params$canvas : {},
|
|
10012
|
-
scrollBar: editor.params.scrollBar
|
|
10013
|
-
};
|
|
10014
|
-
}
|
|
10015
|
-
return (_this$_editorRenderCo = this._editorRenderConfigs.get(editorUnitId)) !== null && _this$_editorRenderCo !== void 0 ? _this$_editorRenderCo : null;
|
|
10042
|
+
return (_ref = (_this$_editorRenderCo = this._editorRenderConfigs.get(editorUnitId)) !== null && _this$_editorRenderCo !== void 0 ? _this$_editorRenderCo : editor === null || editor === void 0 ? void 0 : editor.getRenderConfig()) !== null && _ref !== void 0 ? _ref : null;
|
|
10016
10043
|
}
|
|
10017
10044
|
register(config, container) {
|
|
10018
10045
|
const { initialSnapshot, canvasStyle = {} } = config;
|
|
10019
10046
|
const editorUnitId = initialSnapshot.id;
|
|
10020
10047
|
this._editorRenderConfigs.set(editorUnitId, {
|
|
10021
10048
|
canvasStyle,
|
|
10022
|
-
scrollBar: config.scrollBar
|
|
10049
|
+
scrollBar: config.scrollBar,
|
|
10050
|
+
...config.backScrollOffset === void 0 ? {} : { backScrollOffset: config.backScrollOffset }
|
|
10023
10051
|
});
|
|
10024
10052
|
if (this._univerInstanceService.getUnit(editorUnitId, _univerjs_core.UniverInstanceType.UNIVER_DOC) == null) this._univerInstanceService.createUnit(_univerjs_core.UniverInstanceType.UNIVER_DOC, initialSnapshot || this._getBlank(editorUnitId), { makeCurrent: false });
|
|
10025
|
-
let render = this._renderManagerService.
|
|
10026
|
-
if (render == null)
|
|
10027
|
-
this._renderManagerService.create(editorUnitId);
|
|
10028
|
-
render = this._renderManagerService.getRenderById(editorUnitId);
|
|
10029
|
-
}
|
|
10053
|
+
let render = this._renderManagerService.getRenderUnitById(editorUnitId);
|
|
10054
|
+
if (render == null) render = this._renderManagerService.createRender(editorUnitId);
|
|
10030
10055
|
if (render) {
|
|
10031
|
-
render.engine.
|
|
10056
|
+
render.engine.mount(container);
|
|
10032
10057
|
const editor = new Editor({
|
|
10033
10058
|
...config,
|
|
10034
10059
|
render,
|
|
@@ -10138,7 +10163,7 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
|
|
|
10138
10163
|
anchorNodePosition && this.scrollToNode(anchorNodePosition);
|
|
10139
10164
|
}
|
|
10140
10165
|
scrollToNode(startNodePosition) {
|
|
10141
|
-
var
|
|
10166
|
+
var _editorRenderConfig$b;
|
|
10142
10167
|
const { unitId, scene, mainComponent } = this._context;
|
|
10143
10168
|
const skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
10144
10169
|
if (mainComponent == null || skeleton == null) return;
|
|
@@ -10149,12 +10174,12 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
|
|
|
10149
10174
|
const left = aLeft + docsLeft;
|
|
10150
10175
|
const top = aTop + docsTop;
|
|
10151
10176
|
const viewportMain = scene.getViewport("viewMain");
|
|
10152
|
-
const editor = this._editorService.getEditor(unitId);
|
|
10153
10177
|
if (viewportMain == null) return;
|
|
10154
|
-
const { left: boundLeft, top: boundTop, right: boundRight, bottom: boundBottom } = viewportMain.
|
|
10178
|
+
const { left: boundLeft, top: boundTop, right: boundRight, bottom: boundBottom } = viewportMain.calcViewportInfo().viewBound;
|
|
10155
10179
|
let offsetY = 0;
|
|
10156
10180
|
let offsetX = 0;
|
|
10157
|
-
const
|
|
10181
|
+
const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
|
|
10182
|
+
const delta = editorRenderConfig ? (_editorRenderConfig$b = editorRenderConfig.backScrollOffset) !== null && _editorRenderConfig$b !== void 0 ? _editorRenderConfig$b : 0 : 100;
|
|
10158
10183
|
if (top < boundTop) offsetY = top - boundTop - delta;
|
|
10159
10184
|
else if (top > boundBottom - height) offsetY = top - boundBottom + height + delta;
|
|
10160
10185
|
if (left < boundLeft) offsetX = left - boundLeft;
|
|
@@ -10200,12 +10225,15 @@ let DocParagraphPlaceholderRenderController = class DocParagraphPlaceholderRende
|
|
|
10200
10225
|
this.disposeWithMe(documents.pageRender$.subscribe((pageRenderConfig) => this._drawPagePlaceholders(pageRenderConfig)));
|
|
10201
10226
|
}
|
|
10202
10227
|
_drawPagePlaceholders({ page, pageLeft, pageTop, ctx }) {
|
|
10203
|
-
var _this$_context$unit$g, _activeRange$segmentI, _page$segmentId;
|
|
10228
|
+
var _this$_context$unit$g, _activeRange$segmentI, _page$segmentId, _this$_context$mainCo;
|
|
10204
10229
|
const body = (_this$_context$unit$g = this._context.unit.getSelfOrHeaderFooterModel(page.segmentId)) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getBody();
|
|
10205
10230
|
if (!body) return;
|
|
10206
10231
|
const activeRange = this._docSelectionManagerService.getActiveTextRange();
|
|
10207
10232
|
if (!activeRange || ((_activeRange$segmentI = activeRange.segmentId) !== null && _activeRange$segmentI !== void 0 ? _activeRange$segmentI : "") !== ((_page$segmentId = page.segmentId) !== null && _page$segmentId !== void 0 ? _page$segmentId : "")) return;
|
|
10208
|
-
const placeholders = getParagraphPlaceholderLayouts(page, body, this._getLocale(), pageLeft, pageTop, activeRange.startOffset
|
|
10233
|
+
const placeholders = getParagraphPlaceholderLayouts(page, body, this._getLocale(), pageLeft, pageTop, activeRange.startOffset, {
|
|
10234
|
+
docsLeft: (_this$_context$mainCo = this._context.mainComponent) === null || _this$_context$mainCo === void 0 ? void 0 : _this$_context$mainCo.getOffsetConfig().docsLeft,
|
|
10235
|
+
unitId: this._context.unitId
|
|
10236
|
+
});
|
|
10209
10237
|
if (!placeholders.length) return;
|
|
10210
10238
|
drawParagraphPlaceholders(ctx, placeholders);
|
|
10211
10239
|
}
|
|
@@ -10232,20 +10260,39 @@ function shouldRenderParagraphPlaceholder(documentModel, unitId, config) {
|
|
|
10232
10260
|
if ((0, _univerjs_core.isInternalEditorID)(unitId)) return false;
|
|
10233
10261
|
return ((_documentModel$getSna = documentModel.getSnapshot().documentStyle) === null || _documentModel$getSna === void 0 ? void 0 : _documentModel$getSna.documentFlavor) === _univerjs_core.DocumentFlavor.MODERN;
|
|
10234
10262
|
}
|
|
10235
|
-
function getParagraphPlaceholderLayouts(page, body, locale, pageLeft = 0, pageTop = 0, activeOffset) {
|
|
10263
|
+
function getParagraphPlaceholderLayouts(page, body, locale, pageLeft = 0, pageTop = 0, activeOffset, options) {
|
|
10236
10264
|
var _body$paragraphs, _page$skeTables;
|
|
10237
10265
|
const paragraphs = new Map(((_body$paragraphs = body.paragraphs) !== null && _body$paragraphs !== void 0 ? _body$paragraphs : []).map((paragraph) => [paragraph.startIndex, paragraph]));
|
|
10238
10266
|
const layouts = [];
|
|
10239
|
-
const visitSection = (section, originLeft, originTop) => {
|
|
10240
|
-
for (const column of section.columns) visitColumn(column, body, paragraphs, locale, layouts, originLeft + column.left, originTop + section.top, activeOffset);
|
|
10267
|
+
const visitSection = (section, originLeft, originTop, clip) => {
|
|
10268
|
+
for (const column of section.columns) visitColumn(column, body, paragraphs, locale, layouts, originLeft + column.left, originTop + section.top, activeOffset, clip);
|
|
10241
10269
|
};
|
|
10242
10270
|
for (const section of page.sections) visitSection(section, pageLeft + page.marginLeft, pageTop + page.marginTop);
|
|
10243
|
-
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table) => {
|
|
10244
|
-
|
|
10271
|
+
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table, tableId) => {
|
|
10272
|
+
var _table$tableId, _options$unitId, _viewport$leadingInse, _viewport$trailingIns, _viewport$leadingInse2;
|
|
10273
|
+
const sourceTableId = (0, _univerjs_engine_render.getTableIdAndSliceIndex)((_table$tableId = table.tableId) !== null && _table$tableId !== void 0 ? _table$tableId : tableId).tableId;
|
|
10274
|
+
const viewport = (0, _univerjs_engine_render.getDocsTableRenderViewport)((_options$unitId = options === null || options === void 0 ? void 0 : options.unitId) !== null && _options$unitId !== void 0 ? _options$unitId : "", sourceTableId);
|
|
10275
|
+
const hasHorizontalViewport = viewport != null && ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0) + viewport.contentWidth + ((_viewport$trailingIns = viewport.trailingInsetRight) !== null && _viewport$trailingIns !== void 0 ? _viewport$trailingIns : 0) > viewport.viewportWidth;
|
|
10276
|
+
const tableLeft = pageLeft + page.marginLeft + table.left;
|
|
10277
|
+
const tableViewportLeft = hasHorizontalViewport ? (0, _univerjs_engine_render.getDocsTableViewportLeft)(viewport, tableLeft - ((_viewport$leadingInse2 = viewport.leadingInsetLeft) !== null && _viewport$leadingInse2 !== void 0 ? _viewport$leadingInse2 : 0), options === null || options === void 0 ? void 0 : options.docsLeft) : tableLeft;
|
|
10278
|
+
const tableViewportRight = tableViewportLeft + (hasHorizontalViewport ? viewport.viewportWidth : table.width);
|
|
10279
|
+
const tableScrollLeft = hasHorizontalViewport ? viewport.scrollLeft : 0;
|
|
10280
|
+
for (const row of table.rows) for (const cell of row.cells) {
|
|
10281
|
+
const cellLeft = tableLeft + cell.left - tableScrollLeft;
|
|
10282
|
+
const cellContentLeft = cellLeft + cell.marginLeft;
|
|
10283
|
+
const cellContentRight = cellLeft + cell.pageWidth - cell.marginRight;
|
|
10284
|
+
const clipLeft = Math.max(cellContentLeft, tableViewportLeft);
|
|
10285
|
+
const clipRight = Math.min(cellContentRight, tableViewportRight);
|
|
10286
|
+
if (clipRight <= clipLeft) continue;
|
|
10287
|
+
for (const section of cell.sections) visitSection(section, cellContentLeft, pageTop + page.marginTop + table.top + row.top + cell.marginTop, {
|
|
10288
|
+
left: clipLeft,
|
|
10289
|
+
right: clipRight
|
|
10290
|
+
});
|
|
10291
|
+
}
|
|
10245
10292
|
});
|
|
10246
10293
|
return layouts;
|
|
10247
10294
|
}
|
|
10248
|
-
function visitColumn(column, body, paragraphs, locale, layouts, originLeft, originTop, activeOffset) {
|
|
10295
|
+
function visitColumn(column, body, paragraphs, locale, layouts, originLeft, originTop, activeOffset, clip) {
|
|
10249
10296
|
for (const line of column.lines) {
|
|
10250
10297
|
if (!line.paragraphStart) continue;
|
|
10251
10298
|
const paragraphStart = line.st;
|
|
@@ -10255,7 +10302,7 @@ function visitColumn(column, body, paragraphs, locale, layouts, originLeft, orig
|
|
|
10255
10302
|
if (!paragraph || !isEmptyParagraph(body.dataStream, line.st, line.paragraphIndex)) continue;
|
|
10256
10303
|
const text = getPlaceholderText(paragraph, locale);
|
|
10257
10304
|
if (!text) continue;
|
|
10258
|
-
layouts.push(getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop));
|
|
10305
|
+
layouts.push(getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop, clip));
|
|
10259
10306
|
}
|
|
10260
10307
|
}
|
|
10261
10308
|
function isOffsetInParagraph(offset, paragraphStart, paragraphEnd) {
|
|
@@ -10273,8 +10320,8 @@ function getPlaceholderText(paragraph, locale) {
|
|
|
10273
10320
|
default: return locale.normalText;
|
|
10274
10321
|
}
|
|
10275
10322
|
}
|
|
10276
|
-
function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop) {
|
|
10277
|
-
var _divide$glyphGroup, _paragraph$paragraphS2, _paragraph$paragraphS3, _getLineFontFamily, _divide$left, _divide$paddingLeft, _ref, _divide$width;
|
|
10323
|
+
function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop, clip) {
|
|
10324
|
+
var _divide$glyphGroup, _paragraph$paragraphS2, _paragraph$paragraphS3, _getLineFontFamily, _divide$left, _divide$paddingLeft, _ref, _divide$width, _clip$left, _clip$right;
|
|
10278
10325
|
const divide = line.divides[0];
|
|
10279
10326
|
const firstGlyph = ((_divide$glyphGroup = divide === null || divide === void 0 ? void 0 : divide.glyphGroup) !== null && _divide$glyphGroup !== void 0 ? _divide$glyphGroup : [])[0];
|
|
10280
10327
|
const textStyle = _univerjs_core.NAMED_STYLE_MAP[(_paragraph$paragraphS2 = (_paragraph$paragraphS3 = paragraph.paragraphStyle) === null || _paragraph$paragraphS3 === void 0 ? void 0 : _paragraph$paragraphS3.namedStyleType) !== null && _paragraph$paragraphS2 !== void 0 ? _paragraph$paragraphS2 : _univerjs_core.NamedStyleType.NORMAL_TEXT];
|
|
@@ -10283,13 +10330,22 @@ function getLinePlaceholderLayout(line, paragraph, text, originLeft, originTop)
|
|
|
10283
10330
|
const fontWeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.bl) ? "bold" : "normal";
|
|
10284
10331
|
const lineStartX = originLeft + ((_divide$left = divide === null || divide === void 0 ? void 0 : divide.left) !== null && _divide$left !== void 0 ? _divide$left : 0) + ((_divide$paddingLeft = divide === null || divide === void 0 ? void 0 : divide.paddingLeft) !== null && _divide$paddingLeft !== void 0 ? _divide$paddingLeft : 0);
|
|
10285
10332
|
const listOffset = paragraph.bullet && firstGlyph ? firstGlyph.left + firstGlyph.width + LIST_PLACEHOLDER_GAP : 0;
|
|
10333
|
+
const x = lineStartX + listOffset;
|
|
10334
|
+
const naturalMaxWidth = Math.max(0, ((_ref = (_divide$width = divide === null || divide === void 0 ? void 0 : divide.width) !== null && _divide$width !== void 0 ? _divide$width : line.width) !== null && _ref !== void 0 ? _ref : 0) - listOffset);
|
|
10335
|
+
const clipLeft = Math.max(x, (_clip$left = clip === null || clip === void 0 ? void 0 : clip.left) !== null && _clip$left !== void 0 ? _clip$left : x);
|
|
10336
|
+
const clipRight = Math.min(x + naturalMaxWidth, (_clip$right = clip === null || clip === void 0 ? void 0 : clip.right) !== null && _clip$right !== void 0 ? _clip$right : x + naturalMaxWidth);
|
|
10337
|
+
const clipTop = originTop + line.top;
|
|
10286
10338
|
return {
|
|
10339
|
+
clipBottom: clipTop + line.lineHeight,
|
|
10340
|
+
clipLeft,
|
|
10341
|
+
clipRight,
|
|
10342
|
+
clipTop,
|
|
10287
10343
|
fontFamily,
|
|
10288
10344
|
fontSize,
|
|
10289
10345
|
fontWeight,
|
|
10290
|
-
maxWidth: Math.max(0,
|
|
10346
|
+
maxWidth: Math.max(0, clipRight - clipLeft),
|
|
10291
10347
|
text,
|
|
10292
|
-
x
|
|
10348
|
+
x,
|
|
10293
10349
|
y: originTop + line.top + line.marginTop + line.paddingTop + line.asc
|
|
10294
10350
|
};
|
|
10295
10351
|
}
|
|
@@ -10329,8 +10385,20 @@ function drawParagraphPlaceholders(ctx, placeholders) {
|
|
|
10329
10385
|
ctx.fillStyle = PLACEHOLDER_COLOR;
|
|
10330
10386
|
ctx.textBaseline = "alphabetic";
|
|
10331
10387
|
for (const placeholder of placeholders) {
|
|
10388
|
+
var _placeholder$clipLeft, _placeholder$clipRigh, _placeholder$clipTop, _placeholder$clipBott;
|
|
10389
|
+
const clipLeft = (_placeholder$clipLeft = placeholder.clipLeft) !== null && _placeholder$clipLeft !== void 0 ? _placeholder$clipLeft : placeholder.x;
|
|
10390
|
+
const clipRight = (_placeholder$clipRigh = placeholder.clipRight) !== null && _placeholder$clipRigh !== void 0 ? _placeholder$clipRigh : placeholder.x + placeholder.maxWidth;
|
|
10391
|
+
const clipTop = (_placeholder$clipTop = placeholder.clipTop) !== null && _placeholder$clipTop !== void 0 ? _placeholder$clipTop : placeholder.y - placeholder.fontSize;
|
|
10392
|
+
const clipBottom = (_placeholder$clipBott = placeholder.clipBottom) !== null && _placeholder$clipBott !== void 0 ? _placeholder$clipBott : placeholder.y + placeholder.fontSize;
|
|
10393
|
+
if (clipRight <= clipLeft || clipBottom <= clipTop) continue;
|
|
10394
|
+
ctx.save();
|
|
10395
|
+
ctx.beginPath();
|
|
10396
|
+
ctx.rectByPrecision(clipLeft, clipTop, clipRight - clipLeft, clipBottom - clipTop);
|
|
10397
|
+
ctx.closePath();
|
|
10398
|
+
ctx.clip();
|
|
10332
10399
|
ctx.font = `${placeholder.fontWeight} ${placeholder.fontSize}px ${placeholder.fontFamily}`;
|
|
10333
|
-
ctx.fillText(placeholder.text, placeholder.x, placeholder.y
|
|
10400
|
+
ctx.fillText(placeholder.text, placeholder.x, placeholder.y);
|
|
10401
|
+
ctx.restore();
|
|
10334
10402
|
}
|
|
10335
10403
|
ctx.restore();
|
|
10336
10404
|
}
|
|
@@ -10477,7 +10545,10 @@ let DocPageLayoutService = class DocPageLayoutService extends _univerjs_core.Dis
|
|
|
10477
10545
|
}
|
|
10478
10546
|
if (engineHeight > docsHeight) sceneHeight = (engineHeight - pageMarginTop * 2) / viewScale;
|
|
10479
10547
|
else sceneHeight = docsHeight + pageMarginTop * 2;
|
|
10480
|
-
scene.
|
|
10548
|
+
scene.transformByState({
|
|
10549
|
+
width: sceneWidth,
|
|
10550
|
+
height: sceneHeight
|
|
10551
|
+
});
|
|
10481
10552
|
if (engineWidth <= 1) {
|
|
10482
10553
|
docsLeft = -1e4;
|
|
10483
10554
|
docsTop = -1e4;
|
|
@@ -10514,7 +10585,7 @@ let DocRenderController = class DocRenderController extends _univerjs_core.RxDis
|
|
|
10514
10585
|
}
|
|
10515
10586
|
reRender(unitId) {
|
|
10516
10587
|
var _this$_renderManagerS;
|
|
10517
|
-
const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.
|
|
10588
|
+
const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService);
|
|
10518
10589
|
const skeleton = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getSkeleton();
|
|
10519
10590
|
if (!skeleton) return;
|
|
10520
10591
|
if (!!skeleton.getViewModel().getDataModel().getSnapshot().disabled) return;
|
|
@@ -10662,7 +10733,10 @@ let DocRenderController = class DocRenderController extends _univerjs_core.RxDis
|
|
|
10662
10733
|
docsComponent.resize(width, height);
|
|
10663
10734
|
docBackground.resize(width, height);
|
|
10664
10735
|
const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
|
|
10665
|
-
if (!editorRenderConfig || editorRenderConfig.scrollBar) scene.
|
|
10736
|
+
if (!editorRenderConfig || editorRenderConfig.scrollBar) scene.transformByState({
|
|
10737
|
+
width,
|
|
10738
|
+
height
|
|
10739
|
+
});
|
|
10666
10740
|
}
|
|
10667
10741
|
_syncCanvasBackground(documentFlavor = this._context.unit.getSnapshot().documentStyle.documentFlavor) {
|
|
10668
10742
|
var _docBackground$setFil;
|
|
@@ -10709,10 +10783,7 @@ function getPageSizeInModernMode(page) {
|
|
|
10709
10783
|
const { marginLeft, marginRight, marginTop, marginBottom, skeDrawings, skeTables } = page;
|
|
10710
10784
|
if (pageWidth === Number.POSITIVE_INFINITY) pageWidth = page.width + marginLeft + marginRight;
|
|
10711
10785
|
if (pageHeight === Number.POSITIVE_INFINITY) pageHeight = page.height + marginTop + marginBottom;
|
|
10712
|
-
for (const drawing of skeDrawings.values())
|
|
10713
|
-
pageWidth = Math.max(pageWidth, drawing.aLeft + drawing.width + marginLeft + marginRight);
|
|
10714
|
-
pageHeight = Math.max(pageHeight, drawing.aTop + drawing.height + marginTop + marginBottom);
|
|
10715
|
-
}
|
|
10786
|
+
for (const drawing of skeDrawings.values()) pageHeight = Math.max(pageHeight, drawing.aTop + drawing.height + marginTop + marginBottom);
|
|
10716
10787
|
for (const table of skeTables.values()) pageHeight = Math.max(pageHeight, table.top + table.height + marginTop + marginBottom);
|
|
10717
10788
|
return {
|
|
10718
10789
|
pageWidth,
|
|
@@ -10853,7 +10924,7 @@ const CloseHeaderFooterCommand = {
|
|
|
10853
10924
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
10854
10925
|
const unitId = (_params$unitId = params === null || params === void 0 ? void 0 : params.unitId) !== null && _params$unitId !== void 0 ? _params$unitId : (_instanceService$getC = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId();
|
|
10855
10926
|
if (unitId == null) return false;
|
|
10856
|
-
const renderObject = renderManagerService.
|
|
10927
|
+
const renderObject = renderManagerService.getRenderUnitById(unitId);
|
|
10857
10928
|
if (renderObject == null) return false;
|
|
10858
10929
|
const docSkeletonManagerService = renderObject.with(_univerjs_docs.DocSkeletonManagerService);
|
|
10859
10930
|
const viewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
|
|
@@ -10974,9 +11045,10 @@ const DOC_SECTION_SETTING_COMPONENT = "doc_ui_section-setting-panel";
|
|
|
10974
11045
|
* limitations under the License.
|
|
10975
11046
|
*/
|
|
10976
11047
|
let DocSectionSettingController = class DocSectionSettingController extends _univerjs_core.Disposable {
|
|
10977
|
-
constructor(_sidebarService) {
|
|
11048
|
+
constructor(_sidebarService, _selectionManager) {
|
|
10978
11049
|
super();
|
|
10979
11050
|
this._sidebarService = _sidebarService;
|
|
11051
|
+
this._selectionManager = _selectionManager;
|
|
10980
11052
|
_defineProperty(this, "_panelId", "DocSectionSetting");
|
|
10981
11053
|
}
|
|
10982
11054
|
openPanel() {
|
|
@@ -10990,8 +11062,19 @@ let DocSectionSettingController = class DocSectionSettingController extends _uni
|
|
|
10990
11062
|
closePanel() {
|
|
10991
11063
|
this._sidebarService.close(this._panelId);
|
|
10992
11064
|
}
|
|
11065
|
+
navigateToSectionEnd(unitId, sectionStart, sectionEnd) {
|
|
11066
|
+
const params = {
|
|
11067
|
+
unitId,
|
|
11068
|
+
subUnitId: unitId
|
|
11069
|
+
};
|
|
11070
|
+
const cursorOffset = Math.max(sectionStart, sectionEnd - 1);
|
|
11071
|
+
this._selectionManager.replaceDocRanges([{
|
|
11072
|
+
startOffset: cursorOffset,
|
|
11073
|
+
endOffset: cursorOffset
|
|
11074
|
+
}], params, true, { shouldFocus: false });
|
|
11075
|
+
}
|
|
10993
11076
|
};
|
|
10994
|
-
DocSectionSettingController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ISidebarService))], DocSectionSettingController);
|
|
11077
|
+
DocSectionSettingController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ISidebarService)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_docs.DocSelectionManagerService))], DocSectionSettingController);
|
|
10995
11078
|
|
|
10996
11079
|
//#endregion
|
|
10997
11080
|
//#region src/commands/operations/doc-section-setting-panel.operation.ts
|
|
@@ -11004,6 +11087,52 @@ const DocSectionSettingPanelOperation = {
|
|
|
11004
11087
|
}
|
|
11005
11088
|
};
|
|
11006
11089
|
|
|
11090
|
+
//#endregion
|
|
11091
|
+
//#region src/commands/operations/insert-break.operation.ts
|
|
11092
|
+
function getCollapsedBodyOffset(selectionManager) {
|
|
11093
|
+
const range = selectionManager.getActiveTextRange();
|
|
11094
|
+
if (!(range === null || range === void 0 ? void 0 : range.collapsed) || range.segmentId || !Number.isInteger(range.startOffset)) return null;
|
|
11095
|
+
return range.startOffset;
|
|
11096
|
+
}
|
|
11097
|
+
const InsertDocumentColumnBreakOperation = {
|
|
11098
|
+
id: "docs.operation.insert-column-break",
|
|
11099
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
11100
|
+
handler: (accessor) => {
|
|
11101
|
+
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
11102
|
+
const selectionManager = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
11103
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
11104
|
+
const document = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
11105
|
+
const offset = getCollapsedBodyOffset(selectionManager);
|
|
11106
|
+
if (!document || document.getDocumentStyle().documentFlavor !== _univerjs_core.DocumentFlavor.TRADITIONAL || offset == null) return false;
|
|
11107
|
+
return commandService.syncExecuteCommand(_univerjs_docs.InsertDocumentColumnBreakCommand.id, {
|
|
11108
|
+
unitId: document.getUnitId(),
|
|
11109
|
+
offset
|
|
11110
|
+
});
|
|
11111
|
+
}
|
|
11112
|
+
};
|
|
11113
|
+
const InsertDocumentSectionBreakOperation = {
|
|
11114
|
+
id: "docs.operation.insert-section-break",
|
|
11115
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
11116
|
+
handler: (accessor, params) => {
|
|
11117
|
+
var _body$sectionBreaks;
|
|
11118
|
+
if (!params) return false;
|
|
11119
|
+
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
11120
|
+
const selectionManager = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
11121
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
11122
|
+
const document = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
11123
|
+
const offset = getCollapsedBodyOffset(selectionManager);
|
|
11124
|
+
const body = document === null || document === void 0 ? void 0 : document.getBody();
|
|
11125
|
+
if (!document || !body || document.getDocumentStyle().documentFlavor !== _univerjs_core.DocumentFlavor.TRADITIONAL || offset == null) return false;
|
|
11126
|
+
const sectionId = (0, _univerjs_core.createSectionId)(new Set((_body$sectionBreaks = body.sectionBreaks) === null || _body$sectionBreaks === void 0 ? void 0 : _body$sectionBreaks.map((section) => section.sectionId)));
|
|
11127
|
+
return commandService.syncExecuteCommand(_univerjs_docs.InsertDocumentSectionBreakCommand.id, {
|
|
11128
|
+
unitId: document.getUnitId(),
|
|
11129
|
+
offset,
|
|
11130
|
+
sectionId,
|
|
11131
|
+
nextSectionType: params.sectionType
|
|
11132
|
+
});
|
|
11133
|
+
}
|
|
11134
|
+
};
|
|
11135
|
+
|
|
11007
11136
|
//#endregion
|
|
11008
11137
|
//#region src/views/PageSettings.tsx
|
|
11009
11138
|
const MODERN_WIDTH_OPTIONS = [
|
|
@@ -11095,7 +11224,7 @@ function PageSettings(props) {
|
|
|
11095
11224
|
className: "univer-grid univer-grid-cols-3 univer-gap-2",
|
|
11096
11225
|
children: MODERN_WIDTH_OPTIONS.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
11097
11226
|
type: "button",
|
|
11098
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
11227
|
+
className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, _univerjs_design.borderClassName, "univer-h-16 univer-flex-col univer-gap-1 univer-rounded-lg univer-bg-white univer-text-sm univer-font-medium univer-text-gray-700 univer-transition-colors hover:univer-border-primary-500 hover:univer-text-primary-600 dark:!univer-bg-gray-900 dark:!univer-text-gray-100", { "!univer-border-primary-500 !univer-bg-primary-50 !univer-text-primary-600 dark:!univer-bg-primary-900": settings.modernWidth === option }),
|
|
11099
11228
|
onClick: () => handleModernWidthChange(option),
|
|
11100
11229
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t(`docs-ui.page-settings.modern-width-${option}`) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
11101
11230
|
className: "univer-text-xs univer-font-normal univer-text-gray-400",
|
|
@@ -11586,6 +11715,54 @@ function DeleteTableMenuItemFactory(accessor) {
|
|
|
11586
11715
|
};
|
|
11587
11716
|
}
|
|
11588
11717
|
|
|
11718
|
+
//#endregion
|
|
11719
|
+
//#region src/commands/commands/insert-special-character.command.ts
|
|
11720
|
+
const InsertSpecialCharacterCommand = {
|
|
11721
|
+
id: "doc.command.insert-special-character",
|
|
11722
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
11723
|
+
handler: (accessor, params) => {
|
|
11724
|
+
var _docDataModel$getSelf, _originBody$customRan, _originBody$customDec;
|
|
11725
|
+
if (!(params === null || params === void 0 ? void 0 : params.value)) return false;
|
|
11726
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
11727
|
+
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
11728
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
11729
|
+
const docMenuStyleService = accessor.get(DocMenuStyleService);
|
|
11730
|
+
const docDataModel = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
11731
|
+
const activeRange = docSelectionManagerService.getActiveTextRange();
|
|
11732
|
+
if (!docDataModel || !activeRange) return false;
|
|
11733
|
+
const { segmentId } = activeRange;
|
|
11734
|
+
const originBody = (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.getBody();
|
|
11735
|
+
if (!originBody) return false;
|
|
11736
|
+
const { value } = params;
|
|
11737
|
+
const curTextRun = getTextRunAtPosition(originBody, activeRange.endOffset, docMenuStyleService.getDefaultStyle(), docMenuStyleService.getStyleCache());
|
|
11738
|
+
const curCustomRange = getCustomRangeAtPosition((_originBody$customRan = originBody.customRanges) !== null && _originBody$customRan !== void 0 ? _originBody$customRan : [], activeRange.endOffset);
|
|
11739
|
+
const curCustomDecorations = getCustomDecorationAtPosition((_originBody$customDec = originBody.customDecorations) !== null && _originBody$customDec !== void 0 ? _originBody$customDec : [], activeRange.endOffset);
|
|
11740
|
+
return commandService.executeCommand(_univerjs_docs.InsertTextCommand.id, {
|
|
11741
|
+
unitId: docDataModel.getUnitId(),
|
|
11742
|
+
body: {
|
|
11743
|
+
dataStream: value,
|
|
11744
|
+
textRuns: [{
|
|
11745
|
+
...curTextRun,
|
|
11746
|
+
st: 0,
|
|
11747
|
+
ed: value.length
|
|
11748
|
+
}],
|
|
11749
|
+
customRanges: curCustomRange ? [{
|
|
11750
|
+
...curCustomRange,
|
|
11751
|
+
startIndex: 0,
|
|
11752
|
+
endIndex: value.length - 1
|
|
11753
|
+
}] : [],
|
|
11754
|
+
customDecorations: curCustomDecorations.map((customDecoration) => ({
|
|
11755
|
+
...customDecoration,
|
|
11756
|
+
startIndex: 0,
|
|
11757
|
+
endIndex: value.length - 1
|
|
11758
|
+
}))
|
|
11759
|
+
},
|
|
11760
|
+
range: activeRange,
|
|
11761
|
+
segmentId
|
|
11762
|
+
});
|
|
11763
|
+
}
|
|
11764
|
+
};
|
|
11765
|
+
|
|
11589
11766
|
//#endregion
|
|
11590
11767
|
//#region src/views/const.ts
|
|
11591
11768
|
/**
|
|
@@ -11626,6 +11803,7 @@ const ListTypePicker = (props) => {
|
|
|
11626
11803
|
const { value, onChange, options } = props;
|
|
11627
11804
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11628
11805
|
className: "univer-grid univer-grid-cols-3 univer-gap-2 univer-p-1.5",
|
|
11806
|
+
"data-u-editor-interaction-boundary": "true",
|
|
11629
11807
|
children: options.map((item) => {
|
|
11630
11808
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
11631
11809
|
className: (0, _univerjs_design.clsx)("univer-block univer-h-20 univer-w-[72px] univer-cursor-pointer univer-overflow-hidden univer-rounded univer-transition-all hover:univer-border-primary-500", _univerjs_design.borderClassName, { "univer-border-primary-500": value === item.value }),
|
|
@@ -11750,16 +11928,22 @@ function getInsertTableHiddenObservable(accessor) {
|
|
|
11750
11928
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
11751
11929
|
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
11752
11930
|
return new rxjs.Observable((subscriber) => {
|
|
11931
|
+
let editAreaSubscription = null;
|
|
11753
11932
|
const subscription = univerInstanceService.focused$.subscribe((unitId) => {
|
|
11933
|
+
editAreaSubscription === null || editAreaSubscription === void 0 || editAreaSubscription.unsubscribe();
|
|
11934
|
+
editAreaSubscription = null;
|
|
11754
11935
|
if (unitId == null) return subscriber.next(true);
|
|
11755
11936
|
if (univerInstanceService.getUnitType(unitId) !== _univerjs_core.UniverInstanceType.UNIVER_DOC) return subscriber.next(true);
|
|
11756
|
-
const currentRender = renderManagerService.
|
|
11937
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
11757
11938
|
if (currentRender == null) return subscriber.next(true);
|
|
11758
|
-
currentRender.with(_univerjs_docs.DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe((editArea) => {
|
|
11939
|
+
editAreaSubscription = currentRender.with(_univerjs_docs.DocSkeletonManagerService).getViewModel().editAreaChange$.subscribe((editArea) => {
|
|
11759
11940
|
subscriber.next(editArea === _univerjs_engine_render.DocumentEditArea.HEADER || editArea === _univerjs_engine_render.DocumentEditArea.FOOTER);
|
|
11760
11941
|
});
|
|
11761
11942
|
});
|
|
11762
|
-
return () =>
|
|
11943
|
+
return () => {
|
|
11944
|
+
editAreaSubscription === null || editAreaSubscription === void 0 || editAreaSubscription.unsubscribe();
|
|
11945
|
+
subscription.unsubscribe();
|
|
11946
|
+
};
|
|
11763
11947
|
});
|
|
11764
11948
|
}
|
|
11765
11949
|
function disableMenuWhenHeaderFooterEditing(accessor) {
|
|
@@ -11781,7 +11965,7 @@ function disableMenuWhenHeaderFooterEditing(accessor) {
|
|
|
11781
11965
|
emit(true);
|
|
11782
11966
|
return;
|
|
11783
11967
|
}
|
|
11784
|
-
const currentRender = renderManagerService.
|
|
11968
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
11785
11969
|
const skeletonManager = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService);
|
|
11786
11970
|
const viewModel = skeletonManager === null || skeletonManager === void 0 ? void 0 : skeletonManager.getViewModel();
|
|
11787
11971
|
if (!viewModel) {
|
|
@@ -11802,7 +11986,7 @@ function disableMenuWhenHeaderFooterEditing(accessor) {
|
|
|
11802
11986
|
};
|
|
11803
11987
|
});
|
|
11804
11988
|
}
|
|
11805
|
-
function
|
|
11989
|
+
function getTraditionalDocMenuHiddenObservable(accessor) {
|
|
11806
11990
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
11807
11991
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
11808
11992
|
return new rxjs.Observable((subscriber) => {
|
|
@@ -11825,9 +12009,8 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
|
|
|
11825
12009
|
subscriber.next(documentFlavor !== _univerjs_core.DocumentFlavor.TRADITIONAL);
|
|
11826
12010
|
});
|
|
11827
12011
|
const docDataModel = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
11828
|
-
if (docDataModel == null) return subscriber.next(true);
|
|
11829
12012
|
const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
11830
|
-
subscriber.next(documentFlavor !== _univerjs_core.DocumentFlavor.TRADITIONAL);
|
|
12013
|
+
subscriber.next(docDataModel == null || documentFlavor !== _univerjs_core.DocumentFlavor.TRADITIONAL);
|
|
11831
12014
|
return () => {
|
|
11832
12015
|
subscription0.dispose();
|
|
11833
12016
|
subscription.unsubscribe();
|
|
@@ -11904,6 +12087,42 @@ function disableMenuWhenNoDocRange(accessor) {
|
|
|
11904
12087
|
return () => subscription.unsubscribe();
|
|
11905
12088
|
});
|
|
11906
12089
|
}
|
|
12090
|
+
const DOC_INSERT_EMOJI_MENU_ID = "doc.menu.insert-emoji";
|
|
12091
|
+
const DOC_INSERT_SYMBOL_MENU_ID = "doc.menu.insert-symbol";
|
|
12092
|
+
function EmojiPickerMenuItemFactory(accessor) {
|
|
12093
|
+
return {
|
|
12094
|
+
id: DOC_INSERT_EMOJI_MENU_ID,
|
|
12095
|
+
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
12096
|
+
icon: "SmileIcon",
|
|
12097
|
+
tooltip: "ui.emojiPicker.emojis",
|
|
12098
|
+
selectionsCommandId: InsertSpecialCharacterCommand.id,
|
|
12099
|
+
selections: [{ label: {
|
|
12100
|
+
name: _univerjs_ui.EMOJI_PICKER_COMPONENT,
|
|
12101
|
+
hoverable: false,
|
|
12102
|
+
selectable: false,
|
|
12103
|
+
props: { embedded: true }
|
|
12104
|
+
} }],
|
|
12105
|
+
disabled$: disableMenuWhenNoDocRange(accessor),
|
|
12106
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC)
|
|
12107
|
+
};
|
|
12108
|
+
}
|
|
12109
|
+
function SymbolPickerMenuItemFactory(accessor) {
|
|
12110
|
+
return {
|
|
12111
|
+
id: DOC_INSERT_SYMBOL_MENU_ID,
|
|
12112
|
+
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
12113
|
+
icon: "SymbolsIcon",
|
|
12114
|
+
tooltip: "ui.emojiPicker.symbols",
|
|
12115
|
+
selectionsCommandId: InsertSpecialCharacterCommand.id,
|
|
12116
|
+
selections: [{ label: {
|
|
12117
|
+
name: _univerjs_ui.SYMBOL_PICKER_COMPONENT,
|
|
12118
|
+
hoverable: false,
|
|
12119
|
+
selectable: false,
|
|
12120
|
+
props: { embedded: true }
|
|
12121
|
+
} }],
|
|
12122
|
+
disabled$: disableMenuWhenNoDocRange(accessor),
|
|
12123
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC)
|
|
12124
|
+
};
|
|
12125
|
+
}
|
|
11907
12126
|
function isTextRangeInAnyBlockRange(document, range) {
|
|
11908
12127
|
var _document$getBody$blo2, _document$getBody2;
|
|
11909
12128
|
const blockRanges = (_document$getBody$blo2 = document === null || document === void 0 || (_document$getBody2 = document.getBody()) === null || _document$getBody2 === void 0 ? void 0 : _document$getBody2.blockRanges) !== null && _document$getBody$blo2 !== void 0 ? _document$getBody$blo2 : [];
|
|
@@ -12375,11 +12594,60 @@ function HeaderFooterMenuItemFactory(accessor) {
|
|
|
12375
12594
|
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
12376
12595
|
icon: "HeaderFooterIcon",
|
|
12377
12596
|
tooltip: "docs-ui.toolbar.headerFooter",
|
|
12378
|
-
hidden$: (0, rxjs.combineLatest)((0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC),
|
|
12597
|
+
hidden$: (0, rxjs.combineLatest)((0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC), getTraditionalDocMenuHiddenObservable(accessor), (one, two) => {
|
|
12379
12598
|
return one || two;
|
|
12380
12599
|
})
|
|
12381
12600
|
};
|
|
12382
12601
|
}
|
|
12602
|
+
const DOC_BREAKS_MENU_ID = "doc.menu.breaks";
|
|
12603
|
+
const DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID = "doc.menu.section-break.next-page";
|
|
12604
|
+
const DOC_SECTION_BREAK_CONTINUOUS_MENU_ID = "doc.menu.section-break.continuous";
|
|
12605
|
+
const DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID = "doc.menu.section-break.next-column";
|
|
12606
|
+
const DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID = "doc.menu.section-break.even-page";
|
|
12607
|
+
const DOC_SECTION_BREAK_ODD_PAGE_MENU_ID = "doc.menu.section-break.odd-page";
|
|
12608
|
+
function BreaksMenuFactory(accessor) {
|
|
12609
|
+
return {
|
|
12610
|
+
id: DOC_BREAKS_MENU_ID,
|
|
12611
|
+
type: _univerjs_ui.MenuItemType.SUBITEMS,
|
|
12612
|
+
icon: "ColumnIcon",
|
|
12613
|
+
tooltip: "docs-ui.toolbar.breaks",
|
|
12614
|
+
disabled$: disableMenuWhenNoDocRange(accessor),
|
|
12615
|
+
hidden$: (0, rxjs.combineLatest)((0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC), getTraditionalDocMenuHiddenObservable(accessor), (hidden, unsupported) => hidden || unsupported)
|
|
12616
|
+
};
|
|
12617
|
+
}
|
|
12618
|
+
function InsertColumnBreakMenuFactory(accessor) {
|
|
12619
|
+
return {
|
|
12620
|
+
id: InsertDocumentColumnBreakOperation.id,
|
|
12621
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
12622
|
+
title: "docs-ui.toolbar.columnBreak",
|
|
12623
|
+
disabled$: disableMenuWhenNoDocRange(accessor)
|
|
12624
|
+
};
|
|
12625
|
+
}
|
|
12626
|
+
function createSectionBreakMenuItem(accessor, id, title, sectionType) {
|
|
12627
|
+
return {
|
|
12628
|
+
id,
|
|
12629
|
+
commandId: InsertDocumentSectionBreakOperation.id,
|
|
12630
|
+
params: { sectionType },
|
|
12631
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
12632
|
+
title,
|
|
12633
|
+
disabled$: disableMenuWhenNoDocRange(accessor)
|
|
12634
|
+
};
|
|
12635
|
+
}
|
|
12636
|
+
function InsertNextPageSectionBreakMenuFactory(accessor) {
|
|
12637
|
+
return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID, "docs-ui.toolbar.sectionBreakNextPage", _univerjs_core.SectionType.NEXT_PAGE);
|
|
12638
|
+
}
|
|
12639
|
+
function InsertContinuousSectionBreakMenuFactory(accessor) {
|
|
12640
|
+
return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_CONTINUOUS_MENU_ID, "docs-ui.toolbar.sectionBreakContinuous", _univerjs_core.SectionType.CONTINUOUS);
|
|
12641
|
+
}
|
|
12642
|
+
function InsertNextColumnSectionBreakMenuFactory(accessor) {
|
|
12643
|
+
return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID, "docs-ui.toolbar.sectionBreakNextColumn", _univerjs_core.SectionType.NEXT_COLUMN);
|
|
12644
|
+
}
|
|
12645
|
+
function InsertEvenPageSectionBreakMenuFactory(accessor) {
|
|
12646
|
+
return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID, "docs-ui.toolbar.sectionBreakEvenPage", _univerjs_core.SectionType.EVEN_PAGE);
|
|
12647
|
+
}
|
|
12648
|
+
function InsertOddPageSectionBreakMenuFactory(accessor) {
|
|
12649
|
+
return createSectionBreakMenuItem(accessor, DOC_SECTION_BREAK_ODD_PAGE_MENU_ID, "docs-ui.toolbar.sectionBreakOddPage", _univerjs_core.SectionType.ODD_PAGE);
|
|
12650
|
+
}
|
|
12383
12651
|
const TableIcon = "GridIcon";
|
|
12384
12652
|
const TABLE_MENU_ID = "doc.menu.table";
|
|
12385
12653
|
function TableMenuFactory(accessor) {
|
|
@@ -12564,7 +12832,10 @@ function AlignMenuItemFactory(accessor) {
|
|
|
12564
12832
|
});
|
|
12565
12833
|
calc();
|
|
12566
12834
|
return disposable.dispose;
|
|
12567
|
-
})
|
|
12835
|
+
}).pipe((0, rxjs.distinctUntilChanged)(), (0, rxjs.shareReplay)({
|
|
12836
|
+
bufferSize: 1,
|
|
12837
|
+
refCount: true
|
|
12838
|
+
}));
|
|
12568
12839
|
return {
|
|
12569
12840
|
id: AlignOperationCommand.id,
|
|
12570
12841
|
type: _univerjs_ui.MenuItemType.SELECTOR,
|
|
@@ -13410,42 +13681,87 @@ const menuSchema = {
|
|
|
13410
13681
|
[_univerjs_ui.RibbonStartGroup.FORMAT]: {
|
|
13411
13682
|
[SetInlineFormatBoldCommand.id]: {
|
|
13412
13683
|
order: 0,
|
|
13684
|
+
gridLayout: {
|
|
13685
|
+
row: 2,
|
|
13686
|
+
column: 1
|
|
13687
|
+
},
|
|
13413
13688
|
menuItemFactory: BoldMenuItemFactory
|
|
13414
13689
|
},
|
|
13415
13690
|
[SetInlineFormatItalicCommand.id]: {
|
|
13416
13691
|
order: 1,
|
|
13692
|
+
gridLayout: {
|
|
13693
|
+
row: 2,
|
|
13694
|
+
column: 2
|
|
13695
|
+
},
|
|
13417
13696
|
menuItemFactory: ItalicMenuItemFactory
|
|
13418
13697
|
},
|
|
13419
13698
|
[SetInlineFormatUnderlineCommand.id]: {
|
|
13420
13699
|
order: 2,
|
|
13700
|
+
gridLayout: {
|
|
13701
|
+
row: 2,
|
|
13702
|
+
column: 3
|
|
13703
|
+
},
|
|
13421
13704
|
menuItemFactory: UnderlineMenuItemFactory
|
|
13422
13705
|
},
|
|
13423
13706
|
[SetInlineFormatStrikethroughCommand.id]: {
|
|
13424
13707
|
order: 3,
|
|
13708
|
+
gridLayout: {
|
|
13709
|
+
row: 2,
|
|
13710
|
+
column: 4
|
|
13711
|
+
},
|
|
13425
13712
|
menuItemFactory: StrikeThroughMenuItemFactory
|
|
13426
13713
|
},
|
|
13427
13714
|
[SetInlineFormatSubscriptCommand.id]: {
|
|
13428
13715
|
order: 4,
|
|
13716
|
+
gridLayout: {
|
|
13717
|
+
row: 2,
|
|
13718
|
+
column: 5
|
|
13719
|
+
},
|
|
13429
13720
|
menuItemFactory: SubscriptMenuItemFactory
|
|
13430
13721
|
},
|
|
13431
13722
|
[SetInlineFormatSuperscriptCommand.id]: {
|
|
13432
13723
|
order: 5,
|
|
13724
|
+
gridLayout: {
|
|
13725
|
+
row: 2,
|
|
13726
|
+
column: 6
|
|
13727
|
+
},
|
|
13433
13728
|
menuItemFactory: SuperscriptMenuItemFactory
|
|
13434
13729
|
},
|
|
13435
13730
|
[SetParagraphNamedStyleCommand.id]: {
|
|
13436
13731
|
order: 5.5,
|
|
13732
|
+
gridLayout: {
|
|
13733
|
+
row: 1,
|
|
13734
|
+
column: 1,
|
|
13735
|
+
columnSpan: 2,
|
|
13736
|
+
width: 100
|
|
13737
|
+
},
|
|
13437
13738
|
menuItemFactory: HeadingSelectorMenuItemFactory
|
|
13438
13739
|
},
|
|
13439
13740
|
[SetInlineFormatFontSizeCommand.id]: {
|
|
13440
13741
|
order: 6,
|
|
13742
|
+
gridLayout: {
|
|
13743
|
+
row: 1,
|
|
13744
|
+
column: 7,
|
|
13745
|
+
width: 64
|
|
13746
|
+
},
|
|
13441
13747
|
menuItemFactory: FontSizeSelectorMenuItemFactory
|
|
13442
13748
|
},
|
|
13443
13749
|
[SetInlineFormatFontFamilyCommand.id]: {
|
|
13444
13750
|
order: 7,
|
|
13751
|
+
gridLayout: {
|
|
13752
|
+
row: 1,
|
|
13753
|
+
column: 3,
|
|
13754
|
+
columnSpan: 4,
|
|
13755
|
+
width: 160
|
|
13756
|
+
},
|
|
13445
13757
|
menuItemFactory: FontFamilySelectorMenuItemFactory
|
|
13446
13758
|
},
|
|
13447
13759
|
[SetInlineFormatTextColorCommand.id]: {
|
|
13448
13760
|
order: 8,
|
|
13761
|
+
gridLayout: {
|
|
13762
|
+
row: 2,
|
|
13763
|
+
column: 7
|
|
13764
|
+
},
|
|
13449
13765
|
menuItemFactory: TextColorSelectorMenuItemFactory,
|
|
13450
13766
|
[ResetInlineFormatTextColorCommand.id]: {
|
|
13451
13767
|
order: 0,
|
|
@@ -13454,6 +13770,10 @@ const menuSchema = {
|
|
|
13454
13770
|
},
|
|
13455
13771
|
[SetInlineFormatTextBackgroundColorCommand.id]: {
|
|
13456
13772
|
order: 9,
|
|
13773
|
+
gridLayout: {
|
|
13774
|
+
row: 2,
|
|
13775
|
+
column: 8
|
|
13776
|
+
},
|
|
13457
13777
|
menuItemFactory: BackgroundColorSelectorMenuItemFactory,
|
|
13458
13778
|
[ResetInlineFormatTextBackgroundColorCommand.id]: {
|
|
13459
13779
|
order: 0,
|
|
@@ -13464,32 +13784,66 @@ const menuSchema = {
|
|
|
13464
13784
|
[_univerjs_ui.RibbonStartGroup.LAYOUT]: {
|
|
13465
13785
|
[AlignOperationCommand.id]: {
|
|
13466
13786
|
order: 2,
|
|
13787
|
+
gridLayout: {
|
|
13788
|
+
row: 1,
|
|
13789
|
+
column: 1
|
|
13790
|
+
},
|
|
13467
13791
|
menuItemFactory: AlignMenuItemFactory
|
|
13468
13792
|
},
|
|
13469
13793
|
[OrderListCommand.id]: {
|
|
13470
13794
|
order: 7,
|
|
13795
|
+
gridLayout: {
|
|
13796
|
+
row: 2,
|
|
13797
|
+
column: 1
|
|
13798
|
+
},
|
|
13471
13799
|
menuItemFactory: OrderListMenuItemFactory
|
|
13472
13800
|
},
|
|
13473
13801
|
[BulletListCommand.id]: {
|
|
13474
13802
|
order: 8,
|
|
13803
|
+
gridLayout: {
|
|
13804
|
+
row: 1,
|
|
13805
|
+
column: 2
|
|
13806
|
+
},
|
|
13475
13807
|
menuItemFactory: BulletListMenuItemFactory
|
|
13476
13808
|
},
|
|
13477
13809
|
[CheckListCommand.id]: {
|
|
13478
13810
|
order: 9,
|
|
13811
|
+
gridLayout: {
|
|
13812
|
+
row: 2,
|
|
13813
|
+
column: 2
|
|
13814
|
+
},
|
|
13479
13815
|
menuItemFactory: CheckListMenuItemFactory
|
|
13480
13816
|
},
|
|
13481
13817
|
[OpenHeaderFooterPanelCommand.id]: {
|
|
13482
13818
|
order: 10,
|
|
13819
|
+
gridLayout: {
|
|
13820
|
+
row: 1,
|
|
13821
|
+
column: 3,
|
|
13822
|
+
rowSpan: 2,
|
|
13823
|
+
showLabel: true
|
|
13824
|
+
},
|
|
13483
13825
|
menuItemFactory: HeaderFooterMenuItemFactory
|
|
13484
13826
|
},
|
|
13485
13827
|
[DocOpenPageSettingCommand.id]: {
|
|
13486
13828
|
order: 12,
|
|
13829
|
+
gridLayout: {
|
|
13830
|
+
row: 1,
|
|
13831
|
+
column: 4,
|
|
13832
|
+
rowSpan: 2,
|
|
13833
|
+
showLabel: true
|
|
13834
|
+
},
|
|
13487
13835
|
menuItemFactory: PageSettingMenuItemFactory
|
|
13488
13836
|
}
|
|
13489
13837
|
},
|
|
13490
13838
|
[_univerjs_ui.RibbonInsertGroup.MEDIA]: {
|
|
13491
13839
|
[TABLE_MENU_ID]: {
|
|
13492
13840
|
order: 2,
|
|
13841
|
+
gridLayout: {
|
|
13842
|
+
row: 1,
|
|
13843
|
+
column: 1,
|
|
13844
|
+
rowSpan: 2,
|
|
13845
|
+
showLabel: true
|
|
13846
|
+
},
|
|
13493
13847
|
menuItemFactory: TableMenuFactory,
|
|
13494
13848
|
[DocCreateTableOperation.id]: {
|
|
13495
13849
|
order: 0,
|
|
@@ -13498,7 +13852,63 @@ const menuSchema = {
|
|
|
13498
13852
|
},
|
|
13499
13853
|
[HorizontalLineCommand.id]: {
|
|
13500
13854
|
order: 3,
|
|
13855
|
+
gridLayout: {
|
|
13856
|
+
row: 1,
|
|
13857
|
+
column: 2,
|
|
13858
|
+
rowSpan: 2,
|
|
13859
|
+
showLabel: true
|
|
13860
|
+
},
|
|
13501
13861
|
menuItemFactory: HorizontalLineFactory
|
|
13862
|
+
},
|
|
13863
|
+
[DOC_BREAKS_MENU_ID]: {
|
|
13864
|
+
order: 4,
|
|
13865
|
+
gridLayout: {
|
|
13866
|
+
row: 1,
|
|
13867
|
+
column: 3,
|
|
13868
|
+
rowSpan: 2,
|
|
13869
|
+
showLabel: true
|
|
13870
|
+
},
|
|
13871
|
+
menuItemFactory: BreaksMenuFactory,
|
|
13872
|
+
[InsertDocumentColumnBreakOperation.id]: {
|
|
13873
|
+
order: 0,
|
|
13874
|
+
menuItemFactory: InsertColumnBreakMenuFactory
|
|
13875
|
+
},
|
|
13876
|
+
[DOC_SECTION_BREAK_NEXT_PAGE_MENU_ID]: {
|
|
13877
|
+
order: 1,
|
|
13878
|
+
menuItemFactory: InsertNextPageSectionBreakMenuFactory
|
|
13879
|
+
},
|
|
13880
|
+
[DOC_SECTION_BREAK_CONTINUOUS_MENU_ID]: {
|
|
13881
|
+
order: 2,
|
|
13882
|
+
menuItemFactory: InsertContinuousSectionBreakMenuFactory
|
|
13883
|
+
},
|
|
13884
|
+
[DOC_SECTION_BREAK_NEXT_COLUMN_MENU_ID]: {
|
|
13885
|
+
order: 3,
|
|
13886
|
+
menuItemFactory: InsertNextColumnSectionBreakMenuFactory
|
|
13887
|
+
},
|
|
13888
|
+
[DOC_SECTION_BREAK_EVEN_PAGE_MENU_ID]: {
|
|
13889
|
+
order: 4,
|
|
13890
|
+
menuItemFactory: InsertEvenPageSectionBreakMenuFactory
|
|
13891
|
+
},
|
|
13892
|
+
[DOC_SECTION_BREAK_ODD_PAGE_MENU_ID]: {
|
|
13893
|
+
order: 5,
|
|
13894
|
+
menuItemFactory: InsertOddPageSectionBreakMenuFactory
|
|
13895
|
+
}
|
|
13896
|
+
},
|
|
13897
|
+
[DOC_INSERT_EMOJI_MENU_ID]: {
|
|
13898
|
+
order: 5,
|
|
13899
|
+
gridLayout: {
|
|
13900
|
+
row: 1,
|
|
13901
|
+
column: 4
|
|
13902
|
+
},
|
|
13903
|
+
menuItemFactory: EmojiPickerMenuItemFactory
|
|
13904
|
+
},
|
|
13905
|
+
[DOC_INSERT_SYMBOL_MENU_ID]: {
|
|
13906
|
+
order: 6,
|
|
13907
|
+
gridLayout: {
|
|
13908
|
+
row: 2,
|
|
13909
|
+
column: 4
|
|
13910
|
+
},
|
|
13911
|
+
menuItemFactory: SymbolPickerMenuItemFactory
|
|
13502
13912
|
}
|
|
13503
13913
|
},
|
|
13504
13914
|
[_univerjs_ui.ContextMenuPosition.MAIN_AREA]: {
|
|
@@ -13856,6 +14266,13 @@ const menuSchema = {
|
|
|
13856
14266
|
order: 0,
|
|
13857
14267
|
menuItemFactory: InsertDefaultTableMenuFactory
|
|
13858
14268
|
}
|
|
14269
|
+
},
|
|
14270
|
+
format: {
|
|
14271
|
+
order: 3,
|
|
14272
|
+
[DocPasteCommand.id]: {
|
|
14273
|
+
order: 0,
|
|
14274
|
+
menuItemFactory: PasteMenuFactory
|
|
14275
|
+
}
|
|
13859
14276
|
}
|
|
13860
14277
|
},
|
|
13861
14278
|
[DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID]: {
|
|
@@ -13985,8 +14402,12 @@ const menuSchema = {
|
|
|
13985
14402
|
order: 1,
|
|
13986
14403
|
menuItemFactory: CopyCurrentParagraphMenuItemFactory
|
|
13987
14404
|
},
|
|
13988
|
-
[
|
|
14405
|
+
[DocPasteCommand.id]: {
|
|
13989
14406
|
order: 2,
|
|
14407
|
+
menuItemFactory: PasteMenuFactory
|
|
14408
|
+
},
|
|
14409
|
+
[DeleteCurrentParagraphCommand.id]: {
|
|
14410
|
+
order: 3,
|
|
13990
14411
|
menuItemFactory: DeleteCurrentParagraphMenuItemFactory
|
|
13991
14412
|
}
|
|
13992
14413
|
},
|
|
@@ -14455,7 +14876,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends _unive
|
|
|
14455
14876
|
};
|
|
14456
14877
|
}
|
|
14457
14878
|
attachPopupToRect(rect, popup, unitId) {
|
|
14458
|
-
const currentRender = this._renderManagerService.
|
|
14879
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
14459
14880
|
if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
|
|
14460
14881
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
14461
14882
|
const { position, position$, disposable } = this._createRectPositionObserver(rect, currentRender);
|
|
@@ -14484,7 +14905,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends _unive
|
|
|
14484
14905
|
* @returns disposable
|
|
14485
14906
|
*/
|
|
14486
14907
|
attachPopupToObject(targetObject, popup, unitId) {
|
|
14487
|
-
const currentRender = this._renderManagerService.
|
|
14908
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
14488
14909
|
if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
|
|
14489
14910
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
14490
14911
|
const { position, position$, disposable } = this._createObjectPositionObserver(targetObject, currentRender);
|
|
@@ -14516,7 +14937,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends _unive
|
|
|
14516
14937
|
attachPopupToRange(range, popup, unitId) {
|
|
14517
14938
|
if (!this._univerInstanceService.getUnit(unitId)) throw new Error(`Document not found, unitId: ${unitId}`);
|
|
14518
14939
|
const { direction = "top", multipleDirection } = popup;
|
|
14519
|
-
const currentRender = this._renderManagerService.
|
|
14940
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
14520
14941
|
if (!currentRender) throw new Error(`Current render not found, unitId: ${unitId}`);
|
|
14521
14942
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
14522
14943
|
const { positions: bounds, positions$: bounds$, disposable } = this._createRangePositionObserver(range, currentRender);
|
|
@@ -14919,12 +15340,13 @@ let DocEventManagerService = class DocEventManagerService extends _univerjs_core
|
|
|
14919
15340
|
const customRanges = (_this$_context$unit$g = (_this$_context$unit$g2 = this._context.unit.getSelfOrHeaderFooterModel(segmentId)) === null || _this$_context$unit$g2 === void 0 || (_this$_context$unit$g2 = _this$_context$unit$g2.getBody()) === null || _this$_context$unit$g2 === void 0 ? void 0 : _this$_context$unit$g2.customRanges) !== null && _this$_context$unit$g !== void 0 ? _this$_context$unit$g : [];
|
|
14920
15341
|
const layouts = [];
|
|
14921
15342
|
customRanges.forEach((range) => {
|
|
14922
|
-
const
|
|
15343
|
+
const textRange = {
|
|
14923
15344
|
startOffset: range.startIndex,
|
|
14924
15345
|
endOffset: range.endIndex + 1,
|
|
14925
15346
|
collapsed: false,
|
|
14926
15347
|
segmentId
|
|
14927
|
-
}
|
|
15348
|
+
};
|
|
15349
|
+
const rects = calcDocRangePositions$1(textRange, this._documents, this._skeleton, segmentPage);
|
|
14928
15350
|
if (!rects) return null;
|
|
14929
15351
|
layouts.push({
|
|
14930
15352
|
customRange: range,
|
|
@@ -15385,7 +15807,7 @@ function DocSideMenuContent() {
|
|
|
15385
15807
|
const fullDataStream = (_documentData$body$da = documentData === null || documentData === void 0 || (_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream) !== null && _documentData$body$da !== void 0 ? _documentData$body$da : "";
|
|
15386
15808
|
const [activeId, setActiveId] = (0, react.useState)(void 0);
|
|
15387
15809
|
const unitId = (_currentDoc$getUnitId = currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) !== null && _currentDoc$getUnitId !== void 0 ? _currentDoc$getUnitId : "";
|
|
15388
|
-
const renderer = renderManagerService.
|
|
15810
|
+
const renderer = renderManagerService.getRenderUnitById(unitId);
|
|
15389
15811
|
const title = documentData === null || documentData === void 0 ? void 0 : documentData.title;
|
|
15390
15812
|
const docEventManagerService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocEventManagerService);
|
|
15391
15813
|
const paragraphBounds = docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.paragraphBounds;
|
|
@@ -15427,7 +15849,8 @@ function DocSideMenuContent() {
|
|
|
15427
15849
|
}).filter((item) => item === null || item === void 0 ? void 0 : item.text);
|
|
15428
15850
|
const handleScroll = (0, _univerjs_ui.useEvent)((params) => {
|
|
15429
15851
|
const scrollTop = params.viewportScrollY;
|
|
15430
|
-
const
|
|
15852
|
+
const bottom = scrollTop + canvasHeight / scaleY;
|
|
15853
|
+
const activeId = findActiveHeading(paragraphBounds, paragraphMap, scrollTop, bottom);
|
|
15431
15854
|
if (activeId) setActiveId(activeId);
|
|
15432
15855
|
});
|
|
15433
15856
|
const menus = (paragraphMenus === null || paragraphMenus === void 0 ? void 0 : paragraphMenus.find((p) => p.isTitle)) ? paragraphMenus : [...title ? [{
|
|
@@ -15554,7 +15977,7 @@ let DocUIController = class DocUIController extends _univerjs_core.Disposable {
|
|
|
15554
15977
|
_initFocusHandler() {
|
|
15555
15978
|
this.disposeWithMe(this._layoutService.registerFocusHandler(_univerjs_core.UniverInstanceType.UNIVER_DOC, (unitId) => {
|
|
15556
15979
|
if (this._shouldPreserveEmbedFocus(unitId)) return;
|
|
15557
|
-
this._injector.get(_univerjs_engine_render.IRenderManagerService).
|
|
15980
|
+
this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId).with(DocSelectionRenderService).focus();
|
|
15558
15981
|
}));
|
|
15559
15982
|
}
|
|
15560
15983
|
_shouldPreserveEmbedFocus(unitId) {
|
|
@@ -15810,7 +16233,8 @@ function resolveDocsCustomBlockRenderViewport(params) {
|
|
|
15810
16233
|
width: layoutWidth
|
|
15811
16234
|
};
|
|
15812
16235
|
}
|
|
15813
|
-
const
|
|
16236
|
+
const scale = params.scale && params.scale > 0 ? params.scale : 1;
|
|
16237
|
+
const inset = MODERN_DOCS_CUSTOM_BLOCK_VIEWPORT_INSET / scale;
|
|
15814
16238
|
const docsLeft = (_params$docsLeft = params.docsLeft) !== null && _params$docsLeft !== void 0 ? _params$docsLeft : 0;
|
|
15815
16239
|
const fallbackViewportLeft = docsLeft + inset;
|
|
15816
16240
|
const fallbackViewportWidth = Math.max(0, pageWidth - inset * 2);
|
|
@@ -15836,7 +16260,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
|
|
|
15836
16260
|
//#endregion
|
|
15837
16261
|
//#region package.json
|
|
15838
16262
|
var name = "@univerjs/docs-ui";
|
|
15839
|
-
var version = "1.0.0-alpha.
|
|
16263
|
+
var version = "1.0.0-alpha.8";
|
|
15840
16264
|
|
|
15841
16265
|
//#endregion
|
|
15842
16266
|
//#region src/commands/commands/doc-paragraph-setting.command.ts
|
|
@@ -15914,19 +16338,27 @@ const DEFAULT_AVALIABLE_MENUS = [
|
|
|
15914
16338
|
SetInlineFormatSubscriptCommand.id,
|
|
15915
16339
|
SetInlineFormatSuperscriptCommand.id,
|
|
15916
16340
|
SetInlineFormatTextColorCommand.id,
|
|
15917
|
-
|
|
16341
|
+
{
|
|
16342
|
+
id: SetInlineFormatTextBackgroundColorCommand.id,
|
|
16343
|
+
iconColor: "var(--univer-primary-600)"
|
|
16344
|
+
}
|
|
15918
16345
|
];
|
|
15919
16346
|
function resolveFloatToolbarMenus(menuManagerService, avaliableMenus) {
|
|
15920
16347
|
const floatToolbarMenus = menuManagerService.getMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION);
|
|
15921
16348
|
const flatMenus = [...menuManagerService.getFlatMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION), ...menuManagerService.getFlatMenuByPositionKey(_univerjs_ui.MenuManagerPosition.RIBBON)];
|
|
15922
16349
|
const menus = [];
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
16350
|
+
const menuIds = avaliableMenus.map((config) => typeof config === "string" ? config : config.id);
|
|
16351
|
+
for (const config of avaliableMenus) {
|
|
16352
|
+
const menuId = typeof config === "string" ? config : config.id;
|
|
16353
|
+
const item = flatMenus.find((item) => item.key === menuId);
|
|
16354
|
+
if (item) menus.push(typeof config === "string" ? item : {
|
|
16355
|
+
...item,
|
|
16356
|
+
iconColor: config.iconColor
|
|
16357
|
+
});
|
|
15926
16358
|
}
|
|
15927
16359
|
return {
|
|
15928
16360
|
menus,
|
|
15929
|
-
extraMenus: floatToolbarMenus.filter((item) => item.item && !
|
|
16361
|
+
extraMenus: floatToolbarMenus.filter((item) => item.item && !menuIds.includes(item.key))
|
|
15930
16362
|
};
|
|
15931
16363
|
}
|
|
15932
16364
|
function FloatToolbar(props) {
|
|
@@ -15951,7 +16383,10 @@ function FloatToolbar(props) {
|
|
|
15951
16383
|
children: [
|
|
15952
16384
|
menus.map((groupItem) => groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15953
16385
|
className: "univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",
|
|
15954
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, {
|
|
16386
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, {
|
|
16387
|
+
...groupItem.item,
|
|
16388
|
+
iconColor: groupItem.iconColor
|
|
16389
|
+
}, groupItem.key)
|
|
15955
16390
|
}, groupItem.key)),
|
|
15956
16391
|
extraMenus.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "univer-my-1 univer-w-px univer-bg-gray-200 dark:univer-bg-gray-700" }),
|
|
15957
16392
|
extraMenus.map((groupItem) => groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -15997,7 +16432,7 @@ function getSegmentId(documentStyle, editArea, pageIndex, page) {
|
|
|
15997
16432
|
}
|
|
15998
16433
|
const DocHeaderFooterOptions = (props) => {
|
|
15999
16434
|
var _segmentContext$segme, _segmentContext$segme2;
|
|
16000
|
-
const docSelectionRenderService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).
|
|
16435
|
+
const docSelectionRenderService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(props.unitId).with(DocSelectionRenderService);
|
|
16001
16436
|
const segmentContext = (0, _univerjs_ui.useObservable)(docSelectionRenderService.segmentContext$, {
|
|
16002
16437
|
segmentId: docSelectionRenderService.getSegment(),
|
|
16003
16438
|
segmentPage: docSelectionRenderService.getSegmentPage()
|
|
@@ -16012,12 +16447,12 @@ function DocHeaderFooterOptionsContent(props) {
|
|
|
16012
16447
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
16013
16448
|
const layoutService = (0, _univerjs_ui.useDependency)(_univerjs_ui.ILayoutService);
|
|
16014
16449
|
const { unitId } = props;
|
|
16015
|
-
const docSelectionRenderService = renderManagerService.
|
|
16450
|
+
const docSelectionRenderService = renderManagerService.getRenderUnitById(unitId).with(DocSelectionRenderService);
|
|
16016
16451
|
const docDataModel = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
16017
16452
|
const getCurrentSectionContext = () => {
|
|
16018
16453
|
var _renderManagerService, _docSkeletonManagerSe;
|
|
16019
16454
|
const snapshot = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot();
|
|
16020
|
-
const docSkeletonManagerService = (_renderManagerService = renderManagerService.
|
|
16455
|
+
const docSkeletonManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs.DocSkeletonManagerService);
|
|
16021
16456
|
const page = docSkeletonManagerService === null || docSkeletonManagerService === void 0 || (_docSkeletonManagerSe = docSkeletonManagerService.getSkeleton) === null || _docSkeletonManagerSe === void 0 || (_docSkeletonManagerSe = _docSkeletonManagerSe.call(docSkeletonManagerService)) === null || _docSkeletonManagerSe === void 0 || (_docSkeletonManagerSe = _docSkeletonManagerSe.getSkeletonData()) === null || _docSkeletonManagerSe === void 0 ? void 0 : _docSkeletonManagerSe.pages[docSelectionRenderService.getSegmentPage()];
|
|
16022
16457
|
return snapshot == null ? void 0 : {
|
|
16023
16458
|
...getDocPageSectionContext(snapshot, page),
|
|
@@ -16035,7 +16470,7 @@ function DocHeaderFooterOptionsContent(props) {
|
|
|
16035
16470
|
};
|
|
16036
16471
|
});
|
|
16037
16472
|
const sectionContext = getCurrentSectionContext();
|
|
16038
|
-
const referenceKey = (0, _univerjs_core.getSectionHeaderFooterReferenceKey)(((_renderManagerService2 = renderManagerService.
|
|
16473
|
+
const referenceKey = (0, _univerjs_core.getSectionHeaderFooterReferenceKey)(((_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 || (_renderManagerService2 = _renderManagerService2.with(_univerjs_docs.DocSkeletonManagerService)) === null || _renderManagerService2 === void 0 || (_renderManagerService2 = _renderManagerService2.getViewModel()) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.getEditArea()) === _univerjs_engine_render.DocumentEditArea.FOOTER ? "footer" : "header", getHeaderFooterVariant((_sectionContext$confi = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config) !== null && _sectionContext$confi !== void 0 ? _sectionContext$confi : {}, docSelectionRenderService.getSegmentPage(), sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.page));
|
|
16039
16474
|
const canLinkToPrevious = ((_sectionContext$secti = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.sectionIndex) !== null && _sectionContext$secti !== void 0 ? _sectionContext$secti : -1) > 0;
|
|
16040
16475
|
const [linkedToPrevious, setLinkedToPrevious] = (0, react.useState)(canLinkToPrevious && !(sectionContext === null || sectionContext === void 0 || (_sectionContext$secti2 = sectionContext.section) === null || _sectionContext$secti2 === void 0 ? void 0 : _sectionContext$secti2[referenceKey]));
|
|
16041
16476
|
const handleCheckboxChange = (val, type) => {
|
|
@@ -16046,7 +16481,7 @@ function DocHeaderFooterOptionsContent(props) {
|
|
|
16046
16481
|
}));
|
|
16047
16482
|
const sectionContext = getCurrentSectionContext();
|
|
16048
16483
|
const documentStyle = sectionContext === null || sectionContext === void 0 ? void 0 : sectionContext.config;
|
|
16049
|
-
const docSkeletonManagerService = (_renderManagerService3 = renderManagerService.
|
|
16484
|
+
const docSkeletonManagerService = (_renderManagerService3 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(_univerjs_docs.DocSkeletonManagerService);
|
|
16050
16485
|
const viewModel = docSkeletonManagerService === null || docSkeletonManagerService === void 0 ? void 0 : docSkeletonManagerService.getViewModel();
|
|
16051
16486
|
if (documentStyle == null || viewModel == null) return;
|
|
16052
16487
|
const editArea = viewModel.getEditArea();
|
|
@@ -16111,7 +16546,7 @@ function DocHeaderFooterOptionsContent(props) {
|
|
|
16111
16546
|
var _renderManagerService4;
|
|
16112
16547
|
const context = getCurrentSectionContext();
|
|
16113
16548
|
if (!(context === null || context === void 0 ? void 0 : context.sectionId) || context.sectionIndex <= 0 || !docDataModel) return;
|
|
16114
|
-
const kind = ((_renderManagerService4 = renderManagerService.
|
|
16549
|
+
const kind = ((_renderManagerService4 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService4 === void 0 || (_renderManagerService4 = _renderManagerService4.with(_univerjs_docs.DocSkeletonManagerService)) === null || _renderManagerService4 === void 0 || (_renderManagerService4 = _renderManagerService4.getViewModel()) === null || _renderManagerService4 === void 0 ? void 0 : _renderManagerService4.getEditArea()) === _univerjs_engine_render.DocumentEditArea.FOOTER ? "footer" : "header";
|
|
16115
16550
|
const currentVariant = getHeaderFooterVariant(context.config, docSelectionRenderService.getSegmentPage(), context.page);
|
|
16116
16551
|
const key = (0, _univerjs_core.getSectionHeaderFooterReferenceKey)(kind, currentVariant);
|
|
16117
16552
|
const segmentId = (0, _univerjs_core.generateRandomId)(6);
|
|
@@ -16601,7 +17036,7 @@ const useFirstParagraphLineSpacing = (paragraph) => {
|
|
|
16601
17036
|
var _renderManagerService;
|
|
16602
17037
|
const docDataModel = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
16603
17038
|
if (!docDataModel) return;
|
|
16604
|
-
return (_renderManagerService = renderManagerService.
|
|
17039
|
+
return (_renderManagerService = renderManagerService.getRenderUnitById(docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
16605
17040
|
}, []);
|
|
16606
17041
|
const stateChange$ = (0, react.useMemo)(() => new rxjs.BehaviorSubject({}), []);
|
|
16607
17042
|
const [spacingRule, setSpacingRuleInternal] = (0, react.useState)(() => {
|
|
@@ -16630,7 +17065,8 @@ const useFirstParagraphLineSpacing = (paragraph) => {
|
|
|
16630
17065
|
const divideNode = glyphNode === null || glyphNode === void 0 ? void 0 : glyphNode.parent;
|
|
16631
17066
|
const metrics = getLineSpacingMetrics(divideNode === null || divideNode === void 0 ? void 0 : divideNode.parent);
|
|
16632
17067
|
const nextStoredLineSpacing = convertLineSpacingForRuleChange(convertDisplayLineSpacingToStoredValue(lineSpacing, spacingRule), spacingRule, v, metrics);
|
|
16633
|
-
|
|
17068
|
+
const nextDisplayLineSpacing = convertStoredLineSpacingToDisplayValue(nextStoredLineSpacing, v);
|
|
17069
|
+
setLineSpacingInternal(nextDisplayLineSpacing);
|
|
16634
17070
|
setSpacingRuleInternal(v);
|
|
16635
17071
|
stateChange$.next({
|
|
16636
17072
|
spacingRule: v,
|
|
@@ -16902,14 +17338,16 @@ function isInSameLine(startNodePosition, endNodePosition) {
|
|
|
16902
17338
|
}
|
|
16903
17339
|
const SKIP_SYMBOLS = [_univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK, _univerjs_core.DataStreamTreeTokenType.PARAGRAPH];
|
|
16904
17340
|
let DocFloatMenuService = class DocFloatMenuService extends _univerjs_core.Disposable {
|
|
16905
|
-
constructor(_context, _docSelectionManagerService, _docCanvasPopManagerService, _univerInstanceService, _docSelectionRenderService) {
|
|
17341
|
+
constructor(_context, _docSelectionManagerService, _docCanvasPopManagerService, _univerInstanceService, _docSelectionRenderService, _contextService) {
|
|
16906
17342
|
super();
|
|
16907
17343
|
this._context = _context;
|
|
16908
17344
|
this._docSelectionManagerService = _docSelectionManagerService;
|
|
16909
17345
|
this._docCanvasPopManagerService = _docCanvasPopManagerService;
|
|
16910
17346
|
this._univerInstanceService = _univerInstanceService;
|
|
16911
17347
|
this._docSelectionRenderService = _docSelectionRenderService;
|
|
17348
|
+
this._contextService = _contextService;
|
|
16912
17349
|
_defineProperty(this, "_floatMenu", null);
|
|
17350
|
+
_defineProperty(this, "_suppressed", false);
|
|
16913
17351
|
if ((0, _univerjs_core.isInternalEditorID)(this._context.unitId)) return;
|
|
16914
17352
|
this._initSelectionChange();
|
|
16915
17353
|
this.disposeWithMe(() => {
|
|
@@ -16922,6 +17360,11 @@ let DocFloatMenuService = class DocFloatMenuService extends _univerjs_core.Dispo
|
|
|
16922
17360
|
hideFloatMenu() {
|
|
16923
17361
|
this._hideFloatMenu();
|
|
16924
17362
|
}
|
|
17363
|
+
setSuppressed(suppressed) {
|
|
17364
|
+
if (this._suppressed === suppressed) return;
|
|
17365
|
+
this._suppressed = suppressed;
|
|
17366
|
+
if (suppressed) this._hideFloatMenu();
|
|
17367
|
+
}
|
|
16925
17368
|
_initSelectionChange() {
|
|
16926
17369
|
this.disposeWithMe(this._docSelectionRenderService.onSelectionStart$.subscribe(() => {
|
|
16927
17370
|
this._hideFloatMenu();
|
|
@@ -16929,6 +17372,10 @@ let DocFloatMenuService = class DocFloatMenuService extends _univerjs_core.Dispo
|
|
|
16929
17372
|
this.disposeWithMe(this._docSelectionManagerService.textSelection$.subscribe((selection) => {
|
|
16930
17373
|
const { unitId, textRanges } = selection;
|
|
16931
17374
|
if (unitId !== this._context.unitId) return;
|
|
17375
|
+
if (this._suppressed || this._contextService.getContextValue(_univerjs_core.FOCUSING_COMMON_DRAWINGS)) {
|
|
17376
|
+
this._hideFloatMenu();
|
|
17377
|
+
return;
|
|
17378
|
+
}
|
|
16932
17379
|
const range = textRanges.length > 0 && textRanges.find((range) => !range.collapsed);
|
|
16933
17380
|
if (range) {
|
|
16934
17381
|
var _this$_floatMenu, _this$_floatMenu2;
|
|
@@ -16970,7 +17417,8 @@ DocFloatMenuService = __decorate([
|
|
|
16970
17417
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_docs.DocSelectionManagerService)),
|
|
16971
17418
|
__decorateParam(2, (0, _univerjs_core.Inject)(DocCanvasPopManagerService)),
|
|
16972
17419
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
16973
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(DocSelectionRenderService))
|
|
17420
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(DocSelectionRenderService)),
|
|
17421
|
+
__decorateParam(5, _univerjs_core.IContextService)
|
|
16974
17422
|
], DocFloatMenuService);
|
|
16975
17423
|
function isRangeInCodeBlock(documentDataModel, range) {
|
|
16976
17424
|
var _documentDataModel$ge3, _documentDataModel$ge4;
|
|
@@ -17661,9 +18109,6 @@ const PARAGRAPH_MENU_HOVER_OPEN_DELAY = 800;
|
|
|
17661
18109
|
const PARAGRAPH_MENU_HOVER_HIDE_DELAY = 240;
|
|
17662
18110
|
const PARAGRAPH_MENU_HOVER_BRIDGE_EDGE_OVERLAP = 12;
|
|
17663
18111
|
const PARAGRAPH_MENU_HOVER_BRIDGE_VERTICAL_PADDING = 8;
|
|
17664
|
-
function getParagraphMenuTriggerClassName(visible) {
|
|
17665
|
-
return (0, _univerjs_design.clsx)("univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-gray-200 univer-bg-white univer-px-2 univer-py-0 univer-shadow-sm univer-transition-colors hover:univer-bg-gray-50 hover:univer-shadow-md dark:!univer-border-gray-700 dark:!univer-bg-gray-900 dark:hover:!univer-bg-gray-800", { "univer-bg-gray-100 univer-shadow-md dark:!univer-bg-gray-800": visible });
|
|
17666
|
-
}
|
|
17667
18112
|
function shouldExecuteParagraphMenuMove(validatorService, context) {
|
|
17668
18113
|
return validatorService.canMoveBlock(context);
|
|
17669
18114
|
}
|
|
@@ -17797,6 +18242,7 @@ function getParagraphMenuBlockRangeCommandId(blockType) {
|
|
|
17797
18242
|
}
|
|
17798
18243
|
const PARAGRAPH_MENU_BLOCK_RANGE_COMMAND_IDS = new Set(PARAGRAPH_MENU_BLOCK_RANGE_TYPES.map((blockType) => getParagraphMenuBlockRangeCommandId(blockType)));
|
|
17799
18244
|
const PARAGRAPH_MENU_SELECTION_COMMAND_IDS = /* @__PURE__ */ new Set([
|
|
18245
|
+
DocPasteCommand.id,
|
|
17800
18246
|
BulletListCommand.id,
|
|
17801
18247
|
OrderListCommand.id,
|
|
17802
18248
|
CheckListCommand.id,
|
|
@@ -17890,6 +18336,7 @@ function getParagraphMenuHiddenItemIds(menuType, target, namedStyleType) {
|
|
|
17890
18336
|
if (menuType === "doc.menu.paragraph-t.insert") return [];
|
|
17891
18337
|
const hiddenIds = [...getParagraphMenuHiddenHeadingCommandIds(namedStyleType)];
|
|
17892
18338
|
const blockType = (target === null || target === void 0 ? void 0 : target.kind) === "blockRange" ? (_target$blockRange2 = target.blockRange) === null || _target$blockRange2 === void 0 ? void 0 : _target$blockRange2.blockType : void 0;
|
|
18339
|
+
if ((target === null || target === void 0 ? void 0 : target.kind) !== "blockRange") hiddenIds.push(DocPasteCommand.id);
|
|
17893
18340
|
if (blockType === _univerjs_core.DocumentBlockRangeType.CALLOUT) hiddenIds.push(getParagraphMenuBlockRangeCommandId(_univerjs_core.DocumentBlockRangeType.CODE), getParagraphMenuBlockRangeCommandId(_univerjs_core.DocumentBlockRangeType.QUOTE));
|
|
17894
18341
|
else if (blockType === _univerjs_core.DocumentBlockRangeType.QUOTE || blockType === _univerjs_core.DocumentBlockRangeType.CODE) hiddenIds.push(getParagraphMenuBlockRangeCommandId(_univerjs_core.DocumentBlockRangeType.CALLOUT));
|
|
17895
18342
|
return hiddenIds;
|
|
@@ -18086,6 +18533,7 @@ function getParagraphFormattingRange(target, paragraph) {
|
|
|
18086
18533
|
return getTargetSelectionRange(target, paragraph);
|
|
18087
18534
|
}
|
|
18088
18535
|
function getParagraphMenuCommandTargetRange(commandId, targetRange, formattingRange) {
|
|
18536
|
+
if (commandId === DocPasteCommand.id) return targetRange;
|
|
18089
18537
|
if (commandId && PARAGRAPH_MENU_SELECTION_COMMAND_IDS.has(commandId)) return formattingRange !== null && formattingRange !== void 0 ? formattingRange : targetRange;
|
|
18090
18538
|
return targetRange !== null && targetRange !== void 0 ? targetRange : formattingRange;
|
|
18091
18539
|
}
|
|
@@ -18105,6 +18553,17 @@ function getBlockSelectionRange(target, paragraph) {
|
|
|
18105
18553
|
segmentId: paragraph === null || paragraph === void 0 ? void 0 : paragraph.segmentId
|
|
18106
18554
|
};
|
|
18107
18555
|
}
|
|
18556
|
+
function getBlockRangeClipboardTargetRange(commandId, target, paragraph) {
|
|
18557
|
+
if ((target === null || target === void 0 ? void 0 : target.kind) !== "blockRange") return null;
|
|
18558
|
+
if (commandId === DocPasteCommand.id) return {
|
|
18559
|
+
startOffset: target.moveRange.endOffset,
|
|
18560
|
+
endOffset: target.moveRange.endOffset,
|
|
18561
|
+
collapsed: true,
|
|
18562
|
+
segmentId: paragraph === null || paragraph === void 0 ? void 0 : paragraph.segmentId
|
|
18563
|
+
};
|
|
18564
|
+
if (commandId === DocCopyCurrentParagraphCommand.id || commandId === DocCutCurrentParagraphCommand.id) return getBlockSelectionRange(target, paragraph !== null && paragraph !== void 0 ? paragraph : void 0);
|
|
18565
|
+
return null;
|
|
18566
|
+
}
|
|
18108
18567
|
function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
18109
18568
|
var _ref3, _ref4, _currentActiveTarget$, _doc$getBody$dataStre, _doc$getBody, _currentActiveTarget$2, _paragraphObj$paragra, _currentActiveTarget$3;
|
|
18110
18569
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
@@ -18125,7 +18584,6 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18125
18584
|
const docClipboardService = (0, _univerjs_ui.useDependency)(IDocClipboardService);
|
|
18126
18585
|
const docContentInsertService = (0, _univerjs_ui.useDependency)(_univerjs_docs.DocContentInsertService);
|
|
18127
18586
|
const docBlockMoveValidatorService = (0, _univerjs_ui.useDependency)(_univerjs_docs.DocBlockMoveValidatorService);
|
|
18128
|
-
const clipboardInterfaceService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IClipboardInterfaceService);
|
|
18129
18587
|
const layoutService = (0, _univerjs_ui.useDependency)(_univerjs_ui.ILayoutService);
|
|
18130
18588
|
const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
|
|
18131
18589
|
const anchorRef = (0, react.useRef)(null);
|
|
@@ -18134,7 +18592,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18134
18592
|
const handledSlashRequestNonceRef = (0, react.useRef)(0);
|
|
18135
18593
|
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
18136
18594
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
18137
|
-
const renderUnit = renderManagerService.
|
|
18595
|
+
const renderUnit = renderManagerService.getRenderUnitById(popup.unitId);
|
|
18138
18596
|
const doc = univerInstanceService.getUnit(popup.unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
18139
18597
|
const docParagraphMenuService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocParagraphMenuService);
|
|
18140
18598
|
const docEventManagerService = renderUnit === null || renderUnit === void 0 ? void 0 : renderUnit.with(DocEventManagerService);
|
|
@@ -18173,10 +18631,11 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18173
18631
|
const boundingRect = (_anchorRef$current = anchorRef.current) === null || _anchorRef$current === void 0 ? void 0 : _anchorRef$current.getBoundingClientRect();
|
|
18174
18632
|
const left = ((_boundingRect$left = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.left) !== null && _boundingRect$left !== void 0 ? _boundingRect$left : 0) - 4;
|
|
18175
18633
|
const right = (_boundingRect$right = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.right) !== null && _boundingRect$right !== void 0 ? _boundingRect$right : 0;
|
|
18634
|
+
const viewportWidth = (_anchorRef$current$ow = (_anchorRef$current2 = anchorRef.current) === null || _anchorRef$current2 === void 0 || (_anchorRef$current2 = _anchorRef$current2.ownerDocument.defaultView) === null || _anchorRef$current2 === void 0 ? void 0 : _anchorRef$current2.innerWidth) !== null && _anchorRef$current$ow !== void 0 ? _anchorRef$current$ow : window.innerWidth;
|
|
18176
18635
|
setMenuDirection(getParagraphMenuPopupDirection(left, 212, 8, {
|
|
18177
18636
|
anchorRight: right,
|
|
18178
18637
|
direction,
|
|
18179
|
-
viewportWidth
|
|
18638
|
+
viewportWidth
|
|
18180
18639
|
}));
|
|
18181
18640
|
const nextAnchorRect = {
|
|
18182
18641
|
left,
|
|
@@ -18210,10 +18669,11 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18210
18669
|
clearHideTimer();
|
|
18211
18670
|
const latestTarget = (_docParagraphMenuServ = docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget) !== null && _docParagraphMenuServ !== void 0 ? _docParagraphMenuServ : activeTarget;
|
|
18212
18671
|
setParagraphMenuInteractionActive(docParagraphMenuService, true);
|
|
18213
|
-
|
|
18672
|
+
const targetRange = latestTarget ? {
|
|
18214
18673
|
...latestTarget.menuRange,
|
|
18215
18674
|
segmentId: activeParagraphBound === null || activeParagraphBound === void 0 ? void 0 : activeParagraphBound.segmentId
|
|
18216
18675
|
} : getParagraphMenuTargetRange(activeParagraphBound);
|
|
18676
|
+
targetRangeRef.current = targetRange;
|
|
18217
18677
|
updateAnchorRect();
|
|
18218
18678
|
setOpenMode(mode);
|
|
18219
18679
|
setVisible(true);
|
|
@@ -18241,7 +18701,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18241
18701
|
};
|
|
18242
18702
|
const replaceSelection = (range) => {
|
|
18243
18703
|
if (!range) return;
|
|
18244
|
-
docSelectionManagerService.
|
|
18704
|
+
docSelectionManagerService.replaceDocRanges([range], void 0, false);
|
|
18245
18705
|
};
|
|
18246
18706
|
const getCurrentTextRangesSnapshot = () => {
|
|
18247
18707
|
var _docSelectionManagerS;
|
|
@@ -18249,7 +18709,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18249
18709
|
};
|
|
18250
18710
|
const restoreTextRanges = (ranges) => {
|
|
18251
18711
|
if (!ranges) return;
|
|
18252
|
-
docSelectionManagerService.
|
|
18712
|
+
docSelectionManagerService.replaceDocRanges(ranges, void 0, false);
|
|
18253
18713
|
};
|
|
18254
18714
|
const executeResolvedCommand = (option, targetRange) => {
|
|
18255
18715
|
const resolved = getParagraphMenuResolvedCommand(option, targetRange);
|
|
@@ -18320,7 +18780,19 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18320
18780
|
}
|
|
18321
18781
|
if ((latestTarget === null || latestTarget === void 0 ? void 0 : latestTarget.kind) === "blockRange") {
|
|
18322
18782
|
var _latestTarget$blockRa;
|
|
18323
|
-
|
|
18783
|
+
const currentBlockCommandId = getParagraphMenuBlockRangeCommandId((_latestTarget$blockRa = latestTarget.blockRange) === null || _latestTarget$blockRa === void 0 ? void 0 : _latestTarget$blockRa.blockType);
|
|
18784
|
+
const clipboardRange = getBlockRangeClipboardTargetRange(commandId, latestTarget, activeParagraphBound);
|
|
18785
|
+
if (clipboardRange) {
|
|
18786
|
+
if (commandId === DocCopyCurrentParagraphCommand.id) await docClipboardService.copy(_univerjs_core.SliceBodyType.copy, [clipboardRange]);
|
|
18787
|
+
else if (commandId === DocCutCurrentParagraphCommand.id) await docClipboardService.cut([clipboardRange]);
|
|
18788
|
+
else {
|
|
18789
|
+
replaceSelection(clipboardRange);
|
|
18790
|
+
await executeResolvedCommand(option, clipboardRange);
|
|
18791
|
+
}
|
|
18792
|
+
finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
|
|
18793
|
+
return;
|
|
18794
|
+
}
|
|
18795
|
+
if (commandId === currentBlockCommandId) {
|
|
18324
18796
|
await unwrapActiveBlockRange();
|
|
18325
18797
|
finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
|
|
18326
18798
|
return;
|
|
@@ -18396,7 +18868,7 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18396
18868
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18397
18869
|
"data-u-comp": "paragraph-menu",
|
|
18398
18870
|
ref: anchorRef,
|
|
18399
|
-
className:
|
|
18871
|
+
className: (0, _univerjs_design.clsx)("univer-mr-1 univer-inline-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1 univer-rounded-md univer-border univer-border-gray-200 univer-bg-white univer-px-2 univer-py-0 univer-shadow-sm univer-transition-colors hover:univer-bg-gray-50 hover:univer-shadow-md dark:!univer-border-gray-700 dark:!univer-bg-gray-900 dark:hover:!univer-bg-gray-800", { "univer-bg-gray-100 univer-shadow-md dark:!univer-bg-gray-800": visible }),
|
|
18400
18872
|
onMouseEnter: (e) => {
|
|
18401
18873
|
var _popup$onPointerEnter;
|
|
18402
18874
|
(_popup$onPointerEnter = popup.onPointerEnter) === null || _popup$onPointerEnter === void 0 || _popup$onPointerEnter.call(popup, e);
|
|
@@ -18568,15 +19040,17 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18568
19040
|
return;
|
|
18569
19041
|
}
|
|
18570
19042
|
if (commandId === DocPasteCommand.id) {
|
|
18571
|
-
docSelectionManagerService.
|
|
18572
|
-
|
|
18573
|
-
await docClipboardService.paste(clipboardItems);
|
|
19043
|
+
docSelectionManagerService.replaceDocRanges([afterTableRange], void 0, false);
|
|
19044
|
+
await commandService.executeCommand(DocPasteCommand.id);
|
|
18574
19045
|
finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
|
|
18575
19046
|
return;
|
|
18576
19047
|
}
|
|
18577
|
-
if (commandId === DocTableDeleteTableCommand.id) docSelectionManagerService.
|
|
18578
|
-
else if (params.id === "doc.menu.insert-bellow" || commandId !== "doc.menu.insert-bellow") docSelectionManagerService.
|
|
18579
|
-
if (commandService && commandId) commandService.executeCommand(commandId,
|
|
19048
|
+
if (commandId === DocTableDeleteTableCommand.id) docSelectionManagerService.replaceDocRanges([tableRange], void 0, false);
|
|
19049
|
+
else if (params.id === "doc.menu.insert-bellow" || commandId !== "doc.menu.insert-bellow") docSelectionManagerService.replaceDocRanges([afterTableRange], void 0, false);
|
|
19050
|
+
if (commandService && commandId) commandService.executeCommand(commandId, commandId === DocTableDeleteTableCommand.id ? {
|
|
19051
|
+
...commandParams,
|
|
19052
|
+
targetRange: tableRange
|
|
19053
|
+
} : commandParams);
|
|
18580
19054
|
finishParagraphMenuCommand(docParagraphMenuService, layoutService, handleHideMenu);
|
|
18581
19055
|
return;
|
|
18582
19056
|
}
|
|
@@ -18632,7 +19106,7 @@ function getSectionColumnGap(section) {
|
|
|
18632
19106
|
var _section$columnProper2, _section$columnProper3;
|
|
18633
19107
|
return (_section$columnProper2 = (_section$columnProper3 = section.columnProperties) === null || _section$columnProper3 === void 0 || (_section$columnProper3 = _section$columnProper3[0]) === null || _section$columnProper3 === void 0 ? void 0 : _section$columnProper3.paddingEnd) !== null && _section$columnProper2 !== void 0 ? _section$columnProper2 : DEFAULT_SECTION_COLUMN_GAP;
|
|
18634
19108
|
}
|
|
18635
|
-
function getSectionSettingValues(sections) {
|
|
19109
|
+
function getSectionSettingValues(sections, documentStyle) {
|
|
18636
19110
|
return {
|
|
18637
19111
|
columnCount: getCommonValue(sections.map(getSectionColumnCount)),
|
|
18638
19112
|
columnGap: getCommonValue(sections.map(getSectionColumnGap)),
|
|
@@ -18643,6 +19117,38 @@ function getSectionSettingValues(sections) {
|
|
|
18643
19117
|
sectionType: getCommonValue(sections.map((section) => {
|
|
18644
19118
|
var _section$sectionType;
|
|
18645
19119
|
return (_section$sectionType = section.sectionType) !== null && _section$sectionType !== void 0 ? _section$sectionType : _univerjs_core.SectionType.SECTION_TYPE_UNSPECIFIED;
|
|
19120
|
+
})),
|
|
19121
|
+
pageWidth: getCommonValue(sections.map((section) => {
|
|
19122
|
+
var _section$pageSize$wid, _section$pageSize, _documentStyle$pageSi;
|
|
19123
|
+
return (_section$pageSize$wid = (_section$pageSize = section.pageSize) === null || _section$pageSize === void 0 ? void 0 : _section$pageSize.width) !== null && _section$pageSize$wid !== void 0 ? _section$pageSize$wid : (_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width;
|
|
19124
|
+
})),
|
|
19125
|
+
pageHeight: getCommonValue(sections.map((section) => {
|
|
19126
|
+
var _section$pageSize$hei, _section$pageSize2, _documentStyle$pageSi2;
|
|
19127
|
+
return (_section$pageSize$hei = (_section$pageSize2 = section.pageSize) === null || _section$pageSize2 === void 0 ? void 0 : _section$pageSize2.height) !== null && _section$pageSize$hei !== void 0 ? _section$pageSize$hei : (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.height;
|
|
19128
|
+
})),
|
|
19129
|
+
pageOrient: getCommonValue(sections.map((section) => {
|
|
19130
|
+
var _section$pageOrient;
|
|
19131
|
+
return (_section$pageOrient = section.pageOrient) !== null && _section$pageOrient !== void 0 ? _section$pageOrient : documentStyle.pageOrient;
|
|
19132
|
+
})),
|
|
19133
|
+
marginTop: getCommonValue(sections.map((section) => {
|
|
19134
|
+
var _ref, _section$marginTop;
|
|
19135
|
+
return (_ref = (_section$marginTop = section.marginTop) !== null && _section$marginTop !== void 0 ? _section$marginTop : documentStyle.marginTop) !== null && _ref !== void 0 ? _ref : 0;
|
|
19136
|
+
})),
|
|
19137
|
+
marginBottom: getCommonValue(sections.map((section) => {
|
|
19138
|
+
var _ref2, _section$marginBottom;
|
|
19139
|
+
return (_ref2 = (_section$marginBottom = section.marginBottom) !== null && _section$marginBottom !== void 0 ? _section$marginBottom : documentStyle.marginBottom) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
19140
|
+
})),
|
|
19141
|
+
marginLeft: getCommonValue(sections.map((section) => {
|
|
19142
|
+
var _ref3, _section$marginLeft;
|
|
19143
|
+
return (_ref3 = (_section$marginLeft = section.marginLeft) !== null && _section$marginLeft !== void 0 ? _section$marginLeft : documentStyle.marginLeft) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
19144
|
+
})),
|
|
19145
|
+
marginRight: getCommonValue(sections.map((section) => {
|
|
19146
|
+
var _ref4, _section$marginRight;
|
|
19147
|
+
return (_ref4 = (_section$marginRight = section.marginRight) !== null && _section$marginRight !== void 0 ? _section$marginRight : documentStyle.marginRight) !== null && _ref4 !== void 0 ? _ref4 : 0;
|
|
19148
|
+
})),
|
|
19149
|
+
pageNumberStart: getCommonValue(sections.map((section) => {
|
|
19150
|
+
var _ref5, _section$pageNumberSt;
|
|
19151
|
+
return (_ref5 = (_section$pageNumberSt = section.pageNumberStart) !== null && _section$pageNumberSt !== void 0 ? _section$pageNumberSt : documentStyle.pageNumberStart) !== null && _ref5 !== void 0 ? _ref5 : 1;
|
|
18646
19152
|
}))
|
|
18647
19153
|
};
|
|
18648
19154
|
}
|
|
@@ -18656,6 +19162,23 @@ function createSectionColumnUpdates(sections, documentStyle, change) {
|
|
|
18656
19162
|
};
|
|
18657
19163
|
});
|
|
18658
19164
|
}
|
|
19165
|
+
function createSectionOrientationUpdates(sections, documentStyle, pageOrient) {
|
|
19166
|
+
return sections.map((section) => {
|
|
19167
|
+
var _ref6, _section$pageOrient2, _section$pageSize3;
|
|
19168
|
+
const currentOrient = (_ref6 = (_section$pageOrient2 = section.pageOrient) !== null && _section$pageOrient2 !== void 0 ? _section$pageOrient2 : documentStyle.pageOrient) !== null && _ref6 !== void 0 ? _ref6 : _univerjs_core.PageOrientType.PORTRAIT;
|
|
19169
|
+
const currentPageSize = (_section$pageSize3 = section.pageSize) !== null && _section$pageSize3 !== void 0 ? _section$pageSize3 : documentStyle.pageSize;
|
|
19170
|
+
return {
|
|
19171
|
+
sectionId: section.sectionId,
|
|
19172
|
+
config: {
|
|
19173
|
+
pageOrient,
|
|
19174
|
+
...currentOrient !== pageOrient && (currentPageSize === null || currentPageSize === void 0 ? void 0 : currentPageSize.width) != null && currentPageSize.height != null ? { pageSize: {
|
|
19175
|
+
width: currentPageSize.height,
|
|
19176
|
+
height: currentPageSize.width
|
|
19177
|
+
} } : {}
|
|
19178
|
+
}
|
|
19179
|
+
};
|
|
19180
|
+
});
|
|
19181
|
+
}
|
|
18659
19182
|
function getSelectedSections(documentDataModel, ranges) {
|
|
18660
19183
|
const body = documentDataModel.getBody();
|
|
18661
19184
|
if (!body || ranges.length === 0 || ranges.some((range) => Boolean(range.segmentId))) return [];
|
|
@@ -18669,14 +19192,24 @@ function getSelectedSections(documentDataModel, ranges) {
|
|
|
18669
19192
|
});
|
|
18670
19193
|
});
|
|
18671
19194
|
}
|
|
19195
|
+
function navigateToSection(controller, documentDataModel, sections, sectionId) {
|
|
19196
|
+
const index = sections.findIndex((section) => section.sectionId === sectionId);
|
|
19197
|
+
if (!documentDataModel || index < 0) return;
|
|
19198
|
+
controller.navigateToSectionEnd(documentDataModel.getUnitId(), index === 0 ? 0 : sections[index - 1].startIndex + 1, sections[index].startIndex);
|
|
19199
|
+
}
|
|
18672
19200
|
function useSectionSetting() {
|
|
19201
|
+
var _documentDataModel$ge;
|
|
18673
19202
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
18674
19203
|
const instanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
18675
19204
|
const selectionManager = (0, _univerjs_ui.useDependency)(_univerjs_docs.DocSelectionManagerService);
|
|
19205
|
+
const controller = (0, _univerjs_ui.useDependency)(DocSectionSettingController);
|
|
18676
19206
|
const documentDataModel = (0, _univerjs_ui.useObservable)((0, react.useMemo)(() => instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC), [instanceService]));
|
|
18677
19207
|
const resolveSections = () => (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === _univerjs_core.DocumentFlavor.TRADITIONAL ? getSelectedSections(documentDataModel, selectionManager.getDocRanges()) : [];
|
|
18678
19208
|
const sections = (0, _univerjs_ui.useObservable)(documentDataModel ? () => (0, rxjs.combineLatest)([selectionManager.textSelection$.pipe((0, rxjs.startWith)(void 0)), documentDataModel.change$.pipe((0, rxjs.startWith)(void 0))]).pipe((0, rxjs.map)(resolveSections)) : null, resolveSections(), false, [documentDataModel, selectionManager]);
|
|
18679
|
-
const
|
|
19209
|
+
const documentStyle = (_documentDataModel$ge = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle()) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : {};
|
|
19210
|
+
const values = getSectionSettingValues(sections, documentStyle);
|
|
19211
|
+
const body = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getBody();
|
|
19212
|
+
const allSections = (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === _univerjs_core.DocumentFlavor.TRADITIONAL && body ? (0, _univerjs_docs.getTopLevelSectionBreaks)(body) : [];
|
|
18680
19213
|
const update = (updates) => {
|
|
18681
19214
|
if (!documentDataModel || updates.length === 0) return Promise.resolve(false);
|
|
18682
19215
|
return commandService.executeCommand(_univerjs_docs.UpdateDocumentSectionCommand.id, {
|
|
@@ -18691,7 +19224,15 @@ function useSectionSetting() {
|
|
|
18691
19224
|
return {
|
|
18692
19225
|
valid: Boolean(documentDataModel && sections.length > 0),
|
|
18693
19226
|
selectedCount: sections.length,
|
|
19227
|
+
sectionOptions: allSections.map((section, index) => ({
|
|
19228
|
+
label: `#${index + 1}`,
|
|
19229
|
+
value: section.sectionId
|
|
19230
|
+
})),
|
|
19231
|
+
selectedSectionId: sections.length === 1 ? sections[0].sectionId : void 0,
|
|
18694
19232
|
...values,
|
|
19233
|
+
selectSection(sectionId) {
|
|
19234
|
+
navigateToSection(controller, documentDataModel !== null && documentDataModel !== void 0 ? documentDataModel : void 0, allSections, sectionId);
|
|
19235
|
+
},
|
|
18695
19236
|
setColumnCount(value) {
|
|
18696
19237
|
const next = Math.max(1, Math.round(value));
|
|
18697
19238
|
return update(documentDataModel ? createSectionColumnUpdates(sections, documentDataModel.getDocumentStyle(), { columnCount: next }) : []);
|
|
@@ -18705,6 +19246,44 @@ function useSectionSetting() {
|
|
|
18705
19246
|
},
|
|
18706
19247
|
setSectionType(value) {
|
|
18707
19248
|
return updateAll({ sectionType: value });
|
|
19249
|
+
},
|
|
19250
|
+
setPageWidth(value) {
|
|
19251
|
+
return update(sections.map((section) => ({
|
|
19252
|
+
sectionId: section.sectionId,
|
|
19253
|
+
config: { pageSize: {
|
|
19254
|
+
...documentStyle.pageSize,
|
|
19255
|
+
...section.pageSize,
|
|
19256
|
+
width: Math.max(1, value)
|
|
19257
|
+
} }
|
|
19258
|
+
})));
|
|
19259
|
+
},
|
|
19260
|
+
setPageHeight(value) {
|
|
19261
|
+
return update(sections.map((section) => ({
|
|
19262
|
+
sectionId: section.sectionId,
|
|
19263
|
+
config: { pageSize: {
|
|
19264
|
+
...documentStyle.pageSize,
|
|
19265
|
+
...section.pageSize,
|
|
19266
|
+
height: Math.max(1, value)
|
|
19267
|
+
} }
|
|
19268
|
+
})));
|
|
19269
|
+
},
|
|
19270
|
+
setPageOrient(value) {
|
|
19271
|
+
return update(createSectionOrientationUpdates(sections, documentStyle, value));
|
|
19272
|
+
},
|
|
19273
|
+
setMarginTop(value) {
|
|
19274
|
+
return updateAll({ marginTop: Math.max(0, value) });
|
|
19275
|
+
},
|
|
19276
|
+
setMarginBottom(value) {
|
|
19277
|
+
return updateAll({ marginBottom: Math.max(0, value) });
|
|
19278
|
+
},
|
|
19279
|
+
setMarginLeft(value) {
|
|
19280
|
+
return updateAll({ marginLeft: Math.max(0, value) });
|
|
19281
|
+
},
|
|
19282
|
+
setMarginRight(value) {
|
|
19283
|
+
return updateAll({ marginRight: Math.max(0, value) });
|
|
19284
|
+
},
|
|
19285
|
+
setPageNumberStart(value) {
|
|
19286
|
+
return updateAll({ pageNumberStart: Math.max(1, Math.round(value)) });
|
|
18708
19287
|
}
|
|
18709
19288
|
};
|
|
18710
19289
|
}
|
|
@@ -18715,9 +19294,9 @@ function SettingRow(props) {
|
|
|
18715
19294
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18716
19295
|
className: "univer-grid univer-min-h-8 univer-items-center univer-gap-3",
|
|
18717
19296
|
style: { gridTemplateColumns: "minmax(0, 1fr) minmax(140px, 160px)" },
|
|
18718
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
19297
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18719
19298
|
className: "univer-min-w-0 univer-text-xs univer-leading-5 univer-text-gray-900 dark:!univer-text-gray-100",
|
|
18720
|
-
children: props.label
|
|
19299
|
+
children: [props.label, props.unit]
|
|
18721
19300
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18722
19301
|
className: "univer-w-full univer-min-w-0",
|
|
18723
19302
|
children: props.children
|
|
@@ -18725,27 +19304,11 @@ function SettingRow(props) {
|
|
|
18725
19304
|
});
|
|
18726
19305
|
}
|
|
18727
19306
|
function SectionSetting() {
|
|
19307
|
+
var _setting$selectedSect;
|
|
18728
19308
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
18729
19309
|
const controller = (0, _univerjs_ui.useDependency)(DocSectionSettingController);
|
|
18730
19310
|
const setting = useSectionSetting();
|
|
18731
|
-
|
|
18732
|
-
selectedSections: localeService.t("docs-ui.doc.sectionSetting.selectedSections", String(setting.selectedCount)),
|
|
18733
|
-
columnCount: localeService.t("docs-ui.doc.sectionSetting.columnCount"),
|
|
18734
|
-
columnGap: `${localeService.t("docs-ui.doc.sectionSetting.columnGap")}(px)`,
|
|
18735
|
-
columnSeparator: localeService.t("docs-ui.doc.sectionSetting.columnSeparator"),
|
|
18736
|
-
none: localeService.t("docs-ui.doc.sectionSetting.none"),
|
|
18737
|
-
betweenColumns: localeService.t("docs-ui.doc.sectionSetting.betweenColumns"),
|
|
18738
|
-
sectionStart: localeService.t("docs-ui.doc.sectionSetting.sectionStart"),
|
|
18739
|
-
unspecified: localeService.t("docs-ui.doc.sectionSetting.unspecified"),
|
|
18740
|
-
continuous: localeService.t("docs-ui.doc.sectionSetting.continuous"),
|
|
18741
|
-
nextPage: localeService.t("docs-ui.doc.sectionSetting.nextPage"),
|
|
18742
|
-
evenPage: localeService.t("docs-ui.doc.sectionSetting.evenPage"),
|
|
18743
|
-
oddPage: localeService.t("docs-ui.doc.sectionSetting.oddPage")
|
|
18744
|
-
}), [
|
|
18745
|
-
(0, _univerjs_ui.useObservable)(localeService.currentLocale$),
|
|
18746
|
-
localeService,
|
|
18747
|
-
setting.selectedCount
|
|
18748
|
-
]);
|
|
19311
|
+
(0, _univerjs_ui.useObservable)(localeService.currentLocale$);
|
|
18749
19312
|
(0, react.useEffect)(() => {
|
|
18750
19313
|
if (!setting.valid) controller.closePanel();
|
|
18751
19314
|
}, [controller, setting.valid]);
|
|
@@ -18754,13 +19317,27 @@ function SectionSetting() {
|
|
|
18754
19317
|
className: "univer-box-border univer-w-full",
|
|
18755
19318
|
children: [setting.selectedCount > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18756
19319
|
className: "univer-mb-4 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-300",
|
|
18757
|
-
children:
|
|
19320
|
+
children: localeService.t("docs-ui.doc.sectionSetting.selectedSections", `${setting.selectedCount}`)
|
|
18758
19321
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18759
19322
|
className: "univer-grid univer-gap-3",
|
|
18760
19323
|
children: [
|
|
18761
19324
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18762
|
-
label:
|
|
19325
|
+
label: localeService.t("docs-ui.doc.slider.sectionSetting"),
|
|
19326
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
19327
|
+
className: "univer-w-full",
|
|
19328
|
+
value: (_setting$selectedSect = setting.selectedSectionId) !== null && _setting$selectedSect !== void 0 ? _setting$selectedSect : "",
|
|
19329
|
+
options: [...setting.selectedSectionId == null ? [{
|
|
19330
|
+
label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
|
|
19331
|
+
value: "",
|
|
19332
|
+
disabled: true
|
|
19333
|
+
}] : [], ...setting.sectionOptions],
|
|
19334
|
+
onChange: setting.selectSection
|
|
19335
|
+
})
|
|
19336
|
+
}),
|
|
19337
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19338
|
+
label: localeService.t("docs-ui.doc.sectionSetting.columnCount"),
|
|
18763
19339
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19340
|
+
"aria-label": localeService.t("docs-ui.doc.sectionSetting.columnCount"),
|
|
18764
19341
|
className: "univer-w-full",
|
|
18765
19342
|
min: 1,
|
|
18766
19343
|
max: 12,
|
|
@@ -18771,8 +19348,10 @@ function SectionSetting() {
|
|
|
18771
19348
|
})
|
|
18772
19349
|
}),
|
|
18773
19350
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18774
|
-
label:
|
|
19351
|
+
label: localeService.t("docs-ui.doc.sectionSetting.columnGap"),
|
|
19352
|
+
unit: " (px)",
|
|
18775
19353
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19354
|
+
"aria-label": localeService.t("docs-ui.doc.sectionSetting.columnGap"),
|
|
18776
19355
|
className: "univer-w-full",
|
|
18777
19356
|
min: 0,
|
|
18778
19357
|
max: 1e3,
|
|
@@ -18783,49 +19362,183 @@ function SectionSetting() {
|
|
|
18783
19362
|
})
|
|
18784
19363
|
}),
|
|
18785
19364
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18786
|
-
label:
|
|
19365
|
+
label: localeService.t("docs-ui.doc.sectionSetting.columnSeparator"),
|
|
18787
19366
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
18788
19367
|
className: "univer-w-full",
|
|
18789
|
-
value: setting.separatorType == null ? "" :
|
|
18790
|
-
options: [
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
19368
|
+
value: setting.separatorType == null ? "" : `${setting.separatorType}`,
|
|
19369
|
+
options: [
|
|
19370
|
+
...setting.separatorType == null ? [{
|
|
19371
|
+
label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
|
|
19372
|
+
value: "",
|
|
19373
|
+
disabled: true
|
|
19374
|
+
}] : [],
|
|
19375
|
+
{
|
|
19376
|
+
label: localeService.t("docs-ui.doc.sectionSetting.none"),
|
|
19377
|
+
value: `${_univerjs_core.ColumnSeparatorType.NONE}`
|
|
19378
|
+
},
|
|
19379
|
+
{
|
|
19380
|
+
label: localeService.t("docs-ui.doc.sectionSetting.betweenColumns"),
|
|
19381
|
+
value: `${_univerjs_core.ColumnSeparatorType.BETWEEN_EACH_COLUMN}`
|
|
19382
|
+
}
|
|
19383
|
+
],
|
|
18797
19384
|
onChange: (value) => setting.setSeparatorType(Number(value))
|
|
18798
19385
|
})
|
|
18799
19386
|
}),
|
|
18800
19387
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18801
|
-
label:
|
|
19388
|
+
label: localeService.t("docs-ui.doc.sectionSetting.sectionStart"),
|
|
18802
19389
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
18803
19390
|
className: "univer-w-full",
|
|
18804
|
-
value: setting.sectionType == null ? "" :
|
|
19391
|
+
value: setting.sectionType == null ? "" : `${setting.sectionType}`,
|
|
18805
19392
|
options: [
|
|
19393
|
+
...setting.sectionType == null ? [{
|
|
19394
|
+
label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
|
|
19395
|
+
value: "",
|
|
19396
|
+
disabled: true
|
|
19397
|
+
}] : [],
|
|
19398
|
+
{
|
|
19399
|
+
label: localeService.t("docs-ui.doc.sectionSetting.unspecified"),
|
|
19400
|
+
value: `${_univerjs_core.SectionType.SECTION_TYPE_UNSPECIFIED}`
|
|
19401
|
+
},
|
|
18806
19402
|
{
|
|
18807
|
-
label:
|
|
18808
|
-
value:
|
|
19403
|
+
label: localeService.t("docs-ui.doc.sectionSetting.continuous"),
|
|
19404
|
+
value: `${_univerjs_core.SectionType.CONTINUOUS}`
|
|
18809
19405
|
},
|
|
18810
19406
|
{
|
|
18811
|
-
label:
|
|
18812
|
-
value:
|
|
19407
|
+
label: localeService.t("docs-ui.doc.sectionSetting.nextColumn"),
|
|
19408
|
+
value: `${_univerjs_core.SectionType.NEXT_COLUMN}`
|
|
18813
19409
|
},
|
|
18814
19410
|
{
|
|
18815
|
-
label:
|
|
18816
|
-
value:
|
|
19411
|
+
label: localeService.t("docs-ui.doc.sectionSetting.nextPage"),
|
|
19412
|
+
value: `${_univerjs_core.SectionType.NEXT_PAGE}`
|
|
18817
19413
|
},
|
|
18818
19414
|
{
|
|
18819
|
-
label:
|
|
18820
|
-
value:
|
|
19415
|
+
label: localeService.t("docs-ui.doc.sectionSetting.evenPage"),
|
|
19416
|
+
value: `${_univerjs_core.SectionType.EVEN_PAGE}`
|
|
18821
19417
|
},
|
|
18822
19418
|
{
|
|
18823
|
-
label:
|
|
18824
|
-
value:
|
|
19419
|
+
label: localeService.t("docs-ui.doc.sectionSetting.oddPage"),
|
|
19420
|
+
value: `${_univerjs_core.SectionType.ODD_PAGE}`
|
|
18825
19421
|
}
|
|
18826
19422
|
],
|
|
18827
19423
|
onChange: (value) => setting.setSectionType(Number(value))
|
|
18828
19424
|
})
|
|
19425
|
+
}),
|
|
19426
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
19427
|
+
className: "univer-pt-2 univer-text-sm univer-font-medium",
|
|
19428
|
+
children: localeService.t("docs-ui.doc.sectionSetting.pageSetup")
|
|
19429
|
+
}),
|
|
19430
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19431
|
+
label: localeService.t("docs-ui.doc.sectionSetting.pageWidth"),
|
|
19432
|
+
unit: " (px)",
|
|
19433
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19434
|
+
"aria-label": localeService.t("docs-ui.doc.sectionSetting.pageWidth"),
|
|
19435
|
+
className: "univer-w-full",
|
|
19436
|
+
min: 1,
|
|
19437
|
+
step: 1,
|
|
19438
|
+
precision: 1,
|
|
19439
|
+
value: setting.pageWidth,
|
|
19440
|
+
onChange: (value) => value != null && setting.setPageWidth(value)
|
|
19441
|
+
})
|
|
19442
|
+
}),
|
|
19443
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19444
|
+
label: localeService.t("docs-ui.doc.sectionSetting.pageHeight"),
|
|
19445
|
+
unit: " (px)",
|
|
19446
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19447
|
+
"aria-label": localeService.t("docs-ui.doc.sectionSetting.pageHeight"),
|
|
19448
|
+
className: "univer-w-full",
|
|
19449
|
+
min: 1,
|
|
19450
|
+
step: 1,
|
|
19451
|
+
precision: 1,
|
|
19452
|
+
value: setting.pageHeight,
|
|
19453
|
+
onChange: (value) => value != null && setting.setPageHeight(value)
|
|
19454
|
+
})
|
|
19455
|
+
}),
|
|
19456
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19457
|
+
label: localeService.t("docs-ui.page-settings.orientation"),
|
|
19458
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
19459
|
+
className: "univer-w-full",
|
|
19460
|
+
value: setting.pageOrient == null ? "" : `${setting.pageOrient}`,
|
|
19461
|
+
options: [
|
|
19462
|
+
...setting.pageOrient == null ? [{
|
|
19463
|
+
label: localeService.t("docs-ui.doc.sectionSetting.multipleValues"),
|
|
19464
|
+
value: "",
|
|
19465
|
+
disabled: true
|
|
19466
|
+
}] : [],
|
|
19467
|
+
{
|
|
19468
|
+
label: localeService.t("docs-ui.page-settings.portrait"),
|
|
19469
|
+
value: `${_univerjs_core.PageOrientType.PORTRAIT}`
|
|
19470
|
+
},
|
|
19471
|
+
{
|
|
19472
|
+
label: localeService.t("docs-ui.page-settings.landscape"),
|
|
19473
|
+
value: `${_univerjs_core.PageOrientType.LANDSCAPE}`
|
|
19474
|
+
}
|
|
19475
|
+
],
|
|
19476
|
+
onChange: (value) => setting.setPageOrient(Number(value))
|
|
19477
|
+
})
|
|
19478
|
+
}),
|
|
19479
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19480
|
+
label: localeService.t("docs-ui.page-settings.top"),
|
|
19481
|
+
unit: " (px)",
|
|
19482
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19483
|
+
"aria-label": localeService.t("docs-ui.page-settings.top"),
|
|
19484
|
+
className: "univer-w-full",
|
|
19485
|
+
min: 0,
|
|
19486
|
+
step: 1,
|
|
19487
|
+
precision: 1,
|
|
19488
|
+
value: setting.marginTop,
|
|
19489
|
+
onChange: (value) => value != null && setting.setMarginTop(value)
|
|
19490
|
+
})
|
|
19491
|
+
}),
|
|
19492
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19493
|
+
label: localeService.t("docs-ui.page-settings.bottom"),
|
|
19494
|
+
unit: " (px)",
|
|
19495
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19496
|
+
"aria-label": localeService.t("docs-ui.page-settings.bottom"),
|
|
19497
|
+
className: "univer-w-full",
|
|
19498
|
+
min: 0,
|
|
19499
|
+
step: 1,
|
|
19500
|
+
precision: 1,
|
|
19501
|
+
value: setting.marginBottom,
|
|
19502
|
+
onChange: (value) => value != null && setting.setMarginBottom(value)
|
|
19503
|
+
})
|
|
19504
|
+
}),
|
|
19505
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19506
|
+
label: localeService.t("docs-ui.page-settings.left"),
|
|
19507
|
+
unit: " (px)",
|
|
19508
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19509
|
+
"aria-label": localeService.t("docs-ui.page-settings.left"),
|
|
19510
|
+
className: "univer-w-full",
|
|
19511
|
+
min: 0,
|
|
19512
|
+
step: 1,
|
|
19513
|
+
precision: 1,
|
|
19514
|
+
value: setting.marginLeft,
|
|
19515
|
+
onChange: (value) => value != null && setting.setMarginLeft(value)
|
|
19516
|
+
})
|
|
19517
|
+
}),
|
|
19518
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19519
|
+
label: localeService.t("docs-ui.page-settings.right"),
|
|
19520
|
+
unit: " (px)",
|
|
19521
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19522
|
+
"aria-label": localeService.t("docs-ui.page-settings.right"),
|
|
19523
|
+
className: "univer-w-full",
|
|
19524
|
+
min: 0,
|
|
19525
|
+
step: 1,
|
|
19526
|
+
precision: 1,
|
|
19527
|
+
value: setting.marginRight,
|
|
19528
|
+
onChange: (value) => value != null && setting.setMarginRight(value)
|
|
19529
|
+
})
|
|
19530
|
+
}),
|
|
19531
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
19532
|
+
label: localeService.t("docs-ui.doc.sectionSetting.pageNumberStart"),
|
|
19533
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
19534
|
+
"aria-label": localeService.t("docs-ui.doc.sectionSetting.pageNumberStart"),
|
|
19535
|
+
className: "univer-w-full",
|
|
19536
|
+
min: 1,
|
|
19537
|
+
step: 1,
|
|
19538
|
+
precision: 0,
|
|
19539
|
+
value: setting.pageNumberStart,
|
|
19540
|
+
onChange: (value) => value != null && setting.setPageNumberStart(value)
|
|
19541
|
+
})
|
|
18829
19542
|
})
|
|
18830
19543
|
]
|
|
18831
19544
|
})]
|
|
@@ -18930,6 +19643,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
18930
19643
|
AddImageIcon: _univerjs_icons.AddImageIcon,
|
|
18931
19644
|
BoldIcon: _univerjs_icons.BoldIcon,
|
|
18932
19645
|
CopyDoubleIcon: _univerjs_icons.CopyDoubleIcon,
|
|
19646
|
+
ColumnIcon: _univerjs_icons.ColumnIcon,
|
|
18933
19647
|
CutIcon: _univerjs_icons.CutIcon,
|
|
18934
19648
|
DeleteColumnDoubleIcon: _univerjs_icons.DeleteColumnDoubleIcon,
|
|
18935
19649
|
DeleteIcon: _univerjs_icons.DeleteIcon,
|
|
@@ -18965,9 +19679,11 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
18965
19679
|
RightInsertColumnDoubleIcon: _univerjs_icons.RightInsertColumnDoubleIcon,
|
|
18966
19680
|
RightJustifyingIcon: _univerjs_icons.RightJustifyingIcon,
|
|
18967
19681
|
ShapeIcon: _univerjs_icons.ShapeIcon,
|
|
19682
|
+
SmileIcon: _univerjs_icons.SmileIcon,
|
|
18968
19683
|
StrikethroughIcon: _univerjs_icons.StrikethroughIcon,
|
|
18969
19684
|
SubscriptIcon: _univerjs_icons.SubscriptIcon,
|
|
18970
19685
|
SuperscriptIcon: _univerjs_icons.SuperscriptIcon,
|
|
19686
|
+
SymbolsIcon: _univerjs_icons.SymbolsIcon,
|
|
18971
19687
|
TitleTypeIcon,
|
|
18972
19688
|
SubtitleTypeIcon,
|
|
18973
19689
|
TodoListDoubleIcon: _univerjs_icons.TodoListDoubleIcon,
|
|
@@ -19069,7 +19785,7 @@ let DocAutoFormatController = class DocAutoFormatController extends _univerjs_co
|
|
|
19069
19785
|
match: (context) => {
|
|
19070
19786
|
const { selection, unit } = context;
|
|
19071
19787
|
const { startNodePosition, endNodePosition } = selection;
|
|
19072
|
-
const renderObject = this._renderManagerService.
|
|
19788
|
+
const renderObject = this._renderManagerService.getRenderUnitById(unit.getUnitId());
|
|
19073
19789
|
const skeleton = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
19074
19790
|
if (skeleton == null) return false;
|
|
19075
19791
|
if (startNodePosition && endNodePosition && isInSameTableCellData(skeleton, startNodePosition, endNodePosition)) return true;
|
|
@@ -19207,9 +19923,10 @@ var TextBubbleShape = class TextBubbleShape extends _univerjs_engine_render.Shap
|
|
|
19207
19923
|
ctx.save();
|
|
19208
19924
|
ctx.font = "13px Source Han Sans CN";
|
|
19209
19925
|
const textWidth = ctx.measureText(text).width;
|
|
19926
|
+
const realInfoWidth = Math.min(textWidth + 2 * 6, 200);
|
|
19210
19927
|
drawBubble(ctx, {
|
|
19211
19928
|
height: 18,
|
|
19212
|
-
width:
|
|
19929
|
+
width: realInfoWidth,
|
|
19213
19930
|
radius: 4,
|
|
19214
19931
|
fill: color,
|
|
19215
19932
|
evented: false
|
|
@@ -19530,13 +20247,14 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19530
20247
|
}));
|
|
19531
20248
|
}
|
|
19532
20249
|
_handleShiftMoveSelection(direction, granularity = "character") {
|
|
19533
|
-
var
|
|
20250
|
+
var _docDataModel$getSelf, _body$dataStream$leng, _docDataModel$getCust;
|
|
19534
20251
|
const activeRange = this._textSelectionManagerService.getActiveTextRange();
|
|
19535
20252
|
const allRanges = this._textSelectionManagerService.getTextRanges();
|
|
19536
20253
|
const docDataModel = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
19537
20254
|
if (docDataModel == null) return;
|
|
19538
|
-
const
|
|
19539
|
-
const
|
|
20255
|
+
const currentRender = this._renderManagerService.getRenderUnitById(docDataModel.getUnitId());
|
|
20256
|
+
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
20257
|
+
const docObject = currentRender ? neoGetDocObject(currentRender) : null;
|
|
19540
20258
|
if (activeRange == null || skeleton == null || docObject == null) return;
|
|
19541
20259
|
const { startOffset, endOffset, style, collapsed, direction: rangeDirection, segmentId, startNodePosition, endNodePosition, segmentPage } = activeRange;
|
|
19542
20260
|
const normalizedSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : "";
|
|
@@ -19548,11 +20266,11 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19548
20266
|
min = Math.min(min, range.startOffset);
|
|
19549
20267
|
max = Math.max(max, range.endOffset);
|
|
19550
20268
|
}
|
|
19551
|
-
this._textSelectionManagerService.
|
|
20269
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19552
20270
|
startOffset: direction === _univerjs_core.Direction.LEFT || direction === _univerjs_core.Direction.UP ? max : min,
|
|
19553
20271
|
endOffset: direction === _univerjs_core.Direction.LEFT || direction === _univerjs_core.Direction.UP ? min : max,
|
|
19554
20272
|
style
|
|
19555
|
-
}], false);
|
|
20273
|
+
}], void 0, false);
|
|
19556
20274
|
return;
|
|
19557
20275
|
}
|
|
19558
20276
|
const anchorOffset = collapsed ? startOffset : rangeDirection === _univerjs_core.RANGE_DIRECTION.FORWARD ? startOffset : endOffset;
|
|
@@ -19566,11 +20284,11 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19566
20284
|
if (nextOffset == null || nextOffset === focusOffset) return;
|
|
19567
20285
|
const normalizedNextOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, nextOffset, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19568
20286
|
if (normalizedNextOffset == null || normalizedNextOffset === focusOffset) return;
|
|
19569
|
-
this._textSelectionManagerService.
|
|
20287
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19570
20288
|
startOffset: anchorOffset,
|
|
19571
20289
|
endOffset: normalizedNextOffset,
|
|
19572
20290
|
style
|
|
19573
|
-
}], false);
|
|
20291
|
+
}], void 0, false);
|
|
19574
20292
|
this._scrollToFocusNodePosition(docDataModel.getUnitId(), normalizedNextOffset);
|
|
19575
20293
|
return;
|
|
19576
20294
|
}
|
|
@@ -19580,11 +20298,11 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19580
20298
|
const curGlyph = skeleton.findNodeByCharIndex(focusOffset, segmentId, segmentPage);
|
|
19581
20299
|
focusOffset = direction === _univerjs_core.Direction.RIGHT ? focusOffset + curGlyph.count : focusOffset - ((_preGlyph$count = preGlyph === null || preGlyph === void 0 ? void 0 : preGlyph.count) !== null && _preGlyph$count !== void 0 ? _preGlyph$count : 0);
|
|
19582
20300
|
focusOffset = Math.min(dataStreamLength - 2, Math.max(0, focusOffset));
|
|
19583
|
-
this._textSelectionManagerService.
|
|
20301
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19584
20302
|
startOffset: anchorOffset,
|
|
19585
20303
|
endOffset: focusOffset,
|
|
19586
20304
|
style
|
|
19587
|
-
}], false);
|
|
20305
|
+
}], void 0, false);
|
|
19588
20306
|
this._scrollToFocusNodePosition(docDataModel.getUnitId(), focusOffset);
|
|
19589
20307
|
} else {
|
|
19590
20308
|
const focusGlyph = skeleton.findNodeByCharIndex(focusOffset, segmentId, segmentPage);
|
|
@@ -19594,32 +20312,33 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19594
20312
|
if (newPos == null) {
|
|
19595
20313
|
const newFocusOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === _univerjs_core.Direction.UP ? 0 : dataStreamLength - 2, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19596
20314
|
if (newFocusOffset == null || newFocusOffset === focusOffset) return;
|
|
19597
|
-
this._textSelectionManagerService.
|
|
20315
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19598
20316
|
startOffset: anchorOffset,
|
|
19599
20317
|
endOffset: newFocusOffset,
|
|
19600
20318
|
style
|
|
19601
|
-
}], false);
|
|
20319
|
+
}], void 0, false);
|
|
19602
20320
|
return;
|
|
19603
20321
|
}
|
|
19604
20322
|
const newActiveRange = new NodePositionConvertToCursor(documentOffsetConfig, skeleton).getRangePointData(newPos, newPos).cursorList[0];
|
|
19605
20323
|
const newFocusOffset = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, newActiveRange.endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19606
20324
|
if (newFocusOffset == null || newFocusOffset === focusOffset) return;
|
|
19607
|
-
this._textSelectionManagerService.
|
|
20325
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19608
20326
|
startOffset: anchorOffset,
|
|
19609
20327
|
endOffset: newFocusOffset,
|
|
19610
20328
|
style
|
|
19611
|
-
}], false);
|
|
20329
|
+
}], void 0, false);
|
|
19612
20330
|
this._scrollToFocusNodePosition(docDataModel.getUnitId(), newFocusOffset);
|
|
19613
20331
|
}
|
|
19614
20332
|
}
|
|
19615
20333
|
_handleMoveCursor(direction, granularity = "character") {
|
|
19616
|
-
var
|
|
20334
|
+
var _docDataModel$getSelf2, _body$dataStream$leng2, _docDataModel$getCust2;
|
|
19617
20335
|
const activeRange = this._textSelectionManagerService.getActiveTextRange();
|
|
19618
20336
|
const allRanges = this._textSelectionManagerService.getTextRanges();
|
|
19619
20337
|
const docDataModel = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
19620
20338
|
if (docDataModel == null) return false;
|
|
19621
|
-
const
|
|
19622
|
-
const
|
|
20339
|
+
const currentRender = this._renderManagerService.getRenderUnitById(docDataModel.getUnitId());
|
|
20340
|
+
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
20341
|
+
const docObject = currentRender ? neoGetDocObject(currentRender) : null;
|
|
19623
20342
|
if (activeRange == null || skeleton == null || docObject == null || allRanges == null) return;
|
|
19624
20343
|
const { startOffset, endOffset, style, collapsed, segmentId, startNodePosition, endNodePosition, segmentPage } = activeRange;
|
|
19625
20344
|
const normalizedSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : "";
|
|
@@ -19643,11 +20362,11 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19643
20362
|
if (cursor == null) return;
|
|
19644
20363
|
cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, cursor, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19645
20364
|
if (cursor == null) return;
|
|
19646
|
-
this._textSelectionManagerService.
|
|
20365
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19647
20366
|
startOffset: cursor,
|
|
19648
20367
|
endOffset: cursor,
|
|
19649
20368
|
style
|
|
19650
|
-
}], false);
|
|
20369
|
+
}], void 0, false);
|
|
19651
20370
|
this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
|
|
19652
20371
|
return;
|
|
19653
20372
|
}
|
|
@@ -19676,11 +20395,11 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19676
20395
|
cursor = this._normalizeCursorOffset(body.dataStream, customRanges, cursor, direction);
|
|
19677
20396
|
const normalizedCursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, cursor, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19678
20397
|
if (normalizedCursor == null) return;
|
|
19679
|
-
this._textSelectionManagerService.
|
|
20398
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19680
20399
|
startOffset: normalizedCursor,
|
|
19681
20400
|
endOffset: normalizedCursor,
|
|
19682
20401
|
style
|
|
19683
|
-
}], false);
|
|
20402
|
+
}], void 0, false);
|
|
19684
20403
|
this._scrollToFocusNodePosition(docDataModel.getUnitId(), normalizedCursor);
|
|
19685
20404
|
} else {
|
|
19686
20405
|
const startNode = skeleton.findNodeByCharIndex(startOffset, segmentId, segmentPage);
|
|
@@ -19692,21 +20411,21 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
19692
20411
|
if (collapsed) cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === _univerjs_core.Direction.UP ? 0 : dataStreamLength - 2, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19693
20412
|
else cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, direction === _univerjs_core.Direction.UP ? startOffset : endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19694
20413
|
if (cursor == null) return;
|
|
19695
|
-
this._textSelectionManagerService.
|
|
20414
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19696
20415
|
startOffset: cursor,
|
|
19697
20416
|
endOffset: cursor,
|
|
19698
20417
|
style
|
|
19699
|
-
}], false);
|
|
20418
|
+
}], void 0, false);
|
|
19700
20419
|
return;
|
|
19701
20420
|
}
|
|
19702
20421
|
const newActiveRange = new NodePositionConvertToCursor(documentOffsetConfig, skeleton).getRangePointData(newPos, newPos).cursorList[0];
|
|
19703
20422
|
const cursor = this._normalizeRenderableCursorOffset(skeleton, body.dataStream, customRanges, newActiveRange.endOffset, direction, normalizedSegmentId, normalizedSegmentPage);
|
|
19704
20423
|
if (cursor == null) return;
|
|
19705
|
-
this._textSelectionManagerService.
|
|
20424
|
+
this._textSelectionManagerService.replaceDocRanges([{
|
|
19706
20425
|
startOffset: cursor,
|
|
19707
20426
|
endOffset: cursor,
|
|
19708
20427
|
style
|
|
19709
|
-
}], false);
|
|
20428
|
+
}], void 0, false);
|
|
19710
20429
|
this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
|
|
19711
20430
|
}
|
|
19712
20431
|
}
|
|
@@ -20157,8 +20876,8 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
20157
20876
|
return (parent === null || parent === void 0 ? void 0 : parent.page) === page && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 || (_parent$parent = _parent$parent.columns) === null || _parent$parent === void 0 ? void 0 : _parent$parent.includes(parent)) === true;
|
|
20158
20877
|
}
|
|
20159
20878
|
_scrollToFocusNodePosition(unitId, offset) {
|
|
20160
|
-
var _this$
|
|
20161
|
-
const backScrollController = (_this$
|
|
20879
|
+
var _this$_renderManagerS;
|
|
20880
|
+
const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
|
|
20162
20881
|
if (backScrollController == null) return;
|
|
20163
20882
|
backScrollController.scrollToRange({
|
|
20164
20883
|
startOffset: offset,
|
|
@@ -20166,9 +20885,6 @@ let DocMoveCursorController = class DocMoveCursorController extends _univerjs_co
|
|
|
20166
20885
|
collapsed: true
|
|
20167
20886
|
});
|
|
20168
20887
|
}
|
|
20169
|
-
_getDocObject() {
|
|
20170
|
-
return getDocObject(this._univerInstanceService, this._renderManagerService);
|
|
20171
|
-
}
|
|
20172
20888
|
};
|
|
20173
20889
|
DocMoveCursorController = __decorate([
|
|
20174
20890
|
__decorateParam(0, _univerjs_core.IUniverInstanceService),
|
|
@@ -20436,7 +21152,7 @@ let DocEditorBridgeController = class DocEditorBridgeController extends _univerj
|
|
|
20436
21152
|
disposableCollection.dispose();
|
|
20437
21153
|
if (!unit) return;
|
|
20438
21154
|
const unitId = unit.getUnitId();
|
|
20439
|
-
const render = this._renderManagerService.
|
|
21155
|
+
const render = this._renderManagerService.getRenderUnitById(unitId);
|
|
20440
21156
|
const canvasEle = render === null || render === void 0 ? void 0 : render.engine.getCanvas().getCanvasEle();
|
|
20441
21157
|
if (canvasEle == null) return;
|
|
20442
21158
|
const disposable = (0, rxjs.fromEvent)(canvasEle, "mousedown").subscribe((evt) => {
|
|
@@ -20455,8 +21171,8 @@ let DocEditorBridgeController = class DocEditorBridgeController extends _univerj
|
|
|
20455
21171
|
if (updateCommandList.includes(command.id)) {
|
|
20456
21172
|
const { unitId } = command.params;
|
|
20457
21173
|
if (this._editorService.isSheetEditor(unitId) || unitId !== this._context.unitId) return;
|
|
20458
|
-
const
|
|
20459
|
-
if (
|
|
21174
|
+
const editorRenderConfig = this._editorService.getEditorRenderConfig(unitId);
|
|
21175
|
+
if (editorRenderConfig && !editorRenderConfig.scrollBar) this._resize(unitId);
|
|
20460
21176
|
}
|
|
20461
21177
|
}));
|
|
20462
21178
|
}
|
|
@@ -20921,7 +21637,7 @@ let DocZoomRenderController = class DocZoomRenderController extends _univerjs_co
|
|
|
20921
21637
|
this._initCommandExecutedListener();
|
|
20922
21638
|
this._isSheetEditor = this._context.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
20923
21639
|
const currentSheet = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
20924
|
-
const sheetRenderer = currentSheet && this._renderManagerService.
|
|
21640
|
+
const sheetRenderer = currentSheet && this._renderManagerService.getRenderUnitById(currentSheet.getUnitId());
|
|
20925
21641
|
this._initTimer = window.setTimeout(() => {
|
|
20926
21642
|
const zoomRatio = sheetRenderer && this._isSheetEditor ? sheetRenderer.scene.scaleX : getDocEffectiveZoomRatio(this._context.unit);
|
|
20927
21643
|
this.updateViewZoom(zoomRatio, true);
|
|
@@ -21087,7 +21803,6 @@ let DocsRenderService = class DocsRenderService extends _univerjs_core.RxDisposa
|
|
|
21087
21803
|
this._init();
|
|
21088
21804
|
}
|
|
21089
21805
|
_init() {
|
|
21090
|
-
this._renderManagerService.createRender$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((unitId) => this._createRenderWithId(unitId));
|
|
21091
21806
|
this._instanceSrv.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_DOC).forEach((documentModel) => {
|
|
21092
21807
|
var _this$_instanceSrv$ge;
|
|
21093
21808
|
return this._createRenderer(documentModel, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(documentModel.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
|
|
@@ -21102,7 +21817,7 @@ let DocsRenderService = class DocsRenderService extends _univerjs_core.RxDisposa
|
|
|
21102
21817
|
this._createRenderWithId(unitId, doc);
|
|
21103
21818
|
return;
|
|
21104
21819
|
}
|
|
21105
|
-
const renderer = this._renderManagerService.
|
|
21820
|
+
const renderer = this._renderManagerService.getRenderUnitById(unitId);
|
|
21106
21821
|
if (renderer) this._syncRendererCanvas(renderer, doc);
|
|
21107
21822
|
}
|
|
21108
21823
|
_createRenderWithId(unitId, doc) {
|
|
@@ -21364,18 +22079,20 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends _univerjs_core.Plugin
|
|
|
21364
22079
|
DocParagraphSettingCommand,
|
|
21365
22080
|
InnerPasteCommand,
|
|
21366
22081
|
CutContentCommand,
|
|
21367
|
-
ReplaceContentCommand,
|
|
21368
22082
|
ReplaceSnapshotCommand,
|
|
21369
22083
|
CoverContentCommand,
|
|
21370
22084
|
SetDocZoomRatioCommand,
|
|
21371
22085
|
DocSelectAllCommand,
|
|
21372
22086
|
DocParagraphSettingPanelOperation,
|
|
21373
22087
|
DocSectionSettingPanelOperation,
|
|
22088
|
+
InsertDocumentColumnBreakOperation,
|
|
22089
|
+
InsertDocumentSectionBreakOperation,
|
|
21374
22090
|
MoveCursorOperation,
|
|
21375
22091
|
MoveSelectionOperation,
|
|
21376
22092
|
ReplaceTextRunsCommand,
|
|
21377
22093
|
ReplaceSelectionCommand,
|
|
21378
22094
|
InsertCustomRangeCommand,
|
|
22095
|
+
InsertSpecialCharacterCommand,
|
|
21379
22096
|
SetParagraphNamedStyleCommand,
|
|
21380
22097
|
QuickHeadingCommand,
|
|
21381
22098
|
DocCopyCurrentParagraphCommand,
|
|
@@ -21519,7 +22236,7 @@ _defineProperty(UniverDocsUIPlugin, "pluginName", "DOC_UI_PLUGIN");
|
|
|
21519
22236
|
_defineProperty(UniverDocsUIPlugin, "packageName", name);
|
|
21520
22237
|
_defineProperty(UniverDocsUIPlugin, "version", version);
|
|
21521
22238
|
UniverDocsUIPlugin = __decorate([
|
|
21522
|
-
(0, _univerjs_core.DependentOn)(
|
|
22239
|
+
(0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_render.UniverRenderEnginePlugin),
|
|
21523
22240
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
21524
22241
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
21525
22242
|
__decorateParam(3, _univerjs_core.ICommandService),
|
|
@@ -21600,7 +22317,7 @@ function useEditor(opts) {
|
|
|
21600
22317
|
const editorService = (0, _univerjs_ui.useDependency)(IEditorService);
|
|
21601
22318
|
(0, react.useLayoutEffect)(() => {
|
|
21602
22319
|
if (container.current) {
|
|
21603
|
-
const initialDoc = typeof initialValue === "string" ?
|
|
22320
|
+
const initialDoc = typeof initialValue === "string" ? _univerjs_core.RichTextBuilder.create().insertText(initialValue).getData() : _univerjs_core.Tools.deepClone(initialValue);
|
|
21604
22321
|
const snapshot = {
|
|
21605
22322
|
body: {
|
|
21606
22323
|
dataStream: typeof initialValue === "string" ? `${initialValue}\r\n` : "\r\n",
|
|
@@ -21693,7 +22410,7 @@ const useEditorClickOutside = (editorId, containerRef, onClickOutside) => {
|
|
|
21693
22410
|
*/
|
|
21694
22411
|
function useIsFocusing(editorId) {
|
|
21695
22412
|
var _docSelectionRenderSe;
|
|
21696
|
-
const renderer = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).
|
|
22413
|
+
const renderer = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(editorId);
|
|
21697
22414
|
const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
|
|
21698
22415
|
const selections = (0, _univerjs_ui.useObservable)(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.textSelectionInner$);
|
|
21699
22416
|
return Boolean(((_docSelectionRenderSe = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : false) && (selections === null || selections === void 0 ? void 0 : selections.textRanges.some((r) => r.collapsed)));
|
|
@@ -21707,7 +22424,8 @@ function useKeyboardEvent(isNeed, config, editor) {
|
|
|
21707
22424
|
const key = (0, react.useMemo)(() => (0, _univerjs_core.generateRandomId)(4), []);
|
|
21708
22425
|
(0, react.useEffect)(() => {
|
|
21709
22426
|
if (!editor || !isNeed || !config) return;
|
|
21710
|
-
const
|
|
22427
|
+
const editorId = editor.getEditorId();
|
|
22428
|
+
const operationId = `sheet.operation.editor-${editorId}-keyboard-${key}`;
|
|
21711
22429
|
const d = new _univerjs_core.DisposableCollection();
|
|
21712
22430
|
d.add(commandService.registerCommand({
|
|
21713
22431
|
id: operationId,
|
|
@@ -21721,6 +22439,8 @@ function useKeyboardEvent(isNeed, config, editor) {
|
|
|
21721
22439
|
return {
|
|
21722
22440
|
id: operationId,
|
|
21723
22441
|
binding: keyCode.metaKey ? keyCode.keyCode | keyCode.metaKey : keyCode.keyCode,
|
|
22442
|
+
eventPreconditions: keyCode.nativeTextEditorBehavior == null ? void 0 : (event) => event.target instanceof HTMLElement && event.target.id === `__editor_${editorId}`,
|
|
22443
|
+
nativeTextEditorBehavior: keyCode.nativeTextEditorBehavior,
|
|
21724
22444
|
preconditions: () => true,
|
|
21725
22445
|
priority: 901,
|
|
21726
22446
|
staticParameters: {
|
|
@@ -21996,7 +22716,7 @@ const RichTextEditor = (props) => {
|
|
|
21996
22716
|
autoFocus,
|
|
21997
22717
|
isSingle
|
|
21998
22718
|
});
|
|
21999
|
-
const renderer = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).
|
|
22719
|
+
const renderer = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(editorId);
|
|
22000
22720
|
const selectionIsFocusing = useIsFocusing(editorId);
|
|
22001
22721
|
const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
|
|
22002
22722
|
const editorFocused = (0, _univerjs_ui.useObservable)(editor ? () => {
|
|
@@ -22109,6 +22829,8 @@ exports.DOCS_COMPONENT_MAIN_LAYER_INDEX = DOCS_COMPONENT_MAIN_LAYER_INDEX;
|
|
|
22109
22829
|
exports.DOCS_UI_PLUGIN_CONFIG_KEY = DOCS_UI_PLUGIN_CONFIG_KEY;
|
|
22110
22830
|
exports.DOCS_VIEW_KEY = DOCS_VIEW_KEY;
|
|
22111
22831
|
exports.DOC_CONTENT_INSERT_MENU_ID = DOC_CONTENT_INSERT_MENU_ID;
|
|
22832
|
+
exports.DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA = DOC_CUSTOM_RANGE_CHROME_BACKGROUND_ALPHA;
|
|
22833
|
+
exports.DOC_CUSTOM_RANGE_CHROME_RADIUS = DOC_CUSTOM_RANGE_CHROME_RADIUS;
|
|
22112
22834
|
exports.DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = DOC_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE;
|
|
22113
22835
|
exports.DOC_PARAGRAPH_T_ALIGN_MENU_ID = DOC_PARAGRAPH_T_ALIGN_MENU_ID;
|
|
22114
22836
|
exports.DOC_PARAGRAPH_T_COLORS_MENU_ID = DOC_PARAGRAPH_T_COLORS_MENU_ID;
|
|
@@ -22220,12 +22942,6 @@ Object.defineProperty(exports, 'DocsRenderService', {
|
|
|
22220
22942
|
}
|
|
22221
22943
|
});
|
|
22222
22944
|
exports.DocsUIMenuSchema = menuSchema;
|
|
22223
|
-
Object.defineProperty(exports, 'EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY', {
|
|
22224
|
-
enumerable: true,
|
|
22225
|
-
get: function () {
|
|
22226
|
-
return _univerjs_docs.EMBED_DOCS_CUSTOM_BLOCK_DEFAULT_COMPONENT_KEY;
|
|
22227
|
-
}
|
|
22228
|
-
});
|
|
22229
22945
|
exports.EMPTY_PARAGRAPH_MENU_ID = EMPTY_PARAGRAPH_MENU_ID;
|
|
22230
22946
|
exports.Editor = Editor;
|
|
22231
22947
|
Object.defineProperty(exports, 'EditorService', {
|
|
@@ -22266,7 +22982,6 @@ exports.PastePluginUniver = UniverPastePlugin;
|
|
|
22266
22982
|
exports.PastePluginWord = WordPastePlugin;
|
|
22267
22983
|
exports.QuickListCommand = QuickListCommand;
|
|
22268
22984
|
exports.RectRange = RectRange;
|
|
22269
|
-
exports.ReplaceContentCommand = ReplaceContentCommand;
|
|
22270
22985
|
exports.ReplaceSelectionCommand = ReplaceSelectionCommand;
|
|
22271
22986
|
exports.ReplaceSnapshotCommand = ReplaceSnapshotCommand;
|
|
22272
22987
|
exports.ReplaceTextRunsCommand = ReplaceTextRunsCommand;
|
|
@@ -22312,40 +23027,11 @@ exports.collectDocsTableLikeEmbedChildUnitIds = collectDocsTableLikeEmbedChildUn
|
|
|
22312
23027
|
exports.convertBodyToHtml = convertBodyToHtml;
|
|
22313
23028
|
exports.convertPositionsToRectRanges = convertPositionsToRectRanges;
|
|
22314
23029
|
exports.createDefaultDocsTableLikeCustomBlockBleedViewport = createDefaultDocsTableLikeCustomBlockBleedViewport;
|
|
22315
|
-
Object.defineProperty(exports, 'createDocsCustomBlockInsertMutation', {
|
|
22316
|
-
enumerable: true,
|
|
22317
|
-
get: function () {
|
|
22318
|
-
return _univerjs_docs.createDocsCustomBlockInsertMutation;
|
|
22319
|
-
}
|
|
22320
|
-
});
|
|
22321
|
-
Object.defineProperty(exports, 'createDocsCustomBlockRemoveMutation', {
|
|
22322
|
-
enumerable: true,
|
|
22323
|
-
get: function () {
|
|
22324
|
-
return _univerjs_docs.createDocsCustomBlockRemoveMutation;
|
|
22325
|
-
}
|
|
22326
|
-
});
|
|
22327
23030
|
exports.createDocsCustomBlockSizeRefreshScheduler = createDocsCustomBlockSizeRefreshScheduler;
|
|
22328
23031
|
exports.createEditorUndoRedoKeyboardConfig = createEditorUndoRedoKeyboardConfig;
|
|
22329
|
-
Object.defineProperty(exports, 'createEmbedDocsCustomBlockData', {
|
|
22330
|
-
enumerable: true,
|
|
22331
|
-
get: function () {
|
|
22332
|
-
return _univerjs_docs.createEmbedDocsCustomBlockData;
|
|
22333
|
-
}
|
|
22334
|
-
});
|
|
22335
|
-
Object.defineProperty(exports, 'createInsertCustomBlockActions', {
|
|
22336
|
-
enumerable: true,
|
|
22337
|
-
get: function () {
|
|
22338
|
-
return _univerjs_docs.createInsertCustomBlockActions;
|
|
22339
|
-
}
|
|
22340
|
-
});
|
|
22341
|
-
Object.defineProperty(exports, 'createRemoveCustomBlockActions', {
|
|
22342
|
-
enumerable: true,
|
|
22343
|
-
get: function () {
|
|
22344
|
-
return _univerjs_docs.createRemoveCustomBlockActions;
|
|
22345
|
-
}
|
|
22346
|
-
});
|
|
22347
23032
|
exports.deleteCustomDecorationFactory = deleteCustomDecorationFactory;
|
|
22348
23033
|
exports.disableMenuWhenHeaderFooterEditing = disableMenuWhenHeaderFooterEditing;
|
|
23034
|
+
exports.drawDocCustomRangeChrome = drawDocCustomRangeChrome;
|
|
22349
23035
|
exports.executeEditorUndoRedoCommand = executeEditorUndoRedoCommand;
|
|
22350
23036
|
exports.genTableSource = genTableSource;
|
|
22351
23037
|
exports.generateParagraphs = _univerjs_docs.generateParagraphs;
|
|
@@ -22355,7 +23041,6 @@ exports.getCommandSkeleton = getCommandSkeleton;
|
|
|
22355
23041
|
exports.getCursorWhenDelete = getCursorWhenDelete;
|
|
22356
23042
|
exports.getCutActionsFromDocRanges = getCutActionsFromDocRanges;
|
|
22357
23043
|
exports.getDocBlockRangeMenuId = getDocBlockRangeMenuId;
|
|
22358
|
-
exports.getDocObject = getDocObject;
|
|
22359
23044
|
exports.getDocObjectById = getDocObjectById;
|
|
22360
23045
|
exports.getEmptyTableCell = getEmptyTableCell;
|
|
22361
23046
|
exports.getEmptyTableRow = getEmptyTableRow;
|
|
@@ -22365,28 +23050,18 @@ exports.getListParagraphContextMenuHit = getListParagraphContextMenuHit;
|
|
|
22365
23050
|
exports.getOneTextSelectionRange = getOneTextSelectionRange;
|
|
22366
23051
|
exports.getStyleInTextRange = getStyleInTextRange;
|
|
22367
23052
|
exports.getTableColumn = getTableColumn;
|
|
23053
|
+
exports.getTextRangeFromCharIndex = getTextRangeFromCharIndex;
|
|
22368
23054
|
exports.hasParagraphInTable = hasParagraphInTable;
|
|
22369
23055
|
exports.hideMenuWhenSelectionInBlockRange = hideMenuWhenSelectionInBlockRange;
|
|
22370
23056
|
exports.isInSameTableCell = isInSameTableCell;
|
|
22371
|
-
Object.defineProperty(exports, 'isSheetLikeDocsCustomBlockChildType', {
|
|
22372
|
-
enumerable: true,
|
|
22373
|
-
get: function () {
|
|
22374
|
-
return _univerjs_docs.isSheetLikeDocsCustomBlockChildType;
|
|
22375
|
-
}
|
|
22376
|
-
});
|
|
22377
23057
|
exports.isTextRangeInAnyBlockRange = isTextRangeInAnyBlockRange;
|
|
22378
23058
|
exports.isValidRectRange = isValidRectRange;
|
|
22379
23059
|
exports.neoGetDocObject = neoGetDocObject;
|
|
22380
23060
|
exports.normalizeDocFitToWidthOptions = normalizeDocFitToWidthOptions;
|
|
23061
|
+
exports.resolveDocCustomRangeChromeTheme = resolveDocCustomRangeChromeTheme;
|
|
22381
23062
|
exports.resolveDocFitBaseWidth = resolveDocFitBaseWidth;
|
|
22382
23063
|
exports.resolveDocViewScale = resolveDocViewScale;
|
|
22383
23064
|
exports.resolveDocsCustomBlockRenderViewport = resolveDocsCustomBlockRenderViewport;
|
|
22384
|
-
Object.defineProperty(exports, 'resolveDocsCustomBlockSize', {
|
|
22385
|
-
enumerable: true,
|
|
22386
|
-
get: function () {
|
|
22387
|
-
return _univerjs_docs.resolveDocsCustomBlockSize;
|
|
22388
|
-
}
|
|
22389
|
-
});
|
|
22390
23065
|
exports.resolveDocsTableLikeCustomBlockBleedViewport = resolveDocsTableLikeCustomBlockBleedViewport;
|
|
22391
23066
|
exports.resolveDocsTableLikeCustomBlockContentHeight = resolveDocsTableLikeCustomBlockContentHeight;
|
|
22392
23067
|
exports.resolveDocsTableLikeCustomBlockContentWidth = resolveDocsTableLikeCustomBlockContentWidth;
|