@univerjs/docs-ui 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +418 -318
- package/lib/cjs/locale/ar-SA.js +1 -0
- package/lib/cjs/locale/ca-ES.js +1 -0
- package/lib/cjs/locale/de-DE.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/es-ES.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/cjs/locale/id-ID.js +1 -0
- package/lib/cjs/locale/it-IT.js +1 -0
- package/lib/cjs/locale/ja-JP.js +1 -0
- package/lib/cjs/locale/ko-KR.js +1 -0
- package/lib/cjs/locale/pl-PL.js +1 -0
- package/lib/cjs/locale/pt-BR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/sk-SK.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-HK.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +422 -319
- package/lib/es/locale/ar-SA.js +1 -0
- package/lib/es/locale/ca-ES.js +1 -0
- package/lib/es/locale/de-DE.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/es-ES.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/id-ID.js +1 -0
- package/lib/es/locale/it-IT.js +1 -0
- package/lib/es/locale/ja-JP.js +1 -0
- package/lib/es/locale/ko-KR.js +1 -0
- package/lib/es/locale/pl-PL.js +1 -0
- package/lib/es/locale/pt-BR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/sk-SK.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-HK.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.js +422 -319
- package/lib/locale/ar-SA.js +1 -0
- package/lib/locale/ca-ES.js +1 -0
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/es-ES.js +1 -0
- package/lib/locale/fa-IR.js +1 -0
- package/lib/locale/fr-FR.js +1 -0
- package/lib/locale/id-ID.js +1 -0
- package/lib/locale/it-IT.js +1 -0
- package/lib/locale/ja-JP.js +1 -0
- package/lib/locale/ko-KR.js +1 -0
- package/lib/locale/pl-PL.js +1 -0
- package/lib/locale/pt-BR.js +1 -0
- package/lib/locale/ru-RU.js +1 -0
- package/lib/locale/sk-SK.js +1 -0
- package/lib/locale/vi-VN.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-HK.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -2
- package/lib/types/index.d.ts +1 -2
- package/lib/types/locale/en-US.d.ts +3 -0
- package/lib/types/plugin.d.ts +3 -4
- package/lib/types/services/float-menu.service.d.ts +1 -4
- package/lib/types/services/selection/doc-selection-render.service.d.ts +1 -0
- package/lib/types/views/float-toolbar/FloatToolbar.d.ts +1 -0
- package/lib/umd/index.js +9 -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/types/basics/transform-position.d.ts +0 -18
package/lib/cjs/index.js
CHANGED
|
@@ -200,34 +200,6 @@ function getCustomDecorationAtPosition(customDecorations, position) {
|
|
|
200
200
|
return customDecorations.filter((customDecoration) => position > customDecoration.startIndex && position <= customDecoration.endIndex);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/basics/transform-position.ts
|
|
205
|
-
function docDrawingPositionToTransform(position) {
|
|
206
|
-
return {
|
|
207
|
-
left: position.positionH.posOffset,
|
|
208
|
-
top: position.positionV.posOffset,
|
|
209
|
-
width: position.size.width,
|
|
210
|
-
height: position.size.height
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function transformToDocDrawingPosition(transform, marginLeft = 0, marginTop = 0) {
|
|
214
|
-
return {
|
|
215
|
-
size: {
|
|
216
|
-
width: transform.width,
|
|
217
|
-
height: transform.height
|
|
218
|
-
},
|
|
219
|
-
positionH: {
|
|
220
|
-
relativeFrom: _univerjs_core.ObjectRelativeFromH.MARGIN,
|
|
221
|
-
posOffset: (transform.left || 0) - marginLeft
|
|
222
|
-
},
|
|
223
|
-
positionV: {
|
|
224
|
-
relativeFrom: _univerjs_core.ObjectRelativeFromV.PAGE,
|
|
225
|
-
posOffset: (transform.top || 0) - marginTop
|
|
226
|
-
},
|
|
227
|
-
angle: transform.angle || 0
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
203
|
//#endregion
|
|
232
204
|
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
233
205
|
function _typeof(o) {
|
|
@@ -1099,19 +1071,6 @@ function getCellOffsets(viewModel, range, position) {
|
|
|
1099
1071
|
|
|
1100
1072
|
//#endregion
|
|
1101
1073
|
//#region src/commands/commands/clipboard.inner.command.ts
|
|
1102
|
-
function getCustomBlockIdsInSelections(body, selections) {
|
|
1103
|
-
const customBlockIds = [];
|
|
1104
|
-
const { customBlocks = [] } = body;
|
|
1105
|
-
for (const selection of selections) {
|
|
1106
|
-
const { startOffset, endOffset } = selection;
|
|
1107
|
-
if (startOffset == null || endOffset == null) continue;
|
|
1108
|
-
for (const customBlock of customBlocks) {
|
|
1109
|
-
const { startIndex } = customBlock;
|
|
1110
|
-
if (startIndex >= startOffset && startIndex < endOffset) customBlockIds.push(customBlock.blockId);
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
return customBlockIds;
|
|
1114
|
-
}
|
|
1115
1074
|
function hasRangeInTable(ranges) {
|
|
1116
1075
|
return ranges.some((range) => {
|
|
1117
1076
|
const { startNodePosition } = range;
|
|
@@ -1332,7 +1291,7 @@ function getCutActionsFromTextRanges(selections, docDataModel, segmentId) {
|
|
|
1332
1291
|
}
|
|
1333
1292
|
const path = (0, _univerjs_core.getRichTextEditPath)(docDataModel, segmentId);
|
|
1334
1293
|
rawActions.push(jsonX.editOp(textX.serialize(), path));
|
|
1335
|
-
const removedCustomBlockIds = getCustomBlockIdsInSelections(originBody, selections);
|
|
1294
|
+
const removedCustomBlockIds = (0, _univerjs_core.getCustomBlockIdsInSelections)(originBody, selections);
|
|
1336
1295
|
const drawings = (_docDataModel$getDraw = docDataModel.getDrawings()) !== null && _docDataModel$getDraw !== void 0 ? _docDataModel$getDraw : {};
|
|
1337
1296
|
const drawingOrder = (_docDataModel$getDraw2 = docDataModel.getDrawingsOrder()) !== null && _docDataModel$getDraw2 !== void 0 ? _docDataModel$getDraw2 : [];
|
|
1338
1297
|
const sortedRemovedCustomBlockIds = removedCustomBlockIds.sort((a, b) => {
|
|
@@ -2284,21 +2243,7 @@ var HtmlToUDMService = class HtmlToUDMService {
|
|
|
2284
2243
|
height,
|
|
2285
2244
|
left: 0
|
|
2286
2245
|
},
|
|
2287
|
-
docTransform:
|
|
2288
|
-
size: {
|
|
2289
|
-
width: docTransformWidth,
|
|
2290
|
-
height: docTransformHeight
|
|
2291
|
-
},
|
|
2292
|
-
angle: 0,
|
|
2293
|
-
positionH: {
|
|
2294
|
-
relativeFrom: _univerjs_core.ObjectRelativeFromH.PAGE,
|
|
2295
|
-
posOffset: 0
|
|
2296
|
-
},
|
|
2297
|
-
positionV: {
|
|
2298
|
-
relativeFrom: _univerjs_core.ObjectRelativeFromV.PARAGRAPH,
|
|
2299
|
-
posOffset: 0
|
|
2300
|
-
}
|
|
2301
|
-
},
|
|
2246
|
+
docTransform: (0, _univerjs_docs.buildDocTransform)(docTransformWidth, docTransformHeight),
|
|
2302
2247
|
layoutType: _univerjs_core.PositionedObjectLayoutType.INLINE,
|
|
2303
2248
|
drawingType: _univerjs_core.DrawingTypeEnum.DRAWING_IMAGE,
|
|
2304
2249
|
unitId: doc.id || "",
|
|
@@ -4571,9 +4516,9 @@ const DocSelectAllCommand = {
|
|
|
4571
4516
|
if (body == null) return false;
|
|
4572
4517
|
const { dataStream } = body;
|
|
4573
4518
|
if (dataStream === "\r\n") return true;
|
|
4574
|
-
const
|
|
4575
|
-
const
|
|
4576
|
-
const textRanges =
|
|
4519
|
+
const scopes = getSelectAllScopes(body, activeRange);
|
|
4520
|
+
const currentScopeIndex = scopes.findIndex((scope) => isSameRanges(docRanges, scope));
|
|
4521
|
+
const textRanges = scopes[Math.min(currentScopeIndex + 1, scopes.length - 1)];
|
|
4577
4522
|
docSelectionManagerService.replaceDocRanges(textRanges, {
|
|
4578
4523
|
unitId,
|
|
4579
4524
|
subUnitId: unitId
|
|
@@ -4582,17 +4527,39 @@ const DocSelectAllCommand = {
|
|
|
4582
4527
|
}
|
|
4583
4528
|
};
|
|
4584
4529
|
function getWholeDocumentRanges(body) {
|
|
4530
|
+
return getRangesForOffsets(body, 0, body.dataStream.length - 2);
|
|
4531
|
+
}
|
|
4532
|
+
function getRangesForOffsets(body, startOffset, endOffset) {
|
|
4533
|
+
var _body$columnGroups;
|
|
4534
|
+
const columnGroups = [...(_body$columnGroups = body.columnGroups) !== null && _body$columnGroups !== void 0 ? _body$columnGroups : []].sort((left, right) => left.startIndex - right.startIndex);
|
|
4535
|
+
const ranges = [];
|
|
4536
|
+
let offset = startOffset;
|
|
4537
|
+
for (const columnGroup of columnGroups) {
|
|
4538
|
+
if (columnGroup.endIndex < startOffset || columnGroup.startIndex > endOffset) continue;
|
|
4539
|
+
if (offset < columnGroup.startIndex) ranges.push(...getRangesWithTables(body, offset, Math.min(endOffset, columnGroup.startIndex - 1)));
|
|
4540
|
+
for (const column of getColumnRanges(body, columnGroup)) {
|
|
4541
|
+
const start = Math.max(startOffset, column.startOffset);
|
|
4542
|
+
const end = Math.min(endOffset, column.endOffset);
|
|
4543
|
+
if (start <= end) ranges.push(...getRangesWithTables(body, start, end));
|
|
4544
|
+
}
|
|
4545
|
+
offset = columnGroup.endIndex + 1;
|
|
4546
|
+
}
|
|
4547
|
+
if (offset <= endOffset) ranges.push(...getRangesWithTables(body, offset, endOffset));
|
|
4548
|
+
return ranges;
|
|
4549
|
+
}
|
|
4550
|
+
function getRangesWithTables(body, startOffset, endOffset) {
|
|
4585
4551
|
var _body$tables;
|
|
4586
|
-
const
|
|
4587
|
-
let offset =
|
|
4588
|
-
for (const table of (_body$tables = body.tables) !== null && _body$tables !== void 0 ? _body$tables : []) {
|
|
4552
|
+
const ranges = [];
|
|
4553
|
+
let offset = startOffset;
|
|
4554
|
+
for (const table of [...(_body$tables = body.tables) !== null && _body$tables !== void 0 ? _body$tables : []].sort((left, right) => left.startIndex - right.startIndex)) {
|
|
4589
4555
|
const { startIndex, endIndex } = table;
|
|
4590
|
-
if (
|
|
4591
|
-
|
|
4556
|
+
if (startIndex < startOffset || endIndex > endOffset) continue;
|
|
4557
|
+
if (offset !== startIndex) ranges.push(...getTextRangesByParagraphs(body, offset, startIndex - 1));
|
|
4558
|
+
ranges.push(getTableRectRange(table));
|
|
4592
4559
|
offset = endIndex;
|
|
4593
4560
|
}
|
|
4594
|
-
if (offset
|
|
4595
|
-
return
|
|
4561
|
+
if (offset <= endOffset) ranges.push(...getTextRangesByParagraphs(body, offset, endOffset));
|
|
4562
|
+
return ranges;
|
|
4596
4563
|
}
|
|
4597
4564
|
function getTextRangesByParagraphs(body, startOffset, endOffset) {
|
|
4598
4565
|
var _body$paragraphs;
|
|
@@ -4617,30 +4584,62 @@ function getTextRangesByParagraphs(body, startOffset, endOffset) {
|
|
|
4617
4584
|
});
|
|
4618
4585
|
return ranges;
|
|
4619
4586
|
}
|
|
4620
|
-
function
|
|
4621
|
-
var _body$tables2, _body$customBlocks, _body$blockRanges, _body$
|
|
4587
|
+
function getSelectAllScopes(body, activeRange) {
|
|
4588
|
+
var _body$tables2, _body$customBlocks, _body$blockRanges, _body$columnGroups2;
|
|
4589
|
+
const scopes = [];
|
|
4590
|
+
const addScope = (scope) => {
|
|
4591
|
+
if ((scope === null || scope === void 0 ? void 0 : scope.length) && !scopes.some((existing) => isSameRanges(existing, scope))) scopes.push(scope);
|
|
4592
|
+
};
|
|
4622
4593
|
const startOffset = activeRange.startOffset;
|
|
4623
4594
|
const endOffset = activeRange.endOffset;
|
|
4624
|
-
if (startOffset == null || endOffset == null) return
|
|
4595
|
+
if (startOffset == null || endOffset == null) return [getWholeDocumentRanges(body)];
|
|
4625
4596
|
const table = ((_body$tables2 = body.tables) !== null && _body$tables2 !== void 0 ? _body$tables2 : []).find((item) => isRangeInside(startOffset, endOffset, item.startIndex, item.endIndex));
|
|
4626
|
-
if (table) return [getTableRectRange(table)];
|
|
4627
4597
|
const customBlock = ((_body$customBlocks = body.customBlocks) !== null && _body$customBlocks !== void 0 ? _body$customBlocks : []).find((item) => item.startIndex >= startOffset && item.startIndex <= endOffset);
|
|
4628
|
-
|
|
4598
|
+
const blockRange = ((_body$blockRanges = body.blockRanges) !== null && _body$blockRanges !== void 0 ? _body$blockRanges : []).find((item) => isRangeInside(startOffset, endOffset, item.startIndex, item.endIndex));
|
|
4599
|
+
if (table) addScope([getTableRectRange(table)]);
|
|
4600
|
+
else if (customBlock) addScope([{
|
|
4629
4601
|
endOffset: customBlock.startIndex,
|
|
4630
4602
|
rangeType: _univerjs_core.DOC_RANGE_TYPE.TEXT,
|
|
4631
4603
|
startOffset: customBlock.startIndex
|
|
4632
|
-
}];
|
|
4633
|
-
|
|
4634
|
-
if (blockRange) return [{
|
|
4604
|
+
}]);
|
|
4605
|
+
else if (blockRange) addScope([{
|
|
4635
4606
|
endOffset: Math.max(blockRange.startIndex + 1, blockRange.endIndex - 1),
|
|
4636
4607
|
rangeType: _univerjs_core.DOC_RANGE_TYPE.TEXT,
|
|
4637
4608
|
startOffset: blockRange.startIndex + 1
|
|
4638
|
-
}];
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4609
|
+
}]);
|
|
4610
|
+
else {
|
|
4611
|
+
var _body$tables3;
|
|
4612
|
+
const paragraphRange = clampParagraphRangeByTables(getParagraphRangeAtOffset(body, startOffset), (_body$tables3 = body.tables) !== null && _body$tables3 !== void 0 ? _body$tables3 : [], startOffset);
|
|
4613
|
+
addScope(paragraphRange ? [{
|
|
4614
|
+
...paragraphRange,
|
|
4615
|
+
rangeType: _univerjs_core.DOC_RANGE_TYPE.TEXT
|
|
4616
|
+
}] : null);
|
|
4617
|
+
}
|
|
4618
|
+
const columnGroup = ((_body$columnGroups2 = body.columnGroups) !== null && _body$columnGroups2 !== void 0 ? _body$columnGroups2 : []).find((item) => isRangeInside(startOffset, endOffset, item.startIndex, item.endIndex));
|
|
4619
|
+
if (columnGroup) {
|
|
4620
|
+
const column = getColumnRanges(body, columnGroup).find((item) => isRangeInside(startOffset, endOffset, item.startOffset, item.endOffset));
|
|
4621
|
+
if (column) addScope(getRangesForOffsets(body, column.startOffset, column.endOffset));
|
|
4622
|
+
addScope(getRangesForOffsets(body, columnGroup.startIndex, columnGroup.endIndex));
|
|
4623
|
+
}
|
|
4624
|
+
addScope(getWholeDocumentRanges(body));
|
|
4625
|
+
return scopes;
|
|
4626
|
+
}
|
|
4627
|
+
function getColumnRanges(body, columnGroup) {
|
|
4628
|
+
const ranges = [];
|
|
4629
|
+
let startOffset;
|
|
4630
|
+
for (let index = columnGroup.startIndex; index <= columnGroup.endIndex; index++) {
|
|
4631
|
+
const token = body.dataStream[index];
|
|
4632
|
+
if (token === _univerjs_core.DataStreamTreeTokenType.COLUMN_START) startOffset = index + 1;
|
|
4633
|
+
else if (token === _univerjs_core.DataStreamTreeTokenType.COLUMN_END && startOffset != null) {
|
|
4634
|
+
ranges.push({
|
|
4635
|
+
startOffset,
|
|
4636
|
+
endOffset: index - 1,
|
|
4637
|
+
rangeType: _univerjs_core.DOC_RANGE_TYPE.TEXT
|
|
4638
|
+
});
|
|
4639
|
+
startOffset = void 0;
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
return ranges;
|
|
4644
4643
|
}
|
|
4645
4644
|
function clampParagraphRangeByTables(paragraphRange, tables, activeOffset) {
|
|
4646
4645
|
if (!paragraphRange) return null;
|
|
@@ -4677,7 +4676,9 @@ function isSameRanges(currentRanges, nextRanges) {
|
|
|
4677
4676
|
if (currentRanges.length !== nextRanges.length) return isSameTextRangeCoverage(currentRanges, nextRanges);
|
|
4678
4677
|
return currentRanges.every((currentRange, index) => {
|
|
4679
4678
|
const nextRange = nextRanges[index];
|
|
4680
|
-
|
|
4679
|
+
const sameType = getRangeType(currentRange) === getRangeType(nextRange);
|
|
4680
|
+
const sameTextEnd = sameType && getRangeType(nextRange) === _univerjs_core.DOC_RANGE_TYPE.TEXT && !currentRange.collapsed && currentRange.endOffset + 1 === nextRange.endOffset;
|
|
4681
|
+
return currentRange.startOffset === nextRange.startOffset && (currentRange.endOffset === nextRange.endOffset || sameTextEnd) && sameType;
|
|
4681
4682
|
});
|
|
4682
4683
|
}
|
|
4683
4684
|
function isSameTextRangeCoverage(currentRanges, nextRanges) {
|
|
@@ -7452,7 +7453,14 @@ const RECT_RANGE_KEY_PREFIX = "__DocTableRectRange__";
|
|
|
7452
7453
|
const ID_LENGTH = 6;
|
|
7453
7454
|
function convertPositionsToRectRanges(scene, document, docSkeleton, anchorNodePosition, focusNodePosition, style = _univerjs_engine_render.NORMAL_TEXT_SELECTION_PLUGIN_STYLE, segmentId = "", segmentPage = -1) {
|
|
7454
7455
|
const nodePositionGroup = new NodePositionConvertToRectRange(document.getOffsetConfig(), docSkeleton).getNodePositionGroup(anchorNodePosition, focusNodePosition);
|
|
7455
|
-
|
|
7456
|
+
const ranges = [];
|
|
7457
|
+
try {
|
|
7458
|
+
for (const position of nodePositionGroup !== null && nodePositionGroup !== void 0 ? nodePositionGroup : []) ranges.push(new RectRange(scene, document, docSkeleton, position.anchor, position.focus, style, segmentId, segmentPage));
|
|
7459
|
+
return ranges;
|
|
7460
|
+
} catch (error) {
|
|
7461
|
+
ranges.forEach((range) => range.dispose());
|
|
7462
|
+
throw error;
|
|
7463
|
+
}
|
|
7456
7464
|
}
|
|
7457
7465
|
var RectRange = class {
|
|
7458
7466
|
constructor(_scene, _document, _docSkeleton, anchorNodePosition, focusNodePosition, style = _univerjs_engine_render.NORMAL_TEXT_SELECTION_PLUGIN_STYLE, _segmentId = "", _segmentPage = -1) {
|
|
@@ -7610,10 +7618,29 @@ var RectRange = class {
|
|
|
7610
7618
|
|
|
7611
7619
|
//#endregion
|
|
7612
7620
|
//#region src/services/selection/selection-utils.ts
|
|
7621
|
+
function disposeRangeList({ textRanges, rectRanges }) {
|
|
7622
|
+
textRanges.forEach((range) => range.dispose());
|
|
7623
|
+
rectRanges.forEach((range) => range.dispose());
|
|
7624
|
+
}
|
|
7625
|
+
function isCompatibleTextRange(start, end) {
|
|
7626
|
+
if (start == null || end == null || start.pageType !== end.pageType) return false;
|
|
7627
|
+
if ((start.pageType === _univerjs_engine_render.DocumentSkeletonPageType.HEADER || start.pageType === _univerjs_engine_render.DocumentSkeletonPageType.FOOTER) && start.segmentPage !== end.segmentPage) return false;
|
|
7628
|
+
const startColumn = (0, _univerjs_engine_render.getDocumentSkeletonColumnPagePathInfo)(start);
|
|
7629
|
+
const endColumn = (0, _univerjs_engine_render.getDocumentSkeletonColumnPagePathInfo)(end);
|
|
7630
|
+
if (startColumn == null || endColumn == null) return startColumn == null && endColumn == null;
|
|
7631
|
+
return startColumn.pageIndex === endColumn.pageIndex && startColumn.columnGroupId === endColumn.columnGroupId && startColumn.columnIndex === endColumn.columnIndex;
|
|
7632
|
+
}
|
|
7633
|
+
function getDescendantTables(node) {
|
|
7634
|
+
if (node.nodeType === _univerjs_core.DataStreamTreeNodeType.TABLE) return [node];
|
|
7635
|
+
return node.children.flatMap(getDescendantTables);
|
|
7636
|
+
}
|
|
7613
7637
|
function isInSameColumnPage(anchorPosition, focusPosition) {
|
|
7638
|
+
var _anchorPosition$path$, _anchorPosition$path, _focusPosition$path$i, _focusPosition$path;
|
|
7614
7639
|
const anchorColumnInfo = (0, _univerjs_engine_render.getDocumentSkeletonColumnPagePathInfo)(anchorPosition);
|
|
7615
7640
|
const focusColumnInfo = (0, _univerjs_engine_render.getDocumentSkeletonColumnPagePathInfo)(focusPosition);
|
|
7616
|
-
|
|
7641
|
+
const anchorPageIndex = (_anchorPosition$path$ = (_anchorPosition$path = anchorPosition.path) === null || _anchorPosition$path === void 0 ? void 0 : _anchorPosition$path.indexOf("page")) !== null && _anchorPosition$path$ !== void 0 ? _anchorPosition$path$ : -1;
|
|
7642
|
+
const focusPageIndex = (_focusPosition$path$i = (_focusPosition$path = focusPosition.path) === null || _focusPosition$path === void 0 ? void 0 : _focusPosition$path.indexOf("page")) !== null && _focusPosition$path$i !== void 0 ? _focusPosition$path$i : -1;
|
|
7643
|
+
return anchorPageIndex >= 0 && focusPageIndex >= 0 && anchorPageIndex === anchorPosition.path.length - 1 && focusPageIndex === focusPosition.path.length - 1 && !!anchorColumnInfo && !!focusColumnInfo && anchorColumnInfo.pageIndex === focusColumnInfo.pageIndex && anchorColumnInfo.columnGroupId === focusColumnInfo.columnGroupId && anchorColumnInfo.columnIndex === focusColumnInfo.columnIndex;
|
|
7617
7644
|
}
|
|
7618
7645
|
function getColumnInputBoundaryCollapsedPosition(anchorPosition, focusPosition, skeleton) {
|
|
7619
7646
|
const anchorColumnInfo = (0, _univerjs_engine_render.getDocumentSkeletonColumnPagePathInfo)(anchorPosition);
|
|
@@ -7663,13 +7690,6 @@ function getRangeListFromSelection(anchorPosition, focusPosition, scene, documen
|
|
|
7663
7690
|
rectRanges
|
|
7664
7691
|
};
|
|
7665
7692
|
}
|
|
7666
|
-
if (isInSameColumnPage(anchorPosition, focusPosition)) {
|
|
7667
|
-
textRanges.push(new TextRange(...rangeParams));
|
|
7668
|
-
return {
|
|
7669
|
-
textRanges,
|
|
7670
|
-
rectRanges
|
|
7671
|
-
};
|
|
7672
|
-
}
|
|
7673
7693
|
if (isInSameTableCellData(skeleton, anchorPosition, focusPosition)) if (isInSameTableCell(anchorPosition, focusPosition)) {
|
|
7674
7694
|
textRanges.push(new TextRange(...rangeParams));
|
|
7675
7695
|
return {
|
|
@@ -7692,6 +7712,13 @@ function getRangeListFromSelection(anchorPosition, focusPosition, scene, documen
|
|
|
7692
7712
|
rectRanges
|
|
7693
7713
|
};
|
|
7694
7714
|
}
|
|
7715
|
+
if (isInSameColumnPage(anchorPosition, focusPosition)) {
|
|
7716
|
+
textRanges.push(new TextRange(...rangeParams));
|
|
7717
|
+
return {
|
|
7718
|
+
textRanges,
|
|
7719
|
+
rectRanges
|
|
7720
|
+
};
|
|
7721
|
+
}
|
|
7695
7722
|
const viewModel = skeleton.getViewModel().getSelfOrHeaderFooterViewModel(segmentId);
|
|
7696
7723
|
const anchorOffset = skeleton.findCharIndexByPosition(anchorPosition);
|
|
7697
7724
|
const focusOffset = skeleton.findCharIndexByPosition(focusPosition);
|
|
@@ -7708,64 +7735,158 @@ function getRangeListFromSelection(anchorPosition, focusPosition, scene, documen
|
|
|
7708
7735
|
var _skeleton$findNodePos2;
|
|
7709
7736
|
return (_skeleton$findNodePos2 = skeleton.findNodePositionByCharIndex(charIndex, isBack, segmentId, segmentPage)) !== null && _skeleton$findNodePos2 !== void 0 ? _skeleton$findNodePos2 : charIndex === endOffset ? originRange.end : void 0;
|
|
7710
7737
|
};
|
|
7738
|
+
const appendTextRange = (rangeStart, rangeEnd, endIsBack = true) => {
|
|
7739
|
+
if (rangeStart > rangeEnd) return true;
|
|
7740
|
+
const sp = findStartNodePositionByCharIndex(rangeStart, true);
|
|
7741
|
+
const ep = findEndNodePositionByCharIndex(rangeEnd, endIsBack);
|
|
7742
|
+
const ap = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? sp : ep;
|
|
7743
|
+
const fp = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? ep : sp;
|
|
7744
|
+
if (!isCompatibleTextRange(ap, fp)) return false;
|
|
7745
|
+
textRanges.push(new TextRange(scene, document, skeleton, ap, fp, style, segmentId, segmentPage));
|
|
7746
|
+
return true;
|
|
7747
|
+
};
|
|
7748
|
+
const appendTableRange = (table, rangeStart, rangeEnd) => {
|
|
7749
|
+
const { startIndex: tableStart, endIndex: tableEnd, children: rows } = table;
|
|
7750
|
+
const startRow = rows.find((row) => row.startIndex <= rangeStart && row.endIndex >= rangeStart);
|
|
7751
|
+
const endRow = rows.find((row) => row.startIndex <= rangeEnd && row.endIndex >= rangeEnd);
|
|
7752
|
+
const tableStartOffset = rangeStart > tableStart && rangeStart < tableEnd ? (startRow === null || startRow === void 0 ? void 0 : startRow.startIndex) == null ? void 0 : startRow.startIndex + 2 : tableStart + 3;
|
|
7753
|
+
const tableEndOffset = rangeEnd > tableStart && rangeEnd < tableEnd ? (endRow === null || endRow === void 0 ? void 0 : endRow.endIndex) == null ? void 0 : endRow.endIndex - 3 : tableEnd - 4;
|
|
7754
|
+
if (tableStartOffset == null || tableEndOffset == null) return false;
|
|
7755
|
+
const startPosition = skeleton.findNodePositionByCharIndex(tableStartOffset, true, segmentId, segmentPage);
|
|
7756
|
+
const endPosition = skeleton.findNodePositionByCharIndex(tableEndOffset, true, segmentId, segmentPage);
|
|
7757
|
+
if (startPosition == null || endPosition == null) return false;
|
|
7758
|
+
const ap = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? startPosition : endPosition;
|
|
7759
|
+
const fp = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? endPosition : startPosition;
|
|
7760
|
+
rectRanges.push(...convertPositionsToRectRanges(scene, document, skeleton, ap, fp, style, segmentId, segmentPage));
|
|
7761
|
+
return true;
|
|
7762
|
+
};
|
|
7763
|
+
const appendColumnRanges = (column, rangeStart, rangeEnd) => {
|
|
7764
|
+
let offset = rangeStart;
|
|
7765
|
+
const tables = getDescendantTables(column).sort((left, right) => left.startIndex - right.startIndex);
|
|
7766
|
+
for (const table of tables) {
|
|
7767
|
+
if (table.endIndex < rangeStart || table.startIndex > rangeEnd) continue;
|
|
7768
|
+
if (!appendTextRange(offset, Math.min(rangeEnd, table.startIndex - 1), false) || !appendTableRange(table, Math.max(rangeStart, table.startIndex), Math.min(rangeEnd, table.endIndex))) return false;
|
|
7769
|
+
offset = table.endIndex + 1;
|
|
7770
|
+
}
|
|
7771
|
+
return appendTextRange(offset, rangeEnd);
|
|
7772
|
+
};
|
|
7711
7773
|
let start = startOffset;
|
|
7712
7774
|
let end = endOffset;
|
|
7713
|
-
|
|
7714
|
-
const
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7775
|
+
try {
|
|
7776
|
+
for (const section of viewModel.getChildren()) for (const paragraph of section.children) {
|
|
7777
|
+
const { startIndex, endIndex, children } = paragraph;
|
|
7778
|
+
if (paragraph.nodeType === _univerjs_core.DataStreamTreeNodeType.COLUMN_GROUP && start <= endIndex && end >= startIndex) {
|
|
7779
|
+
if (start < startIndex && !appendTextRange(start, Math.min(end, startIndex - 1), false)) {
|
|
7780
|
+
disposeRangeList({
|
|
7781
|
+
textRanges,
|
|
7782
|
+
rectRanges
|
|
7783
|
+
});
|
|
7784
|
+
return;
|
|
7785
|
+
}
|
|
7786
|
+
for (const column of children.filter((child) => child.nodeType === _univerjs_core.DataStreamTreeNodeType.COLUMN)) {
|
|
7787
|
+
const columnStart = Math.max(start, column.startIndex + 1);
|
|
7788
|
+
const columnEnd = Math.min(end, column.endIndex - 1);
|
|
7789
|
+
if (columnStart <= columnEnd && !appendColumnRanges(column, columnStart, columnEnd)) {
|
|
7790
|
+
disposeRangeList({
|
|
7791
|
+
textRanges,
|
|
7792
|
+
rectRanges
|
|
7793
|
+
});
|
|
7794
|
+
return;
|
|
7795
|
+
}
|
|
7796
|
+
}
|
|
7797
|
+
start = endIndex + 1;
|
|
7798
|
+
continue;
|
|
7799
|
+
}
|
|
7800
|
+
const paragraphIndex = section.children.indexOf(paragraph);
|
|
7801
|
+
const nextParagraph = section.children[paragraphIndex + 1];
|
|
7802
|
+
const table = children.find((child) => child.nodeType === _univerjs_core.DataStreamTreeNodeType.TABLE);
|
|
7803
|
+
const nextTable = nextParagraph === null || nextParagraph === void 0 ? void 0 : nextParagraph.children.find((child) => child.nodeType === _univerjs_core.DataStreamTreeNodeType.TABLE);
|
|
7804
|
+
let endInTable = false;
|
|
7805
|
+
if (table) {
|
|
7806
|
+
const { startIndex: tableStart, endIndex: tableEnd, children } = table;
|
|
7807
|
+
let tableStartPosition = null;
|
|
7808
|
+
let tableEndPosition = null;
|
|
7809
|
+
if (startOffset > tableStart && startOffset < tableEnd) {
|
|
7810
|
+
const startRow = children.find((row) => row.startIndex <= startOffset && row.endIndex >= startOffset);
|
|
7811
|
+
if (startRow == null) {
|
|
7812
|
+
disposeRangeList({
|
|
7813
|
+
textRanges,
|
|
7814
|
+
rectRanges
|
|
7815
|
+
});
|
|
7816
|
+
return;
|
|
7817
|
+
}
|
|
7818
|
+
tableStartPosition = skeleton.findNodePositionByCharIndex(startRow.startIndex + 2, true, segmentId, segmentPage);
|
|
7819
|
+
tableEndPosition = skeleton.findNodePositionByCharIndex(tableEnd - 4, true, segmentId, segmentPage);
|
|
7820
|
+
start = tableEnd + 1;
|
|
7821
|
+
} else if (endOffset > tableStart && endOffset < tableEnd) {
|
|
7822
|
+
const endRow = children.find((row) => row.startIndex <= endOffset && row.endIndex >= endOffset);
|
|
7823
|
+
if (endRow == null) {
|
|
7824
|
+
disposeRangeList({
|
|
7825
|
+
textRanges,
|
|
7826
|
+
rectRanges
|
|
7827
|
+
});
|
|
7828
|
+
return;
|
|
7829
|
+
}
|
|
7830
|
+
tableStartPosition = skeleton.findNodePositionByCharIndex(tableStart + 3, true, segmentId, segmentPage);
|
|
7831
|
+
tableEndPosition = skeleton.findNodePositionByCharIndex(endRow.endIndex - 3, true, segmentId, segmentPage);
|
|
7832
|
+
end = tableStart - 1;
|
|
7833
|
+
endInTable = true;
|
|
7834
|
+
} else if (tableStart > startOffset && tableEnd < endOffset) {
|
|
7835
|
+
tableStartPosition = skeleton.findNodePositionByCharIndex(tableStart + 3, true, segmentId, segmentPage);
|
|
7836
|
+
tableEndPosition = skeleton.findNodePositionByCharIndex(tableEnd - 4, true, segmentId, segmentPage);
|
|
7837
|
+
if (start <= tableStart - 1) {
|
|
7838
|
+
const sp = findStartNodePositionByCharIndex(start, true);
|
|
7839
|
+
const ep = findEndNodePositionByCharIndex(tableStart - 1, false);
|
|
7840
|
+
const ap = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? sp : ep;
|
|
7841
|
+
const fp = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? ep : sp;
|
|
7842
|
+
if (!isCompatibleTextRange(ap, fp)) {
|
|
7843
|
+
disposeRangeList({
|
|
7844
|
+
textRanges,
|
|
7845
|
+
rectRanges
|
|
7846
|
+
});
|
|
7847
|
+
return;
|
|
7848
|
+
}
|
|
7849
|
+
textRanges.push(new TextRange(scene, document, skeleton, ap, fp, style, segmentId, segmentPage));
|
|
7850
|
+
}
|
|
7851
|
+
start = tableEnd + 1;
|
|
7852
|
+
}
|
|
7853
|
+
if (tableStartPosition && tableEndPosition) {
|
|
7854
|
+
const ap = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? tableStartPosition : tableEndPosition;
|
|
7855
|
+
const fp = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? tableEndPosition : tableStartPosition;
|
|
7856
|
+
rectRanges.push(...convertPositionsToRectRanges(scene, document, skeleton, ap, fp, style, segmentId, segmentPage));
|
|
7743
7857
|
}
|
|
7744
|
-
start = tableEnd + 1;
|
|
7745
7858
|
}
|
|
7746
|
-
if (
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7859
|
+
if (end === endIndex + 1 && !endInTable && nextTable) {
|
|
7860
|
+
end = endIndex;
|
|
7861
|
+
endInTable = true;
|
|
7862
|
+
}
|
|
7863
|
+
if (end >= startIndex && end <= endIndex || endInTable) {
|
|
7864
|
+
const sp = findStartNodePositionByCharIndex(start, true);
|
|
7865
|
+
const ep = findEndNodePositionByCharIndex(end, !endInTable);
|
|
7866
|
+
const ap = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? sp : ep;
|
|
7867
|
+
const fp = direction === _univerjs_core.RANGE_DIRECTION.FORWARD ? ep : sp;
|
|
7868
|
+
if (rectRanges.length && _univerjs_core.Tools.diffValue(ap, fp)) continue;
|
|
7869
|
+
if (!isCompatibleTextRange(ap, fp)) {
|
|
7870
|
+
disposeRangeList({
|
|
7871
|
+
textRanges,
|
|
7872
|
+
rectRanges
|
|
7873
|
+
});
|
|
7874
|
+
return;
|
|
7875
|
+
}
|
|
7876
|
+
textRanges.push(new TextRange(scene, document, skeleton, ap, fp, style, segmentId, segmentPage));
|
|
7750
7877
|
}
|
|
7751
7878
|
}
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
}
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
textRanges.push(new TextRange(scene, document, skeleton, ap, fp, style, segmentId, segmentPage));
|
|
7763
|
-
}
|
|
7879
|
+
return {
|
|
7880
|
+
textRanges,
|
|
7881
|
+
rectRanges
|
|
7882
|
+
};
|
|
7883
|
+
} catch (error) {
|
|
7884
|
+
disposeRangeList({
|
|
7885
|
+
textRanges,
|
|
7886
|
+
rectRanges
|
|
7887
|
+
});
|
|
7888
|
+
throw error;
|
|
7764
7889
|
}
|
|
7765
|
-
return {
|
|
7766
|
-
textRanges,
|
|
7767
|
-
rectRanges
|
|
7768
|
-
};
|
|
7769
7890
|
}
|
|
7770
7891
|
function getCanvasOffsetByEngine(engine) {
|
|
7771
7892
|
const canvas = engine === null || engine === void 0 ? void 0 : engine.getCanvasElement();
|
|
@@ -8175,9 +8296,9 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8175
8296
|
const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
|
|
8176
8297
|
scene.setCursor(_univerjs_engine_render.CURSOR_TYPE.TEXT);
|
|
8177
8298
|
if (Math.sqrt((moveOffsetX - preMoveOffsetX) ** 2 + (moveOffsetY - preMoveOffsetY) ** 2) < 3) return;
|
|
8178
|
-
this.
|
|
8299
|
+
this._tryMoving(moveOffsetX, moveOffsetY);
|
|
8179
8300
|
scrollTimer.scrolling(moveOffsetX, moveOffsetY, () => {
|
|
8180
|
-
this.
|
|
8301
|
+
this._tryMoving(moveOffsetX, moveOffsetY);
|
|
8181
8302
|
});
|
|
8182
8303
|
preMoveOffsetX = moveOffsetX;
|
|
8183
8304
|
preMoveOffsetY = moveOffsetY;
|
|
@@ -8472,6 +8593,13 @@ let DocSelectionRenderService = class DocSelectionRenderService extends _univerj
|
|
|
8472
8593
|
canvasTop += y;
|
|
8473
8594
|
this.activate(canvasLeft, canvasTop, forceFocus);
|
|
8474
8595
|
}
|
|
8596
|
+
_tryMoving(moveOffsetX, moveOffsetY) {
|
|
8597
|
+
try {
|
|
8598
|
+
this._moving(moveOffsetX, moveOffsetY);
|
|
8599
|
+
} catch (error) {
|
|
8600
|
+
this._logService.error("[DocSelectionRenderService] Failed to update moving selection", error);
|
|
8601
|
+
}
|
|
8602
|
+
}
|
|
8475
8603
|
_moving(moveOffsetX, moveOffsetY) {
|
|
8476
8604
|
var _this$_context$scene2;
|
|
8477
8605
|
const { _currentSegmentId: segmentId, _currentSegmentPage: segmentPage } = this;
|
|
@@ -11452,7 +11580,7 @@ function DeleteTableMenuItemFactory(accessor) {
|
|
|
11452
11580
|
id: DocTableDeleteTableCommand.id,
|
|
11453
11581
|
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
11454
11582
|
title: "docs-ui.table.deleteTable",
|
|
11455
|
-
icon: "
|
|
11583
|
+
icon: "DeleteTableDoubleIcon",
|
|
11456
11584
|
disabled$: getDisableWhenSelectionNotInTableObservable(accessor),
|
|
11457
11585
|
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC)
|
|
11458
11586
|
};
|
|
@@ -13346,6 +13474,10 @@ const menuSchema = {
|
|
|
13346
13474
|
order: 8,
|
|
13347
13475
|
menuItemFactory: BulletListMenuItemFactory
|
|
13348
13476
|
},
|
|
13477
|
+
[CheckListCommand.id]: {
|
|
13478
|
+
order: 9,
|
|
13479
|
+
menuItemFactory: CheckListMenuItemFactory
|
|
13480
|
+
},
|
|
13349
13481
|
[OpenHeaderFooterPanelCommand.id]: {
|
|
13350
13482
|
order: 10,
|
|
13351
13483
|
menuItemFactory: HeaderFooterMenuItemFactory
|
|
@@ -13367,10 +13499,6 @@ const menuSchema = {
|
|
|
13367
13499
|
[HorizontalLineCommand.id]: {
|
|
13368
13500
|
order: 3,
|
|
13369
13501
|
menuItemFactory: HorizontalLineFactory
|
|
13370
|
-
},
|
|
13371
|
-
[CheckListCommand.id]: {
|
|
13372
|
-
order: 4,
|
|
13373
|
-
menuItemFactory: CheckListMenuItemFactory
|
|
13374
13502
|
}
|
|
13375
13503
|
},
|
|
13376
13504
|
[_univerjs_ui.ContextMenuPosition.MAIN_AREA]: {
|
|
@@ -14076,23 +14204,13 @@ const DOC_ZOOM_RANGE = [10, 400];
|
|
|
14076
14204
|
function ZoomSlider() {
|
|
14077
14205
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
14078
14206
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
14079
|
-
const
|
|
14080
|
-
const [zoom, setZoom] = (0, react.useState)(100);
|
|
14207
|
+
const documentDataModel = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).pipe((0, rxjs.filter)((documentDataModel) => documentDataModel != null)), null, false, [univerInstanceService]);
|
|
14081
14208
|
const getCurrentZoom = (0, react.useCallback)((docModel = documentDataModel) => {
|
|
14082
14209
|
if (!docModel) return 100;
|
|
14083
14210
|
return Math.round(getDocEffectiveZoomRatio(docModel) * 100);
|
|
14084
14211
|
}, [documentDataModel]);
|
|
14085
|
-
(0, react.
|
|
14086
|
-
|
|
14087
|
-
if (doc) {
|
|
14088
|
-
setDocumentDataModel(doc);
|
|
14089
|
-
setZoom(getCurrentZoom(doc));
|
|
14090
|
-
}
|
|
14091
|
-
});
|
|
14092
|
-
return () => {
|
|
14093
|
-
subscription.unsubscribe();
|
|
14094
|
-
};
|
|
14095
|
-
}, [univerInstanceService, getCurrentZoom]);
|
|
14212
|
+
const [zoom, setZoom] = (0, react.useState)(100);
|
|
14213
|
+
(0, react.useEffect)(() => setZoom(getCurrentZoom(documentDataModel)), [documentDataModel, getCurrentZoom]);
|
|
14096
14214
|
(0, react.useEffect)(() => {
|
|
14097
14215
|
return commandService.onCommandExecuted((commandInfo) => {
|
|
14098
14216
|
if (commandInfo.id === SetDocZoomRatioOperation.id) setZoom(getCurrentZoom());
|
|
@@ -15259,23 +15377,28 @@ function DocSideMenu() {
|
|
|
15259
15377
|
return null;
|
|
15260
15378
|
}
|
|
15261
15379
|
function DocSideMenuContent() {
|
|
15262
|
-
var
|
|
15263
|
-
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
15380
|
+
var _documentData$body$da, _documentData$body, _currentDoc$getUnitId, _documentData$body$pa, _documentData$body2;
|
|
15264
15381
|
const instanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
15265
15382
|
const currentDoc = (0, _univerjs_ui.useObservable)((0, react.useMemo)(() => instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC), []));
|
|
15266
15383
|
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
15267
|
-
const
|
|
15268
|
-
const
|
|
15384
|
+
const documentData = (0, _univerjs_ui.useObservable)(currentDoc ? () => currentDoc.change$.pipe((0, rxjs.debounceTime)(100), (0, rxjs.map)(() => currentDoc.getSnapshot())) : null, currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getSnapshot(), false, [currentDoc]);
|
|
15385
|
+
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 : "";
|
|
15269
15386
|
const [activeId, setActiveId] = (0, react.useState)(void 0);
|
|
15270
15387
|
const unitId = (_currentDoc$getUnitId = currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) !== null && _currentDoc$getUnitId !== void 0 ? _currentDoc$getUnitId : "";
|
|
15271
15388
|
const renderer = renderManagerService.getRenderById(unitId);
|
|
15272
|
-
const title =
|
|
15389
|
+
const title = documentData === null || documentData === void 0 ? void 0 : documentData.title;
|
|
15273
15390
|
const docEventManagerService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocEventManagerService);
|
|
15274
15391
|
const paragraphBounds = docEventManagerService === null || docEventManagerService === void 0 ? void 0 : docEventManagerService.paragraphBounds;
|
|
15275
|
-
const
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15392
|
+
const readLayout = () => {
|
|
15393
|
+
var _renderer$mainCompone, _renderer$mainCompone2, _renderer$engine$heig, _renderer$scene$scale;
|
|
15394
|
+
return {
|
|
15395
|
+
left: (_renderer$mainCompone = renderer === null || renderer === void 0 || (_renderer$mainCompone2 = renderer.mainComponent) === null || _renderer$mainCompone2 === void 0 ? void 0 : _renderer$mainCompone2.left) !== null && _renderer$mainCompone !== void 0 ? _renderer$mainCompone : 0,
|
|
15396
|
+
canvasHeight: (_renderer$engine$heig = renderer === null || renderer === void 0 ? void 0 : renderer.engine.height) !== null && _renderer$engine$heig !== void 0 ? _renderer$engine$heig : 0,
|
|
15397
|
+
scaleY: (_renderer$scene$scale = renderer === null || renderer === void 0 ? void 0 : renderer.scene.scaleY) !== null && _renderer$scene$scale !== void 0 ? _renderer$scene$scale : 1
|
|
15398
|
+
};
|
|
15399
|
+
};
|
|
15400
|
+
const { left, canvasHeight, scaleY } = (0, _univerjs_ui.useObservable)((renderer === null || renderer === void 0 ? void 0 : renderer.engine.onTransformChange$) ? () => (0, _univerjs_core.fromEventSubject)(renderer.engine.onTransformChange$).pipe((0, rxjs.throttleTime)(33), (0, rxjs.map)(readLayout), (0, rxjs.startWith)(readLayout())) : null, readLayout(), false, [renderer]);
|
|
15401
|
+
const paragraphs = (_documentData$body$pa = documentData === null || documentData === void 0 || (_documentData$body2 = documentData.body) === null || _documentData$body2 === void 0 ? void 0 : _documentData$body2.paragraphs) !== null && _documentData$body$pa !== void 0 ? _documentData$body$pa : [];
|
|
15279
15402
|
const paragraphMap = (0, react.useMemo)(() => {
|
|
15280
15403
|
const map = /* @__PURE__ */ new Map();
|
|
15281
15404
|
paragraphs.forEach((p) => {
|
|
@@ -15283,7 +15406,6 @@ function DocSideMenuContent() {
|
|
|
15283
15406
|
});
|
|
15284
15407
|
return map;
|
|
15285
15408
|
}, [paragraphs]);
|
|
15286
|
-
(0, _univerjs_ui.useObservable)((0, react.useMemo)(() => (renderer === null || renderer === void 0 ? void 0 : renderer.engine.onTransformChange$) ? (0, _univerjs_core.fromEventSubject)(renderer === null || renderer === void 0 ? void 0 : renderer.engine.onTransformChange$).pipe((0, rxjs.throttleTime)(33)) : (0, rxjs.of)(null), [renderer === null || renderer === void 0 ? void 0 : renderer.engine.onTransformChange$]));
|
|
15287
15409
|
const mode = left < 180 ? "float" : "side-bar";
|
|
15288
15410
|
let minLevel = Infinity;
|
|
15289
15411
|
const paragraphMenus = paragraphs === null || paragraphs === void 0 ? void 0 : paragraphs.filter((p) => {
|
|
@@ -15315,17 +15437,6 @@ function DocSideMenuContent() {
|
|
|
15315
15437
|
isTitle: true
|
|
15316
15438
|
}] : [], ...paragraphMenus !== null && paragraphMenus !== void 0 ? paragraphMenus : []].filter(Boolean);
|
|
15317
15439
|
const [open, setOpen] = (0, react.useState)(true);
|
|
15318
|
-
(0, react.useEffect)(() => {
|
|
15319
|
-
const debounceUpdater = (0, _univerjs_core.debounce)(setUpdateKey, 100);
|
|
15320
|
-
const sub = commandService.onCommandExecuted((commandInfo) => {
|
|
15321
|
-
if (commandInfo.id === _univerjs_docs.RichTextEditingMutation.id) {
|
|
15322
|
-
if (commandInfo.params.unitId === (currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId())) debounceUpdater((prev) => prev + 1);
|
|
15323
|
-
}
|
|
15324
|
-
});
|
|
15325
|
-
return () => {
|
|
15326
|
-
sub.dispose();
|
|
15327
|
-
};
|
|
15328
|
-
}, [commandService, currentDoc]);
|
|
15329
15440
|
(0, react.useEffect)(() => {
|
|
15330
15441
|
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
|
|
15331
15442
|
if (!viewport) return;
|
|
@@ -15725,7 +15836,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
|
|
|
15725
15836
|
//#endregion
|
|
15726
15837
|
//#region package.json
|
|
15727
15838
|
var name = "@univerjs/docs-ui";
|
|
15728
|
-
var version = "1.0.0-alpha.
|
|
15839
|
+
var version = "1.0.0-alpha.5";
|
|
15729
15840
|
|
|
15730
15841
|
//#endregion
|
|
15731
15842
|
//#region src/commands/commands/doc-paragraph-setting.command.ts
|
|
@@ -15790,6 +15901,67 @@ const DocParagraphSettingCommand = {
|
|
|
15790
15901
|
}
|
|
15791
15902
|
};
|
|
15792
15903
|
|
|
15904
|
+
//#endregion
|
|
15905
|
+
//#region src/views/float-toolbar/FloatToolbar.tsx
|
|
15906
|
+
const FLOAT_MENU_COMPONENT_KEY = "univer.doc.float-menu";
|
|
15907
|
+
const DEFAULT_AVALIABLE_MENUS = [
|
|
15908
|
+
FLOAT_TEXT_STYLE_MENU_ID,
|
|
15909
|
+
SetInlineFormatFontSizeCommand.id,
|
|
15910
|
+
SetInlineFormatBoldCommand.id,
|
|
15911
|
+
SetInlineFormatItalicCommand.id,
|
|
15912
|
+
SetInlineFormatUnderlineCommand.id,
|
|
15913
|
+
SetInlineFormatStrikethroughCommand.id,
|
|
15914
|
+
SetInlineFormatSubscriptCommand.id,
|
|
15915
|
+
SetInlineFormatSuperscriptCommand.id,
|
|
15916
|
+
SetInlineFormatTextColorCommand.id,
|
|
15917
|
+
SetInlineFormatTextBackgroundColorCommand.id
|
|
15918
|
+
];
|
|
15919
|
+
function resolveFloatToolbarMenus(menuManagerService, avaliableMenus) {
|
|
15920
|
+
const floatToolbarMenus = menuManagerService.getMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION);
|
|
15921
|
+
const flatMenus = [...menuManagerService.getFlatMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION), ...menuManagerService.getFlatMenuByPositionKey(_univerjs_ui.MenuManagerPosition.RIBBON)];
|
|
15922
|
+
const menus = [];
|
|
15923
|
+
for (const key of avaliableMenus) {
|
|
15924
|
+
const item = flatMenus.find((item) => item.key === key);
|
|
15925
|
+
if (item) menus.push(item);
|
|
15926
|
+
}
|
|
15927
|
+
return {
|
|
15928
|
+
menus,
|
|
15929
|
+
extraMenus: floatToolbarMenus.filter((item) => item.item && !avaliableMenus.includes(item.key))
|
|
15930
|
+
};
|
|
15931
|
+
}
|
|
15932
|
+
function FloatToolbar(props) {
|
|
15933
|
+
const { avaliableMenus = DEFAULT_AVALIABLE_MENUS } = props;
|
|
15934
|
+
const menuManagerService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMenuManagerService);
|
|
15935
|
+
const [menus, setMenus] = (0, react.useState)([]);
|
|
15936
|
+
const [extraMenus, setExtraMenus] = (0, react.useState)([]);
|
|
15937
|
+
(0, react.useEffect)(() => {
|
|
15938
|
+
function getRibbon() {
|
|
15939
|
+
const { menus, extraMenus } = resolveFloatToolbarMenus(menuManagerService, avaliableMenus);
|
|
15940
|
+
setMenus(menus);
|
|
15941
|
+
setExtraMenus(extraMenus);
|
|
15942
|
+
}
|
|
15943
|
+
getRibbon();
|
|
15944
|
+
const subscription = menuManagerService.menuChanged$.subscribe(getRibbon);
|
|
15945
|
+
return () => {
|
|
15946
|
+
subscription.unsubscribe();
|
|
15947
|
+
};
|
|
15948
|
+
}, [avaliableMenus, menuManagerService]);
|
|
15949
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
15950
|
+
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-rounded univer-bg-white univer-py-1.5 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", _univerjs_design.borderClassName),
|
|
15951
|
+
children: [
|
|
15952
|
+
menus.map((groupItem) => groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15953
|
+
className: "univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",
|
|
15954
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, { ...groupItem.item }, groupItem.key)
|
|
15955
|
+
}, groupItem.key)),
|
|
15956
|
+
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
|
+
extraMenus.map((groupItem) => groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
15958
|
+
className: "univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",
|
|
15959
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, { ...groupItem.item }, groupItem.key)
|
|
15960
|
+
}, groupItem.key))
|
|
15961
|
+
]
|
|
15962
|
+
});
|
|
15963
|
+
}
|
|
15964
|
+
|
|
15793
15965
|
//#endregion
|
|
15794
15966
|
//#region src/utils/section-header-footer.ts
|
|
15795
15967
|
function getDocPageSectionContext(snapshot, page) {
|
|
@@ -16030,20 +16202,9 @@ const DocHeaderFooterPanel = () => {
|
|
|
16030
16202
|
const renderManagerService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService);
|
|
16031
16203
|
const unitId = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC).getUnitId();
|
|
16032
16204
|
const viewModel = ((_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs.DocSkeletonManagerService)).getViewModel();
|
|
16033
|
-
const [isEditHeaderFooter, setIsEditHeaderFooter] = (0, react.useState)(true);
|
|
16034
|
-
(0, react.useEffect)(() => {
|
|
16035
|
-
setIsEditHeaderFooter(viewModel.getEditArea() !== _univerjs_engine_render.DocumentEditArea.BODY);
|
|
16036
|
-
const subscription = viewModel.editAreaChange$.subscribe((editArea) => {
|
|
16037
|
-
if (editArea == null) return;
|
|
16038
|
-
setIsEditHeaderFooter(editArea !== _univerjs_engine_render.DocumentEditArea.BODY);
|
|
16039
|
-
});
|
|
16040
|
-
return () => {
|
|
16041
|
-
subscription.unsubscribe();
|
|
16042
|
-
};
|
|
16043
|
-
}, []);
|
|
16044
16205
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16045
16206
|
className: "univer-text-sm",
|
|
16046
|
-
children:
|
|
16207
|
+
children: (0, _univerjs_ui.useObservable)(() => viewModel.editAreaChange$.pipe((0, rxjs.filter)((editArea) => editArea != null), (0, rxjs.map)((editArea) => editArea !== _univerjs_engine_render.DocumentEditArea.BODY)), viewModel.getEditArea() !== _univerjs_engine_render.DocumentEditArea.BODY, false, [viewModel]) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocHeaderFooterOptions, { unitId }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16047
16208
|
className: "univer-text-gray-400",
|
|
16048
16209
|
children: localeService.t("docs-ui.headerFooter.disableText")
|
|
16049
16210
|
})
|
|
@@ -16177,8 +16338,7 @@ function createTextColorSwatchIcon(color) {
|
|
|
16177
16338
|
function createBackgroundColorSwatchIcon(index) {
|
|
16178
16339
|
return function DocParagraphBackgroundColorSwatchIcon(props) {
|
|
16179
16340
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
16180
|
-
(0, _univerjs_ui.useObservable)(themeService.currentTheme
|
|
16181
|
-
const color = getHighlightBackgroundColor(themeService, index);
|
|
16341
|
+
const color = (0, _univerjs_ui.useObservable)(() => themeService.currentTheme$.pipe((0, rxjs.map)(() => getHighlightBackgroundColor(themeService, index))), getHighlightBackgroundColor(themeService, index), false, [index, themeService]);
|
|
16182
16342
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BackgroundColorSwatchIcon, {
|
|
16183
16343
|
...props,
|
|
16184
16344
|
color
|
|
@@ -16732,69 +16892,8 @@ function ParagraphSettingIndex() {
|
|
|
16732
16892
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParagraphSetting, {}, key);
|
|
16733
16893
|
}
|
|
16734
16894
|
|
|
16735
|
-
//#endregion
|
|
16736
|
-
//#region src/views/float-toolbar/FloatToolbar.tsx
|
|
16737
|
-
const DEFAULT_AVALIABLE_MENUS = [
|
|
16738
|
-
FLOAT_TEXT_STYLE_MENU_ID,
|
|
16739
|
-
SetInlineFormatFontSizeCommand.id,
|
|
16740
|
-
SetInlineFormatBoldCommand.id,
|
|
16741
|
-
SetInlineFormatItalicCommand.id,
|
|
16742
|
-
SetInlineFormatUnderlineCommand.id,
|
|
16743
|
-
SetInlineFormatStrikethroughCommand.id,
|
|
16744
|
-
SetInlineFormatSubscriptCommand.id,
|
|
16745
|
-
SetInlineFormatSuperscriptCommand.id,
|
|
16746
|
-
SetInlineFormatTextColorCommand.id,
|
|
16747
|
-
SetInlineFormatTextBackgroundColorCommand.id
|
|
16748
|
-
];
|
|
16749
|
-
function resolveFloatToolbarMenus(menuManagerService, avaliableMenus) {
|
|
16750
|
-
const floatToolbarMenus = menuManagerService.getMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION);
|
|
16751
|
-
const flatMenus = [...menuManagerService.getFlatMenuByPositionKey(FLOAT_TOOLBAR_MENU_POSITION), ...menuManagerService.getFlatMenuByPositionKey(_univerjs_ui.MenuManagerPosition.RIBBON)];
|
|
16752
|
-
const menus = [];
|
|
16753
|
-
for (const key of avaliableMenus) {
|
|
16754
|
-
const item = flatMenus.find((item) => item.key === key);
|
|
16755
|
-
if (item) menus.push(item);
|
|
16756
|
-
}
|
|
16757
|
-
return {
|
|
16758
|
-
menus,
|
|
16759
|
-
extraMenus: floatToolbarMenus.filter((item) => item.item && !avaliableMenus.includes(item.key))
|
|
16760
|
-
};
|
|
16761
|
-
}
|
|
16762
|
-
function FloatToolbar(props) {
|
|
16763
|
-
const { avaliableMenus = DEFAULT_AVALIABLE_MENUS } = props;
|
|
16764
|
-
const menuManagerService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMenuManagerService);
|
|
16765
|
-
const [menus, setMenus] = (0, react.useState)([]);
|
|
16766
|
-
const [extraMenus, setExtraMenus] = (0, react.useState)([]);
|
|
16767
|
-
(0, react.useEffect)(() => {
|
|
16768
|
-
function getRibbon() {
|
|
16769
|
-
const { menus, extraMenus } = resolveFloatToolbarMenus(menuManagerService, avaliableMenus);
|
|
16770
|
-
setMenus(menus);
|
|
16771
|
-
setExtraMenus(extraMenus);
|
|
16772
|
-
}
|
|
16773
|
-
getRibbon();
|
|
16774
|
-
const subscription = menuManagerService.menuChanged$.subscribe(getRibbon);
|
|
16775
|
-
return () => {
|
|
16776
|
-
subscription.unsubscribe();
|
|
16777
|
-
};
|
|
16778
|
-
}, [avaliableMenus, menuManagerService]);
|
|
16779
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
16780
|
-
className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-rounded univer-bg-white univer-py-1.5 univer-shadow-sm dark:!univer-border-gray-700 dark:!univer-bg-gray-900", _univerjs_design.borderClassName),
|
|
16781
|
-
children: [
|
|
16782
|
-
menus.map((groupItem) => groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16783
|
-
className: "univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",
|
|
16784
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, { ...groupItem.item }, groupItem.key)
|
|
16785
|
-
}, groupItem.key)),
|
|
16786
|
-
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" }),
|
|
16787
|
-
extraMenus.map((groupItem) => groupItem.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
16788
|
-
className: "univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",
|
|
16789
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.ToolbarItem, { ...groupItem.item }, groupItem.key)
|
|
16790
|
-
}, groupItem.key))
|
|
16791
|
-
]
|
|
16792
|
-
});
|
|
16793
|
-
}
|
|
16794
|
-
|
|
16795
16895
|
//#endregion
|
|
16796
16896
|
//#region src/services/float-menu.service.ts
|
|
16797
|
-
const FLOAT_MENU_COMPONENT_KEY = "univer.doc.float-menu";
|
|
16798
16897
|
function isInSameLine(startNodePosition, endNodePosition) {
|
|
16799
16898
|
if (startNodePosition == null || endNodePosition == null) return false;
|
|
16800
16899
|
const { glyph: _startGlyph, ...startRest } = startNodePosition;
|
|
@@ -16803,17 +16902,15 @@ function isInSameLine(startNodePosition, endNodePosition) {
|
|
|
16803
16902
|
}
|
|
16804
16903
|
const SKIP_SYMBOLS = [_univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK, _univerjs_core.DataStreamTreeTokenType.PARAGRAPH];
|
|
16805
16904
|
let DocFloatMenuService = class DocFloatMenuService extends _univerjs_core.Disposable {
|
|
16806
|
-
constructor(_context, _docSelectionManagerService, _docCanvasPopManagerService,
|
|
16905
|
+
constructor(_context, _docSelectionManagerService, _docCanvasPopManagerService, _univerInstanceService, _docSelectionRenderService) {
|
|
16807
16906
|
super();
|
|
16808
16907
|
this._context = _context;
|
|
16809
16908
|
this._docSelectionManagerService = _docSelectionManagerService;
|
|
16810
16909
|
this._docCanvasPopManagerService = _docCanvasPopManagerService;
|
|
16811
|
-
this._componentManager = _componentManager;
|
|
16812
16910
|
this._univerInstanceService = _univerInstanceService;
|
|
16813
16911
|
this._docSelectionRenderService = _docSelectionRenderService;
|
|
16814
16912
|
_defineProperty(this, "_floatMenu", null);
|
|
16815
16913
|
if ((0, _univerjs_core.isInternalEditorID)(this._context.unitId)) return;
|
|
16816
|
-
this._registerFloatMenu();
|
|
16817
16914
|
this._initSelectionChange();
|
|
16818
16915
|
this.disposeWithMe(() => {
|
|
16819
16916
|
this._hideFloatMenu();
|
|
@@ -16825,9 +16922,6 @@ let DocFloatMenuService = class DocFloatMenuService extends _univerjs_core.Dispo
|
|
|
16825
16922
|
hideFloatMenu() {
|
|
16826
16923
|
this._hideFloatMenu();
|
|
16827
16924
|
}
|
|
16828
|
-
_registerFloatMenu() {
|
|
16829
|
-
this.disposeWithMe(this._componentManager.register(FLOAT_MENU_COMPONENT_KEY, FloatToolbar));
|
|
16830
|
-
}
|
|
16831
16925
|
_initSelectionChange() {
|
|
16832
16926
|
this.disposeWithMe(this._docSelectionRenderService.onSelectionStart$.subscribe(() => {
|
|
16833
16927
|
this._hideFloatMenu();
|
|
@@ -16875,9 +16969,8 @@ let DocFloatMenuService = class DocFloatMenuService extends _univerjs_core.Dispo
|
|
|
16875
16969
|
DocFloatMenuService = __decorate([
|
|
16876
16970
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_docs.DocSelectionManagerService)),
|
|
16877
16971
|
__decorateParam(2, (0, _univerjs_core.Inject)(DocCanvasPopManagerService)),
|
|
16878
|
-
__decorateParam(3, (0, _univerjs_core.Inject)(
|
|
16879
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(
|
|
16880
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(DocSelectionRenderService))
|
|
16972
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
16973
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(DocSelectionRenderService))
|
|
16881
16974
|
], DocFloatMenuService);
|
|
16882
16975
|
function isRangeInCodeBlock(documentDataModel, range) {
|
|
16883
16976
|
var _documentDataModel$ge3, _documentDataModel$ge4;
|
|
@@ -18326,8 +18419,8 @@ function ParagraphMenuBase({ popup, tableBlockOnly = false }) {
|
|
|
18326
18419
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TargetIcon, {}), (currentActiveTarget === null || currentActiveTarget === void 0 ? void 0 : currentActiveTarget.draggable) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
18327
18420
|
type: "button",
|
|
18328
18421
|
className: "univer-group univer-flex univer-h-4 univer-w-2.5 univer-cursor-grab univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-p-0 active:univer-cursor-grabbing",
|
|
18329
|
-
"aria-label": "
|
|
18330
|
-
title: "
|
|
18422
|
+
"aria-label": localeService.t("docs-ui.doc.blockMenu.dragBlock"),
|
|
18423
|
+
title: localeService.t("docs-ui.doc.blockMenu.dragBlock"),
|
|
18331
18424
|
onPointerDown: (event) => {
|
|
18332
18425
|
var _docParagraphMenuServ4, _event$currentTarget$, _event$currentTarget;
|
|
18333
18426
|
const latestTarget = (_docParagraphMenuServ4 = docParagraphMenuService === null || docParagraphMenuService === void 0 ? void 0 : docParagraphMenuService.activeTarget) !== null && _docParagraphMenuServ4 !== void 0 ? _docParagraphMenuServ4 : activeTarget;
|
|
@@ -18581,10 +18674,8 @@ function useSectionSetting() {
|
|
|
18581
18674
|
const instanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
18582
18675
|
const selectionManager = (0, _univerjs_ui.useDependency)(_univerjs_docs.DocSelectionManagerService);
|
|
18583
18676
|
const documentDataModel = (0, _univerjs_ui.useObservable)((0, react.useMemo)(() => instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC), [instanceService]));
|
|
18584
|
-
(0
|
|
18585
|
-
(0, _univerjs_ui.useObservable)(documentDataModel
|
|
18586
|
-
const ranges = selectionManager.getDocRanges();
|
|
18587
|
-
const sections = (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === _univerjs_core.DocumentFlavor.TRADITIONAL ? getSelectedSections(documentDataModel, ranges) : [];
|
|
18677
|
+
const resolveSections = () => (documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getDocumentStyle().documentFlavor) === _univerjs_core.DocumentFlavor.TRADITIONAL ? getSelectedSections(documentDataModel, selectionManager.getDocRanges()) : [];
|
|
18678
|
+
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]);
|
|
18588
18679
|
const values = getSectionSettingValues(sections);
|
|
18589
18680
|
const update = (updates) => {
|
|
18590
18681
|
if (!documentDataModel || updates.length === 0) return Promise.resolve(false);
|
|
@@ -18637,6 +18728,24 @@ function SectionSetting() {
|
|
|
18637
18728
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
18638
18729
|
const controller = (0, _univerjs_ui.useDependency)(DocSectionSettingController);
|
|
18639
18730
|
const setting = useSectionSetting();
|
|
18731
|
+
const labels = (0, react.useMemo)(() => ({
|
|
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
|
+
]);
|
|
18640
18749
|
(0, react.useEffect)(() => {
|
|
18641
18750
|
if (!setting.valid) controller.closePanel();
|
|
18642
18751
|
}, [controller, setting.valid]);
|
|
@@ -18645,12 +18754,12 @@ function SectionSetting() {
|
|
|
18645
18754
|
className: "univer-box-border univer-w-full",
|
|
18646
18755
|
children: [setting.selectedCount > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
18647
18756
|
className: "univer-mb-4 univer-text-xs univer-text-gray-600 dark:!univer-text-gray-300",
|
|
18648
|
-
children:
|
|
18757
|
+
children: labels.selectedSections
|
|
18649
18758
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18650
18759
|
className: "univer-grid univer-gap-3",
|
|
18651
18760
|
children: [
|
|
18652
18761
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18653
|
-
label:
|
|
18762
|
+
label: labels.columnCount,
|
|
18654
18763
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
18655
18764
|
className: "univer-w-full",
|
|
18656
18765
|
min: 1,
|
|
@@ -18662,7 +18771,7 @@ function SectionSetting() {
|
|
|
18662
18771
|
})
|
|
18663
18772
|
}),
|
|
18664
18773
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18665
|
-
label:
|
|
18774
|
+
label: labels.columnGap,
|
|
18666
18775
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
18667
18776
|
className: "univer-w-full",
|
|
18668
18777
|
min: 0,
|
|
@@ -18674,44 +18783,44 @@ function SectionSetting() {
|
|
|
18674
18783
|
})
|
|
18675
18784
|
}),
|
|
18676
18785
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18677
|
-
label:
|
|
18786
|
+
label: labels.columnSeparator,
|
|
18678
18787
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
18679
18788
|
className: "univer-w-full",
|
|
18680
18789
|
value: setting.separatorType == null ? "" : String(setting.separatorType),
|
|
18681
18790
|
options: [{
|
|
18682
|
-
label:
|
|
18791
|
+
label: labels.none,
|
|
18683
18792
|
value: String(_univerjs_core.ColumnSeparatorType.NONE)
|
|
18684
18793
|
}, {
|
|
18685
|
-
label:
|
|
18794
|
+
label: labels.betweenColumns,
|
|
18686
18795
|
value: String(_univerjs_core.ColumnSeparatorType.BETWEEN_EACH_COLUMN)
|
|
18687
18796
|
}],
|
|
18688
18797
|
onChange: (value) => setting.setSeparatorType(Number(value))
|
|
18689
18798
|
})
|
|
18690
18799
|
}),
|
|
18691
18800
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingRow, {
|
|
18692
|
-
label:
|
|
18801
|
+
label: labels.sectionStart,
|
|
18693
18802
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
|
|
18694
18803
|
className: "univer-w-full",
|
|
18695
18804
|
value: setting.sectionType == null ? "" : String(setting.sectionType),
|
|
18696
18805
|
options: [
|
|
18697
18806
|
{
|
|
18698
|
-
label:
|
|
18807
|
+
label: labels.unspecified,
|
|
18699
18808
|
value: String(_univerjs_core.SectionType.SECTION_TYPE_UNSPECIFIED)
|
|
18700
18809
|
},
|
|
18701
18810
|
{
|
|
18702
|
-
label:
|
|
18811
|
+
label: labels.continuous,
|
|
18703
18812
|
value: String(_univerjs_core.SectionType.CONTINUOUS)
|
|
18704
18813
|
},
|
|
18705
18814
|
{
|
|
18706
|
-
label:
|
|
18815
|
+
label: labels.nextPage,
|
|
18707
18816
|
value: String(_univerjs_core.SectionType.NEXT_PAGE)
|
|
18708
18817
|
},
|
|
18709
18818
|
{
|
|
18710
|
-
label:
|
|
18819
|
+
label: labels.evenPage,
|
|
18711
18820
|
value: String(_univerjs_core.SectionType.EVEN_PAGE)
|
|
18712
18821
|
},
|
|
18713
18822
|
{
|
|
18714
|
-
label:
|
|
18823
|
+
label: labels.oddPage,
|
|
18715
18824
|
value: String(_univerjs_core.SectionType.ODD_PAGE)
|
|
18716
18825
|
}
|
|
18717
18826
|
],
|
|
@@ -18727,7 +18836,6 @@ function SectionSetting() {
|
|
|
18727
18836
|
//#region src/views/section-setting/index.tsx
|
|
18728
18837
|
function SectionSettingIndex() {
|
|
18729
18838
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
18730
|
-
(0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService).currentLocale$);
|
|
18731
18839
|
const [key, setKey] = (0, react.useState)(() => (0, _univerjs_core.generateRandomId)(4));
|
|
18732
18840
|
(0, react.useEffect)(() => {
|
|
18733
18841
|
const disposable = commandService.onCommandExecuted((info) => {
|
|
@@ -18826,6 +18934,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
18826
18934
|
DeleteColumnDoubleIcon: _univerjs_icons.DeleteColumnDoubleIcon,
|
|
18827
18935
|
DeleteIcon: _univerjs_icons.DeleteIcon,
|
|
18828
18936
|
DeleteRowDoubleIcon: _univerjs_icons.DeleteRowDoubleIcon,
|
|
18937
|
+
DeleteTableDoubleIcon: _univerjs_icons.DeleteTableDoubleIcon,
|
|
18829
18938
|
DocSettingIcon: _univerjs_icons.DocSettingIcon,
|
|
18830
18939
|
FontColorDoubleIcon: _univerjs_icons.FontColorDoubleIcon,
|
|
18831
18940
|
GridIcon: _univerjs_icons.GridIcon,
|
|
@@ -18902,6 +19011,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
18902
19011
|
[ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker],
|
|
18903
19012
|
[DOC_PARAGRAPH_MENU_COMPONENT_KEY, ParagraphMenu],
|
|
18904
19013
|
[DOC_TABLE_BLOCK_MENU_COMPONENT_KEY, TableBlockMenu],
|
|
19014
|
+
[FLOAT_MENU_COMPONENT_KEY, FloatToolbar],
|
|
18905
19015
|
[PAGE_SETTING_COMPONENT_ID, PageSettings]
|
|
18906
19016
|
].forEach(([key, comp]) => {
|
|
18907
19017
|
this.disposeWithMe(this._componentManager.register(key, comp));
|
|
@@ -21165,13 +21275,12 @@ const H5HeadingShortcut = headingShortcut(H5HeadingCommand.id, _univerjs_ui.KeyC
|
|
|
21165
21275
|
//#endregion
|
|
21166
21276
|
//#region src/plugin.ts
|
|
21167
21277
|
let UniverDocsUIPlugin = class UniverDocsUIPlugin extends _univerjs_core.Plugin {
|
|
21168
|
-
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _commandService,
|
|
21278
|
+
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _commandService, _configService) {
|
|
21169
21279
|
super();
|
|
21170
21280
|
this._config = _config;
|
|
21171
21281
|
this._injector = _injector;
|
|
21172
21282
|
this._renderManagerSrv = _renderManagerSrv;
|
|
21173
21283
|
this._commandService = _commandService;
|
|
21174
|
-
this._logService = _logService;
|
|
21175
21284
|
this._configService = _configService;
|
|
21176
21285
|
const { menu, ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
|
|
21177
21286
|
if (menu) this._configService.setConfig("menu", menu, { merge: true });
|
|
@@ -21182,7 +21291,7 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends _univerjs_core.Plugin
|
|
|
21182
21291
|
}
|
|
21183
21292
|
onReady() {
|
|
21184
21293
|
this._initRenderBasics();
|
|
21185
|
-
this.
|
|
21294
|
+
this._initAutoFocus();
|
|
21186
21295
|
(0, _univerjs_core.touchDependencies)(this._injector, [[DocsRenderService]]);
|
|
21187
21296
|
}
|
|
21188
21297
|
onRendered() {
|
|
@@ -21362,19 +21471,14 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends _univerjs_core.Plugin
|
|
|
21362
21471
|
[DocMenuStyleService]
|
|
21363
21472
|
], this._config.override).forEach((d) => injector.add(d));
|
|
21364
21473
|
}
|
|
21365
|
-
|
|
21474
|
+
_initAutoFocus() {
|
|
21366
21475
|
const currentService = this._injector.get(_univerjs_core.IUniverInstanceService);
|
|
21367
21476
|
const editorService = this._injector.get(IEditorService);
|
|
21368
|
-
|
|
21369
|
-
const doc = currentService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
21477
|
+
this.disposeWithMe(currentService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).subscribe((doc) => {
|
|
21370
21478
|
if (!doc) return;
|
|
21371
21479
|
const id = doc.getUnitId();
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
if (!editorService.isEditor(id)) currentService.focusUnit(doc.getUnitId());
|
|
21375
|
-
} catch (err) {
|
|
21376
|
-
this._logService.warn(err);
|
|
21377
|
-
}
|
|
21480
|
+
if (!editorService.isEditor(id)) currentService.focusUnit(id);
|
|
21481
|
+
}));
|
|
21378
21482
|
}
|
|
21379
21483
|
_initRenderBasics() {
|
|
21380
21484
|
[
|
|
@@ -21419,8 +21523,7 @@ UniverDocsUIPlugin = __decorate([
|
|
|
21419
21523
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
21420
21524
|
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
21421
21525
|
__decorateParam(3, _univerjs_core.ICommandService),
|
|
21422
|
-
__decorateParam(4, _univerjs_core.
|
|
21423
|
-
__decorateParam(5, _univerjs_core.IConfigService)
|
|
21526
|
+
__decorateParam(4, _univerjs_core.IConfigService)
|
|
21424
21527
|
], UniverDocsUIPlugin);
|
|
21425
21528
|
|
|
21426
21529
|
//#endregion
|
|
@@ -21876,6 +21979,7 @@ const useResize = (editor, isSingle = true, autoScrollbar, autoScroll) => {
|
|
|
21876
21979
|
//#endregion
|
|
21877
21980
|
//#region src/views/RichTextEditor.tsx
|
|
21878
21981
|
const RichTextEditor = (props) => {
|
|
21982
|
+
var _docSelectionRenderSe3;
|
|
21879
21983
|
const { className, autoFocus, onFocusChange: _onFocusChange, initialValue, onClickOutside: _onClickOutside, keyboardEventConfig, moveCursor = true, style, isSingle, editorId: propsEditorId, onHeightChange, onChange: _onChange, defaultHeight = 32, maxHeight = 32, icon, editorRef, placeholder, noStyle } = props;
|
|
21880
21984
|
(0, _univerjs_ui.useDependency)(IEditorService);
|
|
21881
21985
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
@@ -21893,12 +21997,22 @@ const RichTextEditor = (props) => {
|
|
|
21893
21997
|
isSingle
|
|
21894
21998
|
});
|
|
21895
21999
|
const renderer = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.IRenderManagerService).getRenderById(editorId);
|
|
21896
|
-
const
|
|
22000
|
+
const selectionIsFocusing = useIsFocusing(editorId);
|
|
22001
|
+
const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
|
|
22002
|
+
const editorFocused = (0, _univerjs_ui.useObservable)(editor ? () => {
|
|
22003
|
+
var _docSelectionRenderSe2;
|
|
22004
|
+
return (0, rxjs.merge)(editor.focus$, editor.blur$).pipe((0, rxjs.map)(() => {
|
|
22005
|
+
var _docSelectionRenderSe;
|
|
22006
|
+
return (_docSelectionRenderSe = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : false;
|
|
22007
|
+
}), (0, rxjs.startWith)((_docSelectionRenderSe2 = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing) !== null && _docSelectionRenderSe2 !== void 0 ? _docSelectionRenderSe2 : false));
|
|
22008
|
+
} : null, (_docSelectionRenderSe3 = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing) !== null && _docSelectionRenderSe3 !== void 0 ? _docSelectionRenderSe3 : false, false, [docSelectionRenderService, editor]);
|
|
22009
|
+
const isFocusing = selectionIsFocusing && editorFocused;
|
|
21897
22010
|
const sheetEmbeddingRef = (0, react.useRef)(null);
|
|
21898
|
-
const
|
|
22011
|
+
const resolveShowPlaceholder = () => {
|
|
21899
22012
|
var _editor$getDocumentDa, _editor$getDocumentDa2;
|
|
21900
22013
|
return !_univerjs_core.BuildTextUtils.transform.getPlainText((_editor$getDocumentDa = editor === null || editor === void 0 || (_editor$getDocumentDa2 = editor.getDocumentData().body) === null || _editor$getDocumentDa2 === void 0 ? void 0 : _editor$getDocumentDa2.dataStream) !== null && _editor$getDocumentDa !== void 0 ? _editor$getDocumentDa : "");
|
|
21901
|
-
}
|
|
22014
|
+
};
|
|
22015
|
+
const showPlaceholder = (0, _univerjs_ui.useObservable)(editor ? () => editor.selectionChange$.pipe((0, rxjs.map)(resolveShowPlaceholder), (0, rxjs.startWith)(resolveShowPlaceholder())) : null, resolveShowPlaceholder(), false, [editor]);
|
|
21902
22016
|
const { checkScrollBar } = useResize(editor, isSingle, true, true);
|
|
21903
22017
|
(0, react.useLayoutEffect)(() => {
|
|
21904
22018
|
if (!editorRef || !editor) return;
|
|
@@ -21919,17 +22033,6 @@ const RichTextEditor = (props) => {
|
|
|
21919
22033
|
_onChange === null || _onChange === void 0 || _onChange(data, (0, _univerjs_core.getPlainText)((_data$body$dataStream = (_data$body = data.body) === null || _data$body === void 0 ? void 0 : _data$body.dataStream) !== null && _data$body$dataStream !== void 0 ? _data$body$dataStream : ""));
|
|
21920
22034
|
checkScrollBar();
|
|
21921
22035
|
});
|
|
21922
|
-
(0, react.useEffect)(() => {
|
|
21923
|
-
var _editor$getDocumentDa3, _editor$getDocumentDa4;
|
|
21924
|
-
setShowPlaceholder(!_univerjs_core.BuildTextUtils.transform.getPlainText((_editor$getDocumentDa3 = editor === null || editor === void 0 || (_editor$getDocumentDa4 = editor.getDocumentData().body) === null || _editor$getDocumentDa4 === void 0 ? void 0 : _editor$getDocumentDa4.dataStream) !== null && _editor$getDocumentDa3 !== void 0 ? _editor$getDocumentDa3 : ""));
|
|
21925
|
-
const sub = editor === null || editor === void 0 ? void 0 : editor.selectionChange$.subscribe(() => {
|
|
21926
|
-
var _editor$getDocumentDa5, _editor$getDocumentDa6;
|
|
21927
|
-
setShowPlaceholder(!_univerjs_core.BuildTextUtils.transform.getPlainText((_editor$getDocumentDa5 = editor === null || editor === void 0 || (_editor$getDocumentDa6 = editor.getDocumentData().body) === null || _editor$getDocumentDa6 === void 0 ? void 0 : _editor$getDocumentDa6.dataStream) !== null && _editor$getDocumentDa5 !== void 0 ? _editor$getDocumentDa5 : ""));
|
|
21928
|
-
});
|
|
21929
|
-
return () => sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
|
|
21930
|
-
}, [editor]);
|
|
21931
|
-
(0, _univerjs_ui.useObservable)(editor === null || editor === void 0 ? void 0 : editor.blur$);
|
|
21932
|
-
(0, _univerjs_ui.useObservable)(editor === null || editor === void 0 ? void 0 : editor.focus$);
|
|
21933
22036
|
(0, react.useEffect)(() => {
|
|
21934
22037
|
var _data$body$dataStream2, _data$body2;
|
|
21935
22038
|
const data = editor === null || editor === void 0 ? void 0 : editor.getDocumentData();
|
|
@@ -22243,7 +22346,6 @@ Object.defineProperty(exports, 'createRemoveCustomBlockActions', {
|
|
|
22243
22346
|
});
|
|
22244
22347
|
exports.deleteCustomDecorationFactory = deleteCustomDecorationFactory;
|
|
22245
22348
|
exports.disableMenuWhenHeaderFooterEditing = disableMenuWhenHeaderFooterEditing;
|
|
22246
|
-
exports.docDrawingPositionToTransform = docDrawingPositionToTransform;
|
|
22247
22349
|
exports.executeEditorUndoRedoCommand = executeEditorUndoRedoCommand;
|
|
22248
22350
|
exports.genTableSource = genTableSource;
|
|
22249
22351
|
exports.generateParagraphs = _univerjs_docs.generateParagraphs;
|
|
@@ -22251,7 +22353,6 @@ exports.getAnchorBounding = getAnchorBounding;
|
|
|
22251
22353
|
exports.getCanvasOffsetByEngine = getCanvasOffsetByEngine;
|
|
22252
22354
|
exports.getCommandSkeleton = getCommandSkeleton;
|
|
22253
22355
|
exports.getCursorWhenDelete = getCursorWhenDelete;
|
|
22254
|
-
exports.getCustomBlockIdsInSelections = getCustomBlockIdsInSelections;
|
|
22255
22356
|
exports.getCutActionsFromDocRanges = getCutActionsFromDocRanges;
|
|
22256
22357
|
exports.getDocBlockRangeMenuId = getDocBlockRangeMenuId;
|
|
22257
22358
|
exports.getDocObject = getDocObject;
|
|
@@ -22291,7 +22392,6 @@ exports.resolveDocsTableLikeCustomBlockContentHeight = resolveDocsTableLikeCusto
|
|
|
22291
22392
|
exports.resolveDocsTableLikeCustomBlockContentWidth = resolveDocsTableLikeCustomBlockContentWidth;
|
|
22292
22393
|
exports.scrollDocsTableLikeCustomBlockLive = scrollDocsTableLikeCustomBlockLive;
|
|
22293
22394
|
exports.shouldRefreshDocsCustomBlockSizeForCommand = shouldRefreshDocsCustomBlockSizeForCommand;
|
|
22294
|
-
exports.transformToDocDrawingPosition = transformToDocDrawingPosition;
|
|
22295
22395
|
exports.useEditor = useEditor;
|
|
22296
22396
|
exports.useEditorClickOutside = useEditorClickOutside;
|
|
22297
22397
|
exports.useIsFocusing = useIsFocusing;
|