@univerjs/docs-ui 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/lib/cjs/facade.js +6 -6
- package/lib/cjs/index.js +152 -199
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +150 -197
- package/lib/facade.js +6 -6
- package/lib/index.css +12 -0
- package/lib/index.js +150 -197
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-lark.d.ts +2 -2
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-univer.d.ts +2 -2
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-word.d.ts +2 -2
- package/lib/umd/index.js +9 -9
- package/package.json +19 -15
package/lib/cjs/index.js
CHANGED
|
@@ -51,7 +51,7 @@ function neoGetDocObject(renderContext) {
|
|
|
51
51
|
const { mainComponent, scene, engine, components } = renderContext;
|
|
52
52
|
return {
|
|
53
53
|
document: mainComponent,
|
|
54
|
-
docBackground: components.get(
|
|
54
|
+
docBackground: components.get("__Document_Render_Background__"),
|
|
55
55
|
scene,
|
|
56
56
|
engine
|
|
57
57
|
};
|
|
@@ -66,7 +66,7 @@ function getDocObject(univerInstanceService, renderManagerService) {
|
|
|
66
66
|
const { mainComponent, scene, engine, components } = currentRender;
|
|
67
67
|
return {
|
|
68
68
|
document: mainComponent,
|
|
69
|
-
docBackground: components.get(
|
|
69
|
+
docBackground: components.get("__Document_Render_Background__"),
|
|
70
70
|
scene,
|
|
71
71
|
engine
|
|
72
72
|
};
|
|
@@ -77,7 +77,7 @@ function getDocObjectById(unitId, renderManagerService) {
|
|
|
77
77
|
const { mainComponent, scene, engine, components } = currentRender;
|
|
78
78
|
return {
|
|
79
79
|
document: mainComponent,
|
|
80
|
-
docBackground: components.get(
|
|
80
|
+
docBackground: components.get("__Document_Render_Background__"),
|
|
81
81
|
scene,
|
|
82
82
|
engine
|
|
83
83
|
};
|
|
@@ -230,7 +230,7 @@ function transformToDocDrawingPosition(transform, marginLeft = 0, marginTop = 0)
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
//#endregion
|
|
233
|
-
//#region \0@oxc-project+runtime@0.
|
|
233
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
234
234
|
function _typeof(o) {
|
|
235
235
|
"@babel/helpers - typeof";
|
|
236
236
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -241,7 +241,7 @@ function _typeof(o) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
//#endregion
|
|
244
|
-
//#region \0@oxc-project+runtime@0.
|
|
244
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
245
245
|
function toPrimitive(t, r) {
|
|
246
246
|
if ("object" != _typeof(t) || !t) return t;
|
|
247
247
|
var e = t[Symbol.toPrimitive];
|
|
@@ -254,14 +254,14 @@ function toPrimitive(t, r) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
//#endregion
|
|
257
|
-
//#region \0@oxc-project+runtime@0.
|
|
257
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
258
258
|
function toPropertyKey(t) {
|
|
259
259
|
var i = toPrimitive(t, "string");
|
|
260
260
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
//#endregion
|
|
264
|
-
//#region \0@oxc-project+runtime@0.
|
|
264
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
265
265
|
function _defineProperty(e, r, t) {
|
|
266
266
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
267
267
|
value: t,
|
|
@@ -272,7 +272,7 @@ function _defineProperty(e, r, t) {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
//#endregion
|
|
275
|
-
//#region \0@oxc-project+runtime@0.
|
|
275
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
|
|
276
276
|
function __decorateParam(paramIndex, decorator) {
|
|
277
277
|
return function(target, key) {
|
|
278
278
|
decorator(target, key, paramIndex);
|
|
@@ -280,7 +280,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
//#endregion
|
|
283
|
-
//#region \0@oxc-project+runtime@0.
|
|
283
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
|
|
284
284
|
function __decorate(decorators, target, key, desc) {
|
|
285
285
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
286
286
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -371,7 +371,13 @@ const EnterCommand = {
|
|
|
371
371
|
const BODY_DEFAULT_FONTSIZE = 11;
|
|
372
372
|
const HEADER_FOOTER_DEFAULT_FONTSIZE = 9;
|
|
373
373
|
const DEFAULT_TEXT_STYLE = {
|
|
374
|
+
/**
|
|
375
|
+
* fontFamily
|
|
376
|
+
*/
|
|
374
377
|
ff: "Arial",
|
|
378
|
+
/**
|
|
379
|
+
* fontSize
|
|
380
|
+
*/
|
|
375
381
|
fs: BODY_DEFAULT_FONTSIZE
|
|
376
382
|
};
|
|
377
383
|
let DocMenuStyleService = class DocMenuStyleService extends _univerjs_core.Disposable {
|
|
@@ -595,16 +601,6 @@ const BreakLineCommand = {
|
|
|
595
601
|
|
|
596
602
|
//#endregion
|
|
597
603
|
//#region src/commands/commands/table/table.ts
|
|
598
|
-
let INSERT_ROW_POSITION = /* @__PURE__ */ function(INSERT_ROW_POSITION) {
|
|
599
|
-
INSERT_ROW_POSITION[INSERT_ROW_POSITION["ABOVE"] = 0] = "ABOVE";
|
|
600
|
-
INSERT_ROW_POSITION[INSERT_ROW_POSITION["BELLOW"] = 1] = "BELLOW";
|
|
601
|
-
return INSERT_ROW_POSITION;
|
|
602
|
-
}({});
|
|
603
|
-
let INSERT_COLUMN_POSITION = /* @__PURE__ */ function(INSERT_COLUMN_POSITION) {
|
|
604
|
-
INSERT_COLUMN_POSITION[INSERT_COLUMN_POSITION["LEFT"] = 0] = "LEFT";
|
|
605
|
-
INSERT_COLUMN_POSITION[INSERT_COLUMN_POSITION["RIGHT"] = 1] = "RIGHT";
|
|
606
|
-
return INSERT_COLUMN_POSITION;
|
|
607
|
-
}({});
|
|
608
604
|
function genEmptyTable(rowCount, colCount) {
|
|
609
605
|
let dataStream = _univerjs_core.DataStreamTreeTokenType.TABLE_START;
|
|
610
606
|
const paragraphs = [];
|
|
@@ -767,7 +763,7 @@ function getInsertRowActionsParams(rangeInfo, position, viewModel) {
|
|
|
767
763
|
var _viewModel$getBody;
|
|
768
764
|
const { startOffset, endOffset, segmentId } = rangeInfo;
|
|
769
765
|
const vm = viewModel.getSelfOrHeaderFooterViewModel(segmentId);
|
|
770
|
-
const index = position ===
|
|
766
|
+
const index = position === 0 ? startOffset : endOffset;
|
|
771
767
|
let tableRow = null;
|
|
772
768
|
const tableId = (_viewModel$getBody = viewModel.getBody()) === null || _viewModel$getBody === void 0 || (_viewModel$getBody = _viewModel$getBody.tables) === null || _viewModel$getBody === void 0 || (_viewModel$getBody = _viewModel$getBody.find((t) => index >= t.startIndex && index <= t.endIndex)) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.tableId;
|
|
773
769
|
let rowIndex = 0;
|
|
@@ -788,17 +784,17 @@ function getInsertRowActionsParams(rangeInfo, position, viewModel) {
|
|
|
788
784
|
}
|
|
789
785
|
if (tableRow == null || tableId == null) return null;
|
|
790
786
|
return {
|
|
791
|
-
offset: position ===
|
|
787
|
+
offset: position === 0 ? tableRow.startIndex : tableRow.endIndex + 1,
|
|
792
788
|
colCount: tableRow.children.length,
|
|
793
789
|
tableId,
|
|
794
|
-
insertRowIndex: position ===
|
|
790
|
+
insertRowIndex: position === 0 ? rowIndex : rowIndex + 1
|
|
795
791
|
};
|
|
796
792
|
}
|
|
797
793
|
function getInsertColumnActionsParams(rangeInfo, position, viewModel) {
|
|
798
794
|
var _viewModel$getBody2;
|
|
799
795
|
const { startOffset, endOffset, segmentId } = rangeInfo;
|
|
800
796
|
const vm = viewModel.getSelfOrHeaderFooterViewModel(segmentId);
|
|
801
|
-
const index = position ===
|
|
797
|
+
const index = position === 0 ? startOffset : endOffset;
|
|
802
798
|
const tableId = (_viewModel$getBody2 = viewModel.getBody()) === null || _viewModel$getBody2 === void 0 || (_viewModel$getBody2 = _viewModel$getBody2.tables) === null || _viewModel$getBody2 === void 0 || (_viewModel$getBody2 = _viewModel$getBody2.find((t) => index >= t.startIndex && index <= t.endIndex)) === null || _viewModel$getBody2 === void 0 ? void 0 : _viewModel$getBody2.tableId;
|
|
803
799
|
const offsets = [];
|
|
804
800
|
let table = null;
|
|
@@ -829,7 +825,7 @@ function getInsertColumnActionsParams(rangeInfo, position, viewModel) {
|
|
|
829
825
|
let cursor = 0;
|
|
830
826
|
for (const row of table.children) {
|
|
831
827
|
const cell = row.children[columnIndex];
|
|
832
|
-
const insertIndex = position ===
|
|
828
|
+
const insertIndex = position === 0 ? cell.startIndex : cell.endIndex + 1;
|
|
833
829
|
offsets.push(insertIndex - cursor);
|
|
834
830
|
cursor = insertIndex;
|
|
835
831
|
}
|
|
@@ -1032,11 +1028,6 @@ function getDeleteRowContentActionParams(rangeInfo, viewModel) {
|
|
|
1032
1028
|
rowCount: table.children.length
|
|
1033
1029
|
};
|
|
1034
1030
|
}
|
|
1035
|
-
let CellPosition = /* @__PURE__ */ function(CellPosition) {
|
|
1036
|
-
CellPosition[CellPosition["NEXT"] = 0] = "NEXT";
|
|
1037
|
-
CellPosition[CellPosition["PREV"] = 1] = "PREV";
|
|
1038
|
-
return CellPosition;
|
|
1039
|
-
}({});
|
|
1040
1031
|
function getCellOffsets(viewModel, range, position) {
|
|
1041
1032
|
const { startOffset } = range;
|
|
1042
1033
|
let targetTable = null;
|
|
@@ -1067,7 +1058,7 @@ function getCellOffsets(viewModel, range, position) {
|
|
|
1067
1058
|
}
|
|
1068
1059
|
if (cellIndex === -1 || rowIndex === -1 || targetRow == null) return null;
|
|
1069
1060
|
let newCell = null;
|
|
1070
|
-
if (position ===
|
|
1061
|
+
if (position === 0) {
|
|
1071
1062
|
newCell = targetRow.children[cellIndex + 1];
|
|
1072
1063
|
if (!newCell) {
|
|
1073
1064
|
const nextRow = targetTable.children[rowIndex + 1];
|
|
@@ -1394,29 +1385,6 @@ const CutContentCommand = {
|
|
|
1394
1385
|
}
|
|
1395
1386
|
};
|
|
1396
1387
|
|
|
1397
|
-
//#endregion
|
|
1398
|
-
//#region src/types/delete-direction.ts
|
|
1399
|
-
/**
|
|
1400
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1401
|
-
*
|
|
1402
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1403
|
-
* you may not use this file except in compliance with the License.
|
|
1404
|
-
* You may obtain a copy of the License at
|
|
1405
|
-
*
|
|
1406
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1407
|
-
*
|
|
1408
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1409
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1410
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1411
|
-
* See the License for the specific language governing permissions and
|
|
1412
|
-
* limitations under the License.
|
|
1413
|
-
*/
|
|
1414
|
-
let DeleteDirection = /* @__PURE__ */ function(DeleteDirection) {
|
|
1415
|
-
DeleteDirection[DeleteDirection["LEFT"] = 0] = "LEFT";
|
|
1416
|
-
DeleteDirection[DeleteDirection["RIGHT"] = 1] = "RIGHT";
|
|
1417
|
-
return DeleteDirection;
|
|
1418
|
-
}({});
|
|
1419
|
-
|
|
1420
1388
|
//#endregion
|
|
1421
1389
|
//#region src/commands/commands/core-editing.command.ts
|
|
1422
1390
|
const EditorInsertTextCommandId = "doc.command.insert-text";
|
|
@@ -1495,8 +1463,8 @@ const DeleteCommand = {
|
|
|
1495
1463
|
const body = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
|
|
1496
1464
|
if (docDataModel == null || body == null) return false;
|
|
1497
1465
|
const { startOffset } = range;
|
|
1498
|
-
let start = direction ===
|
|
1499
|
-
let end = direction ===
|
|
1466
|
+
let start = direction === 0 ? startOffset - len : startOffset;
|
|
1467
|
+
let end = direction === 0 ? startOffset - 1 : startOffset + len - 1;
|
|
1500
1468
|
const customRange = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((customRange) => customRange.startIndex <= start && customRange.endIndex >= end);
|
|
1501
1469
|
if (customRange === null || customRange === void 0 ? void 0 : customRange.wholeEntity) {
|
|
1502
1470
|
start = customRange.startIndex;
|
|
@@ -1596,7 +1564,7 @@ const DeleteCustomBlockCommand = {
|
|
|
1596
1564
|
if (activeRange == null || documentDataModel == null) return false;
|
|
1597
1565
|
const { direction, range, unitId, drawingId } = params;
|
|
1598
1566
|
const { startOffset, segmentId, style } = activeRange;
|
|
1599
|
-
const cursor = direction ===
|
|
1567
|
+
const cursor = direction === 0 ? startOffset - 1 : startOffset;
|
|
1600
1568
|
const textRanges = [{
|
|
1601
1569
|
startOffset: cursor,
|
|
1602
1570
|
endOffset: cursor,
|
|
@@ -1616,7 +1584,7 @@ const DeleteCustomBlockCommand = {
|
|
|
1616
1584
|
const rawActions = [];
|
|
1617
1585
|
if (startOffset > 0) textX.push({
|
|
1618
1586
|
t: _univerjs_core.TextXActionType.RETAIN,
|
|
1619
|
-
len: direction ===
|
|
1587
|
+
len: direction === 0 ? startOffset - 1 : startOffset
|
|
1620
1588
|
});
|
|
1621
1589
|
textX.push({
|
|
1622
1590
|
t: _univerjs_core.TextXActionType.DELETE,
|
|
@@ -1657,7 +1625,7 @@ const MergeTwoParagraphCommand = {
|
|
|
1657
1625
|
const unitId = docDataModel.getUnitId();
|
|
1658
1626
|
const { startOffset, collapsed } = actualRange;
|
|
1659
1627
|
if (!collapsed) return false;
|
|
1660
|
-
const startIndex = direction ===
|
|
1628
|
+
const startIndex = direction === 0 ? startOffset : startOffset + 1;
|
|
1661
1629
|
let curParagraph;
|
|
1662
1630
|
let nextParagraph;
|
|
1663
1631
|
for (const paragraph of originBody.paragraphs) {
|
|
@@ -1668,7 +1636,7 @@ const MergeTwoParagraphCommand = {
|
|
|
1668
1636
|
curParagraph = paragraph;
|
|
1669
1637
|
}
|
|
1670
1638
|
if (curParagraph == null || nextParagraph == null) return false;
|
|
1671
|
-
const cursor = direction ===
|
|
1639
|
+
const cursor = direction === 0 ? startOffset - 1 : startOffset;
|
|
1672
1640
|
const textRanges = [{
|
|
1673
1641
|
startOffset: cursor,
|
|
1674
1642
|
endOffset: cursor,
|
|
@@ -1896,7 +1864,7 @@ const DeleteLeftCommand = {
|
|
|
1896
1864
|
const paragraph = (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.find((p) => p.startIndex === startOffset - 1);
|
|
1897
1865
|
if (paragraph === null || paragraph === void 0 || (_paragraph$paragraphS = paragraph.paragraphStyle) === null || _paragraph$paragraphS === void 0 ? void 0 : _paragraph$paragraphS.borderBottom) result = await commandService.executeCommand(RemoveHorizontalLineCommand.id);
|
|
1898
1866
|
else result = await commandService.executeCommand(MergeTwoParagraphCommand.id, {
|
|
1899
|
-
direction:
|
|
1867
|
+
direction: 0,
|
|
1900
1868
|
range: actualRange
|
|
1901
1869
|
});
|
|
1902
1870
|
} else if (preGlyph.streamType === "\b") {
|
|
@@ -1907,7 +1875,7 @@ const DeleteLeftCommand = {
|
|
|
1907
1875
|
if (drawing.layoutType === _univerjs_core.PositionedObjectLayoutType.INLINE || (customBlock === null || customBlock === void 0 ? void 0 : customBlock.blockType) === _univerjs_core.BlockType.CUSTOM) {
|
|
1908
1876
|
const unitId = docDataModel.getUnitId();
|
|
1909
1877
|
result = await commandService.executeCommand(DeleteCustomBlockCommand.id, {
|
|
1910
|
-
direction:
|
|
1878
|
+
direction: 0,
|
|
1911
1879
|
range: activeRange,
|
|
1912
1880
|
unitId,
|
|
1913
1881
|
drawingId: preGlyph.drawingId
|
|
@@ -1930,7 +1898,7 @@ const DeleteLeftCommand = {
|
|
|
1930
1898
|
endOffset: activeRange.endOffset - 1
|
|
1931
1899
|
},
|
|
1932
1900
|
segmentId,
|
|
1933
|
-
direction:
|
|
1901
|
+
direction: 0,
|
|
1934
1902
|
len: prePreGlyph.count,
|
|
1935
1903
|
textRanges
|
|
1936
1904
|
});
|
|
@@ -1941,7 +1909,7 @@ const DeleteLeftCommand = {
|
|
|
1941
1909
|
unitId: docDataModel.getUnitId(),
|
|
1942
1910
|
range: actualRange,
|
|
1943
1911
|
segmentId,
|
|
1944
|
-
direction:
|
|
1912
|
+
direction: 0,
|
|
1945
1913
|
len: preGlyph.count
|
|
1946
1914
|
});
|
|
1947
1915
|
}
|
|
@@ -1994,7 +1962,7 @@ const DeleteRightCommand = {
|
|
|
1994
1962
|
const nextGlyph = skeleton.findNodeByCharIndex(startOffset + 1);
|
|
1995
1963
|
if (needDeleteGlyph.streamType === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH && (nextGlyph === null || nextGlyph === void 0 ? void 0 : nextGlyph.streamType) === _univerjs_core.DataStreamTreeTokenType.SECTION_BREAK) return false;
|
|
1996
1964
|
if (needDeleteGlyph.content === "\r") result = await commandService.executeCommand(MergeTwoParagraphCommand.id, {
|
|
1997
|
-
direction:
|
|
1965
|
+
direction: 1,
|
|
1998
1966
|
range: activeRange
|
|
1999
1967
|
});
|
|
2000
1968
|
else if (needDeleteGlyph.streamType === "\b") {
|
|
@@ -2004,7 +1972,7 @@ const DeleteRightCommand = {
|
|
|
2004
1972
|
if (drawing.layoutType === _univerjs_core.PositionedObjectLayoutType.INLINE) {
|
|
2005
1973
|
const unitId = docDataModel.getUnitId();
|
|
2006
1974
|
result = await commandService.executeCommand(DeleteCustomBlockCommand.id, {
|
|
2007
|
-
direction:
|
|
1975
|
+
direction: 1,
|
|
2008
1976
|
range: activeRange,
|
|
2009
1977
|
unitId,
|
|
2010
1978
|
drawingId: needDeleteGlyph.drawingId
|
|
@@ -2024,7 +1992,7 @@ const DeleteRightCommand = {
|
|
|
2024
1992
|
endOffset: endOffset + 1
|
|
2025
1993
|
},
|
|
2026
1994
|
segmentId,
|
|
2027
|
-
direction:
|
|
1995
|
+
direction: 1,
|
|
2028
1996
|
textRanges,
|
|
2029
1997
|
len: nextGlyph.count
|
|
2030
1998
|
});
|
|
@@ -2039,7 +2007,7 @@ const DeleteRightCommand = {
|
|
|
2039
2007
|
unitId: docDataModel.getUnitId(),
|
|
2040
2008
|
range: actualRange,
|
|
2041
2009
|
segmentId,
|
|
2042
|
-
direction:
|
|
2010
|
+
direction: 1,
|
|
2043
2011
|
textRanges,
|
|
2044
2012
|
len: needDeleteGlyph.count
|
|
2045
2013
|
});
|
|
@@ -2448,7 +2416,7 @@ _defineProperty(HtmlToUDMService, "_pluginList", []);
|
|
|
2448
2416
|
|
|
2449
2417
|
//#endregion
|
|
2450
2418
|
//#region src/services/clipboard/html-to-udm/paste-plugins/plugin-lark.ts
|
|
2451
|
-
const
|
|
2419
|
+
const LarkPastePlugin = {
|
|
2452
2420
|
name: "univer-doc-paste-plugin-lark",
|
|
2453
2421
|
checkPasteType(html) {
|
|
2454
2422
|
return /lark-record-clipboard/i.test(html);
|
|
@@ -2509,7 +2477,7 @@ function getParagraphStyle(el) {
|
|
|
2509
2477
|
|
|
2510
2478
|
//#endregion
|
|
2511
2479
|
//#region src/services/clipboard/html-to-udm/paste-plugins/plugin-univer.ts
|
|
2512
|
-
const
|
|
2480
|
+
const UniverPastePlugin = {
|
|
2513
2481
|
name: "univer-doc-paste-plugin-univer",
|
|
2514
2482
|
checkPasteType(html) {
|
|
2515
2483
|
return /UniverNormal/i.test(html);
|
|
@@ -2533,7 +2501,7 @@ const univerPastePlugin = {
|
|
|
2533
2501
|
|
|
2534
2502
|
//#endregion
|
|
2535
2503
|
//#region src/services/clipboard/html-to-udm/paste-plugins/plugin-word.ts
|
|
2536
|
-
const
|
|
2504
|
+
const WordPastePlugin = {
|
|
2537
2505
|
name: "univer-doc-paste-plugin-word",
|
|
2538
2506
|
checkPasteType(html) {
|
|
2539
2507
|
return /word|mso/i.test(html);
|
|
@@ -2759,9 +2727,9 @@ var UDMToHtmlService = class {
|
|
|
2759
2727
|
|
|
2760
2728
|
//#endregion
|
|
2761
2729
|
//#region src/services/clipboard/clipboard.service.ts
|
|
2762
|
-
HtmlToUDMService.use(
|
|
2763
|
-
HtmlToUDMService.use(
|
|
2764
|
-
HtmlToUDMService.use(
|
|
2730
|
+
HtmlToUDMService.use(LarkPastePlugin);
|
|
2731
|
+
HtmlToUDMService.use(UniverPastePlugin);
|
|
2732
|
+
HtmlToUDMService.use(WordPastePlugin);
|
|
2765
2733
|
function getTableSlice(body, start, end) {
|
|
2766
2734
|
var _bodySlice$textRuns, _bodySlice$tables, _bodySlice$paragraphs;
|
|
2767
2735
|
const bodySlice = (0, _univerjs_core.getBodySlice)(body, start, end + 2);
|
|
@@ -4671,12 +4639,6 @@ const SubtitleHeadingCommand = {
|
|
|
4671
4639
|
|
|
4672
4640
|
//#endregion
|
|
4673
4641
|
//#region src/services/selection/convert-text-range.ts
|
|
4674
|
-
let NodePositionStateType = /* @__PURE__ */ function(NodePositionStateType) {
|
|
4675
|
-
NodePositionStateType[NodePositionStateType["NORMAL"] = 0] = "NORMAL";
|
|
4676
|
-
NodePositionStateType[NodePositionStateType["START"] = 1] = "START";
|
|
4677
|
-
NodePositionStateType[NodePositionStateType["END"] = 2] = "END";
|
|
4678
|
-
return NodePositionStateType;
|
|
4679
|
-
}({});
|
|
4680
4642
|
let NodePositionType = /* @__PURE__ */ function(NodePositionType) {
|
|
4681
4643
|
NodePositionType[NodePositionType["page"] = 0] = "page";
|
|
4682
4644
|
NodePositionType[NodePositionType["section"] = 1] = "section";
|
|
@@ -4775,20 +4737,20 @@ var NodePositionConvertToCursor = class {
|
|
|
4775
4737
|
this._docSkeleton = _docSkeleton;
|
|
4776
4738
|
_defineProperty(this, "_liquid", new _univerjs_engine_render.Liquid());
|
|
4777
4739
|
_defineProperty(this, "_currentStartState", {
|
|
4778
|
-
page:
|
|
4779
|
-
section:
|
|
4780
|
-
column:
|
|
4781
|
-
line:
|
|
4782
|
-
divide:
|
|
4783
|
-
glyph:
|
|
4740
|
+
page: 0,
|
|
4741
|
+
section: 0,
|
|
4742
|
+
column: 0,
|
|
4743
|
+
line: 0,
|
|
4744
|
+
divide: 0,
|
|
4745
|
+
glyph: 0
|
|
4784
4746
|
});
|
|
4785
4747
|
_defineProperty(this, "_currentEndState", {
|
|
4786
|
-
page:
|
|
4787
|
-
section:
|
|
4788
|
-
column:
|
|
4789
|
-
line:
|
|
4790
|
-
divide:
|
|
4791
|
-
glyph:
|
|
4748
|
+
page: 0,
|
|
4749
|
+
section: 0,
|
|
4750
|
+
column: 0,
|
|
4751
|
+
line: 0,
|
|
4752
|
+
divide: 0,
|
|
4753
|
+
glyph: 0
|
|
4792
4754
|
});
|
|
4793
4755
|
}
|
|
4794
4756
|
getRangePointData(startOrigin, endOrigin) {
|
|
@@ -4875,27 +4837,27 @@ var NodePositionConvertToCursor = class {
|
|
|
4875
4837
|
}
|
|
4876
4838
|
_resetCurrentNodePositionState() {
|
|
4877
4839
|
this._currentStartState = {
|
|
4878
|
-
page:
|
|
4879
|
-
section:
|
|
4880
|
-
column:
|
|
4881
|
-
line:
|
|
4882
|
-
divide:
|
|
4883
|
-
glyph:
|
|
4840
|
+
page: 0,
|
|
4841
|
+
section: 0,
|
|
4842
|
+
column: 0,
|
|
4843
|
+
line: 0,
|
|
4844
|
+
divide: 0,
|
|
4845
|
+
glyph: 0
|
|
4884
4846
|
};
|
|
4885
4847
|
this._currentEndState = {
|
|
4886
|
-
page:
|
|
4887
|
-
section:
|
|
4888
|
-
column:
|
|
4889
|
-
line:
|
|
4890
|
-
divide:
|
|
4891
|
-
glyph:
|
|
4848
|
+
page: 0,
|
|
4849
|
+
section: 0,
|
|
4850
|
+
column: 0,
|
|
4851
|
+
line: 0,
|
|
4852
|
+
divide: 0,
|
|
4853
|
+
glyph: 0
|
|
4892
4854
|
};
|
|
4893
4855
|
}
|
|
4894
|
-
_setNodePositionState(type =
|
|
4895
|
-
if (current === start) this._currentStartState[type] =
|
|
4896
|
-
else this._currentStartState[type] =
|
|
4897
|
-
if (current === end) this._currentEndState[type] =
|
|
4898
|
-
else this._currentEndState[type] =
|
|
4856
|
+
_setNodePositionState(type = 0, start, end, current) {
|
|
4857
|
+
if (current === start) this._currentStartState[type] = 1;
|
|
4858
|
+
else this._currentStartState[type] = 0;
|
|
4859
|
+
if (current === end) this._currentEndState[type] = 2;
|
|
4860
|
+
else this._currentEndState[type] = 0;
|
|
4899
4861
|
}
|
|
4900
4862
|
_checkPreviousNodePositionState(typeIndex, isStart = true) {
|
|
4901
4863
|
let index = typeIndex;
|
|
@@ -4907,7 +4869,7 @@ var NodePositionConvertToCursor = class {
|
|
|
4907
4869
|
else state = this._currentEndState[type];
|
|
4908
4870
|
if (state === void 0) return;
|
|
4909
4871
|
if (resultState === void 0) resultState = state;
|
|
4910
|
-
if (state !== resultState) return
|
|
4872
|
+
if (state !== resultState) return 0;
|
|
4911
4873
|
index--;
|
|
4912
4874
|
}
|
|
4913
4875
|
return resultState;
|
|
@@ -4926,8 +4888,8 @@ var NodePositionConvertToCursor = class {
|
|
|
4926
4888
|
this._setNodePositionState(type, start, end, current);
|
|
4927
4889
|
const preStartNestType = this._checkPreviousNodePositionState(typeIndex);
|
|
4928
4890
|
const preEndNestType = this._checkPreviousNodePositionState(typeIndex, false);
|
|
4929
|
-
if (preStartNestType ===
|
|
4930
|
-
if (preEndNestType ===
|
|
4891
|
+
if (preStartNestType === 1) start_next = startPosition[nextType];
|
|
4892
|
+
if (preEndNestType === 2) end_next = endPosition[nextType];
|
|
4931
4893
|
return {
|
|
4932
4894
|
start_next,
|
|
4933
4895
|
end_next
|
|
@@ -6991,28 +6953,28 @@ const DocTableInsertRowAboveCommand = {
|
|
|
6991
6953
|
id: DocTableInsertRowAboveCommandId,
|
|
6992
6954
|
type: _univerjs_core.CommandType.COMMAND,
|
|
6993
6955
|
handler: async (accessor) => {
|
|
6994
|
-
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertRowCommandId, { position:
|
|
6956
|
+
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertRowCommandId, { position: 0 });
|
|
6995
6957
|
}
|
|
6996
6958
|
};
|
|
6997
6959
|
const DocTableInsertRowBellowCommand = {
|
|
6998
6960
|
id: DocTableInsertRowBellowCommandId,
|
|
6999
6961
|
type: _univerjs_core.CommandType.COMMAND,
|
|
7000
6962
|
handler: async (accessor) => {
|
|
7001
|
-
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertRowCommandId, { position:
|
|
6963
|
+
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertRowCommandId, { position: 1 });
|
|
7002
6964
|
}
|
|
7003
6965
|
};
|
|
7004
6966
|
const DocTableInsertColumnLeftCommand = {
|
|
7005
6967
|
id: DocTableInsertColumnLeftCommandId,
|
|
7006
6968
|
type: _univerjs_core.CommandType.COMMAND,
|
|
7007
6969
|
handler: async (accessor) => {
|
|
7008
|
-
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertColumnCommandId, { position:
|
|
6970
|
+
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertColumnCommandId, { position: 0 });
|
|
7009
6971
|
}
|
|
7010
6972
|
};
|
|
7011
6973
|
const DocTableInsertColumnRightCommand = {
|
|
7012
6974
|
id: DocTableInsertColumnRightCommandId,
|
|
7013
6975
|
type: _univerjs_core.CommandType.COMMAND,
|
|
7014
6976
|
handler: async (accessor) => {
|
|
7015
|
-
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertColumnCommandId, { position:
|
|
6977
|
+
return accessor.get(_univerjs_core.ICommandService).executeCommand(DocTableInsertColumnCommandId, { position: 1 });
|
|
7016
6978
|
}
|
|
7017
6979
|
};
|
|
7018
6980
|
/**
|
|
@@ -7208,8 +7170,8 @@ const DocTableTabCommand = {
|
|
|
7208
7170
|
if (viewModel == null) return false;
|
|
7209
7171
|
if (activeRange == null) return false;
|
|
7210
7172
|
let offsets = null;
|
|
7211
|
-
if (shift) offsets = getCellOffsets(viewModel, activeRange,
|
|
7212
|
-
else offsets = getCellOffsets(viewModel, activeRange,
|
|
7173
|
+
if (shift) offsets = getCellOffsets(viewModel, activeRange, 1);
|
|
7174
|
+
else offsets = getCellOffsets(viewModel, activeRange, 0);
|
|
7213
7175
|
if (offsets) {
|
|
7214
7176
|
const { startOffset, endOffset } = offsets;
|
|
7215
7177
|
const textRanges = [{
|
|
@@ -7219,7 +7181,7 @@ const DocTableTabCommand = {
|
|
|
7219
7181
|
textSelectionManager.replaceDocRanges(textRanges);
|
|
7220
7182
|
return true;
|
|
7221
7183
|
}
|
|
7222
|
-
if (shift === false) return await commandService.executeCommand(DocTableInsertRowCommand.id, { position:
|
|
7184
|
+
if (shift === false) return await commandService.executeCommand(DocTableInsertRowCommand.id, { position: 1 });
|
|
7223
7185
|
return true;
|
|
7224
7186
|
}
|
|
7225
7187
|
};
|
|
@@ -8021,15 +7983,6 @@ var TextBubbleShape = class TextBubbleShape extends _univerjs_engine_render.Shap
|
|
|
8021
7983
|
//#region src/controllers/doc-header-footer.controller.ts
|
|
8022
7984
|
const HEADER_FOOTER_STROKE_COLOR = "rgba(58, 96, 247, 1)";
|
|
8023
7985
|
const HEADER_FOOTER_FILL_COLOR = "rgba(58, 96, 247, 0.08)";
|
|
8024
|
-
let HeaderFooterType = /* @__PURE__ */ function(HeaderFooterType) {
|
|
8025
|
-
HeaderFooterType[HeaderFooterType["FIRST_PAGE_HEADER"] = 0] = "FIRST_PAGE_HEADER";
|
|
8026
|
-
HeaderFooterType[HeaderFooterType["FIRST_PAGE_FOOTER"] = 1] = "FIRST_PAGE_FOOTER";
|
|
8027
|
-
HeaderFooterType[HeaderFooterType["DEFAULT_HEADER"] = 2] = "DEFAULT_HEADER";
|
|
8028
|
-
HeaderFooterType[HeaderFooterType["DEFAULT_FOOTER"] = 3] = "DEFAULT_FOOTER";
|
|
8029
|
-
HeaderFooterType[HeaderFooterType["EVEN_PAGE_HEADER"] = 4] = "EVEN_PAGE_HEADER";
|
|
8030
|
-
HeaderFooterType[HeaderFooterType["EVEN_PAGE_FOOTER"] = 5] = "EVEN_PAGE_FOOTER";
|
|
8031
|
-
return HeaderFooterType;
|
|
8032
|
-
}({});
|
|
8033
7986
|
function checkCreateHeaderFooterType(viewModel, editArea, segmentPage) {
|
|
8034
7987
|
const { documentStyle } = viewModel.getDataModel().getSnapshot();
|
|
8035
7988
|
const { defaultHeaderId, defaultFooterId, evenPageHeaderId, evenPageFooterId, firstPageHeaderId, firstPageFooterId, evenAndOddHeaders, useFirstPageHeaderFooter } = documentStyle;
|
|
@@ -8040,34 +7993,34 @@ function checkCreateHeaderFooterType(viewModel, editArea, segmentPage) {
|
|
|
8040
7993
|
};
|
|
8041
7994
|
case _univerjs_engine_render.DocumentEditArea.HEADER:
|
|
8042
7995
|
if (useFirstPageHeaderFooter === _univerjs_core.BooleanNumber.TRUE && !firstPageHeaderId) return {
|
|
8043
|
-
createType:
|
|
7996
|
+
createType: 0,
|
|
8044
7997
|
headerFooterId: null
|
|
8045
7998
|
};
|
|
8046
7999
|
if (evenAndOddHeaders === _univerjs_core.BooleanNumber.TRUE && segmentPage % 2 === 0 && !evenPageHeaderId) return {
|
|
8047
|
-
createType:
|
|
8000
|
+
createType: 4,
|
|
8048
8001
|
headerFooterId: null
|
|
8049
8002
|
};
|
|
8050
8003
|
return defaultHeaderId ? {
|
|
8051
8004
|
createType: null,
|
|
8052
8005
|
headerFooterId: defaultHeaderId
|
|
8053
8006
|
} : {
|
|
8054
|
-
createType:
|
|
8007
|
+
createType: 2,
|
|
8055
8008
|
headerFooterId: null
|
|
8056
8009
|
};
|
|
8057
8010
|
case _univerjs_engine_render.DocumentEditArea.FOOTER:
|
|
8058
8011
|
if (useFirstPageHeaderFooter === _univerjs_core.BooleanNumber.TRUE && !firstPageFooterId) return {
|
|
8059
|
-
createType:
|
|
8012
|
+
createType: 1,
|
|
8060
8013
|
headerFooterId: null
|
|
8061
8014
|
};
|
|
8062
8015
|
if (evenAndOddHeaders === _univerjs_core.BooleanNumber.TRUE && segmentPage % 2 === 0 && !evenPageFooterId) return {
|
|
8063
|
-
createType:
|
|
8016
|
+
createType: 5,
|
|
8064
8017
|
headerFooterId: null
|
|
8065
8018
|
};
|
|
8066
8019
|
return defaultFooterId ? {
|
|
8067
8020
|
createType: null,
|
|
8068
8021
|
headerFooterId: defaultFooterId
|
|
8069
8022
|
} : {
|
|
8070
|
-
createType:
|
|
8023
|
+
createType: 3,
|
|
8071
8024
|
headerFooterId: null
|
|
8072
8025
|
};
|
|
8073
8026
|
default: throw new Error(`Invalid editArea: ${editArea}`);
|
|
@@ -8322,7 +8275,7 @@ function createHeaderFooterAction(segmentId, createType, documentStyle, actions)
|
|
|
8322
8275
|
const jsonX = _univerjs_core.JSONX.getInstance();
|
|
8323
8276
|
const ID_LEN = 6;
|
|
8324
8277
|
const firstSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : (0, _univerjs_core.generateRandomId)(ID_LEN);
|
|
8325
|
-
const isHeader = createType ===
|
|
8278
|
+
const isHeader = createType === 2 || createType === 0 || createType === 4;
|
|
8326
8279
|
const insertAction = jsonX.insertOp([isHeader ? "headers" : "footers", firstSegmentId], {
|
|
8327
8280
|
[isHeader ? "headerId" : "footerId"]: firstSegmentId,
|
|
8328
8281
|
body: getEmptyHeaderFooterBody()
|
|
@@ -8337,27 +8290,27 @@ function createHeaderFooterAction(segmentId, createType, documentStyle, actions)
|
|
|
8337
8290
|
let key = "defaultHeaderId";
|
|
8338
8291
|
let pairKey = "defaultFooterId";
|
|
8339
8292
|
switch (createType) {
|
|
8340
|
-
case
|
|
8293
|
+
case 2:
|
|
8341
8294
|
key = "defaultHeaderId";
|
|
8342
8295
|
pairKey = "defaultFooterId";
|
|
8343
8296
|
break;
|
|
8344
|
-
case
|
|
8297
|
+
case 3:
|
|
8345
8298
|
key = "defaultFooterId";
|
|
8346
8299
|
pairKey = "defaultHeaderId";
|
|
8347
8300
|
break;
|
|
8348
|
-
case
|
|
8301
|
+
case 0:
|
|
8349
8302
|
key = "firstPageHeaderId";
|
|
8350
8303
|
pairKey = "firstPageFooterId";
|
|
8351
8304
|
break;
|
|
8352
|
-
case
|
|
8305
|
+
case 1:
|
|
8353
8306
|
key = "firstPageFooterId";
|
|
8354
8307
|
pairKey = "firstPageHeaderId";
|
|
8355
8308
|
break;
|
|
8356
|
-
case
|
|
8309
|
+
case 4:
|
|
8357
8310
|
key = "evenPageHeaderId";
|
|
8358
8311
|
pairKey = "evenPageFooterId";
|
|
8359
8312
|
break;
|
|
8360
|
-
case
|
|
8313
|
+
case 5:
|
|
8361
8314
|
key = "evenPageFooterId";
|
|
8362
8315
|
pairKey = "evenPageHeaderId";
|
|
8363
8316
|
break;
|
|
@@ -8417,8 +8370,8 @@ const CoreHeaderFooterCommand = {
|
|
|
8417
8370
|
if (oldValue === void 0) action = jsonX.insertOp(["documentStyle", key], value);
|
|
8418
8371
|
else action = jsonX.replaceOp(["documentStyle", key], oldValue, value);
|
|
8419
8372
|
rawActions.push(action);
|
|
8420
|
-
if (key === "useFirstPageHeaderFooter" && value === _univerjs_core.BooleanNumber.TRUE && !documentStyle.firstPageHeaderId) createHeaderFooterAction(segmentId, editArea === _univerjs_engine_render.DocumentEditArea.HEADER ?
|
|
8421
|
-
else if (key === "evenAndOddHeaders" && value === _univerjs_core.BooleanNumber.TRUE && !documentStyle.evenPageHeaderId) createHeaderFooterAction(segmentId, editArea === _univerjs_engine_render.DocumentEditArea.HEADER ?
|
|
8373
|
+
if (key === "useFirstPageHeaderFooter" && value === _univerjs_core.BooleanNumber.TRUE && !documentStyle.firstPageHeaderId) createHeaderFooterAction(segmentId, editArea === _univerjs_engine_render.DocumentEditArea.HEADER ? 0 : 1, documentStyle, rawActions);
|
|
8374
|
+
else if (key === "evenAndOddHeaders" && value === _univerjs_core.BooleanNumber.TRUE && !documentStyle.evenPageHeaderId) createHeaderFooterAction(segmentId, editArea === _univerjs_engine_render.DocumentEditArea.HEADER ? 4 : 5, documentStyle, rawActions);
|
|
8422
8375
|
});
|
|
8423
8376
|
if (rawActions.length === 0) return false;
|
|
8424
8377
|
doMutation.params.actions = rawActions.reduce((acc, cur) => {
|
|
@@ -8702,6 +8655,7 @@ function PageSettings(props) {
|
|
|
8702
8655
|
children: localeService.t("page-settings.top")
|
|
8703
8656
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
8704
8657
|
precision: 2,
|
|
8658
|
+
min: 0,
|
|
8705
8659
|
max: settings.pageSise.height / 2,
|
|
8706
8660
|
value: settings.margins.top,
|
|
8707
8661
|
onChange: (e) => handleMarginChange("top", e)
|
|
@@ -8713,6 +8667,7 @@ function PageSettings(props) {
|
|
|
8713
8667
|
children: localeService.t("page-settings.bottom")
|
|
8714
8668
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
8715
8669
|
precision: 2,
|
|
8670
|
+
min: 0,
|
|
8716
8671
|
max: settings.pageSise.height / 2,
|
|
8717
8672
|
value: settings.margins.bottom,
|
|
8718
8673
|
onChange: (e) => handleMarginChange("bottom", e)
|
|
@@ -8727,6 +8682,7 @@ function PageSettings(props) {
|
|
|
8727
8682
|
children: localeService.t("page-settings.left")
|
|
8728
8683
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
8729
8684
|
precision: 2,
|
|
8685
|
+
min: 0,
|
|
8730
8686
|
max: settings.pageSise.width / 2,
|
|
8731
8687
|
value: settings.margins.left,
|
|
8732
8688
|
onChange: (e) => handleMarginChange("left", e)
|
|
@@ -8738,6 +8694,7 @@ function PageSettings(props) {
|
|
|
8738
8694
|
children: localeService.t("page-settings.right")
|
|
8739
8695
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
8740
8696
|
precision: 2,
|
|
8697
|
+
min: 0,
|
|
8741
8698
|
max: settings.pageSise.width / 2,
|
|
8742
8699
|
value: settings.margins.right,
|
|
8743
8700
|
onChange: (e) => handleMarginChange("right", e)
|
|
@@ -9465,38 +9422,33 @@ const listValueFactory$ = (accessor) => {
|
|
|
9465
9422
|
return new rxjs.Observable((subscriber) => {
|
|
9466
9423
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
9467
9424
|
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
9468
|
-
let textSubscription;
|
|
9469
9425
|
const subscription = univerInstanceService.focused$.subscribe((unitId) => {
|
|
9470
|
-
|
|
9426
|
+
var _docRanges$find;
|
|
9471
9427
|
if (unitId == null) return;
|
|
9472
9428
|
const docDataModel = univerInstanceService.getUniverDocInstance(unitId);
|
|
9473
9429
|
if (docDataModel == null) return;
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
var _p$bullet;
|
|
9486
|
-
listType = (_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType;
|
|
9487
|
-
}
|
|
9488
|
-
return p.bullet && p.bullet.listType === listType;
|
|
9489
|
-
})) {
|
|
9490
|
-
subscriber.next(listType);
|
|
9491
|
-
return;
|
|
9430
|
+
const docRanges = docSelectionManagerService.getDocRanges();
|
|
9431
|
+
const range = (_docRanges$find = docRanges.find((r) => r.isActive)) !== null && _docRanges$find !== void 0 ? _docRanges$find : docRanges[0];
|
|
9432
|
+
if (range) {
|
|
9433
|
+
var _doc$getBody$paragrap, _doc$getBody, _doc$getBody$dataStre, _doc$getBody2;
|
|
9434
|
+
const doc = docDataModel.getSelfOrHeaderFooterModel(range === null || range === void 0 ? void 0 : range.segmentId);
|
|
9435
|
+
const paragraphs = _univerjs_core.BuildTextUtils.range.getParagraphsInRange(range, (_doc$getBody$paragrap = (_doc$getBody = doc.getBody()) === null || _doc$getBody === void 0 ? void 0 : _doc$getBody.paragraphs) !== null && _doc$getBody$paragrap !== void 0 ? _doc$getBody$paragrap : [], (_doc$getBody$dataStre = (_doc$getBody2 = doc.getBody()) === null || _doc$getBody2 === void 0 ? void 0 : _doc$getBody2.dataStream) !== null && _doc$getBody$dataStre !== void 0 ? _doc$getBody$dataStre : "");
|
|
9436
|
+
let listType;
|
|
9437
|
+
if (paragraphs.every((p) => {
|
|
9438
|
+
if (!listType) {
|
|
9439
|
+
var _p$bullet;
|
|
9440
|
+
listType = (_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType;
|
|
9492
9441
|
}
|
|
9442
|
+
return p.bullet && p.bullet.listType === listType;
|
|
9443
|
+
})) {
|
|
9444
|
+
subscriber.next(listType);
|
|
9445
|
+
return;
|
|
9493
9446
|
}
|
|
9494
|
-
|
|
9495
|
-
|
|
9447
|
+
}
|
|
9448
|
+
subscriber.next(void 0);
|
|
9496
9449
|
});
|
|
9497
9450
|
return () => {
|
|
9498
9451
|
subscription.unsubscribe();
|
|
9499
|
-
textSubscription === null || textSubscription === void 0 || textSubscription.unsubscribe();
|
|
9500
9452
|
};
|
|
9501
9453
|
});
|
|
9502
9454
|
};
|
|
@@ -9883,7 +9835,7 @@ function transformBound2OffsetBound(originBound, scene) {
|
|
|
9883
9835
|
}
|
|
9884
9836
|
function transformPosition2Offset(x, y, scene) {
|
|
9885
9837
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
9886
|
-
const viewMain = scene.getViewport(
|
|
9838
|
+
const viewMain = scene.getViewport("viewMain");
|
|
9887
9839
|
if (!viewMain) return {
|
|
9888
9840
|
x,
|
|
9889
9841
|
y
|
|
@@ -9896,7 +9848,7 @@ function transformPosition2Offset(x, y, scene) {
|
|
|
9896
9848
|
}
|
|
9897
9849
|
function transformOffset2Bound(offsetX, offsetY, scene) {
|
|
9898
9850
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
9899
|
-
const viewMain = scene.getViewport(
|
|
9851
|
+
const viewMain = scene.getViewport("viewMain");
|
|
9900
9852
|
if (!viewMain) return {
|
|
9901
9853
|
x: offsetX,
|
|
9902
9854
|
y: offsetY
|
|
@@ -9965,7 +9917,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends _unive
|
|
|
9965
9917
|
if (newPosition) position$.next(newPosition);
|
|
9966
9918
|
}
|
|
9967
9919
|
}));
|
|
9968
|
-
const viewMain = currentRender.scene.getViewport(
|
|
9920
|
+
const viewMain = currentRender.scene.getViewport("viewMain");
|
|
9969
9921
|
if (viewMain) disposable.add(viewMain.onScrollAfter$.subscribeEvent(() => {
|
|
9970
9922
|
position$.next(calc());
|
|
9971
9923
|
}));
|
|
@@ -10000,7 +9952,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends _unive
|
|
|
10000
9952
|
}
|
|
10001
9953
|
}
|
|
10002
9954
|
}));
|
|
10003
|
-
const viewMain = currentRender.scene.getViewport(
|
|
9955
|
+
const viewMain = currentRender.scene.getViewport("viewMain");
|
|
10004
9956
|
if (viewMain) disposable.add(viewMain.onScrollAfter$.subscribeEvent(() => {
|
|
10005
9957
|
const position = calcDocRangePositions(range, currentRender);
|
|
10006
9958
|
if (position) positions$.next(position);
|
|
@@ -10766,7 +10718,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends _univerjs_co
|
|
|
10766
10718
|
handleHoverParagraph(p !== null && p !== void 0 ? p : left);
|
|
10767
10719
|
}));
|
|
10768
10720
|
let lastScrollY = 0;
|
|
10769
|
-
this.disposeWithMe(this._context.scene.getViewport(
|
|
10721
|
+
this.disposeWithMe(this._context.scene.getViewport("viewMain").onScrollAfter$.subscribeEvent((e) => {
|
|
10770
10722
|
if (lastScrollY === e.scrollY) return;
|
|
10771
10723
|
lastScrollY = e.scrollY;
|
|
10772
10724
|
this.hideParagraphMenu(true);
|
|
@@ -10782,18 +10734,19 @@ let DocParagraphMenuService = class DocParagraphMenuService extends _univerjs_co
|
|
|
10782
10734
|
const dataStream = (_this$_context$unit$g = (_this$_context$unit$g2 = this._context.unit.getBody()) === null || _this$_context$unit$g2 === void 0 ? void 0 : _this$_context$unit$g2.dataStream) !== null && _this$_context$unit$g !== void 0 ? _this$_context$unit$g : "";
|
|
10783
10735
|
const paragraphDataStream = paragraph ? dataStream.slice(paragraph.paragraphStart, paragraph.paragraphEnd) : "";
|
|
10784
10736
|
if (paragraphDataStream === "\b" || paragraphDataStream === "") return;
|
|
10737
|
+
const disposable = this._docPopupManagerService.attachPopupToRect(paragraph.firstLine, {
|
|
10738
|
+
componentKey: "doc.paragraph.menu",
|
|
10739
|
+
direction: "left-center",
|
|
10740
|
+
onClickOutside: () => {
|
|
10741
|
+
this._docSelectionManagerService.textSelection$.pipe((0, rxjs.first)()).subscribe(() => {
|
|
10742
|
+
if (!this._isCursorInActiveParagraph()) this.hideParagraphMenu(true);
|
|
10743
|
+
});
|
|
10744
|
+
},
|
|
10745
|
+
zIndex: 101
|
|
10746
|
+
}, this._context.unitId);
|
|
10785
10747
|
this._paragrahMenu = {
|
|
10786
10748
|
paragraph,
|
|
10787
|
-
disposable
|
|
10788
|
-
componentKey: "doc.paragraph.menu",
|
|
10789
|
-
direction: "left-center",
|
|
10790
|
-
onClickOutside: () => {
|
|
10791
|
-
this._docSelectionManagerService.textSelection$.pipe((0, rxjs.first)()).subscribe(() => {
|
|
10792
|
-
if (!this._isCursorInActiveParagraph()) this.hideParagraphMenu(true);
|
|
10793
|
-
});
|
|
10794
|
-
},
|
|
10795
|
-
zIndex: 101
|
|
10796
|
-
}, this._context.unitId),
|
|
10749
|
+
disposable,
|
|
10797
10750
|
active: false
|
|
10798
10751
|
};
|
|
10799
10752
|
}
|
|
@@ -11245,7 +11198,7 @@ function ParagraphSetting() {
|
|
|
11245
11198
|
title: item.label,
|
|
11246
11199
|
placement: "bottom",
|
|
11247
11200
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11248
|
-
className: (0, _univerjs_design.clsx)("hover:univer-bg-black/60 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-none univer-px-3 univer-py-1", { "univer-bg-
|
|
11201
|
+
className: (0, _univerjs_design.clsx)("hover:univer-bg-black/60 univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-none univer-px-3 univer-py-1", { "univer-bg-gray-200 dark:!univer-bg-gray-500": horizontalAlignValue === item.value }),
|
|
11249
11202
|
onClick: () => setHorizontalAlign(item.value),
|
|
11250
11203
|
children: item.icon
|
|
11251
11204
|
})
|
|
@@ -12277,7 +12230,7 @@ function DocSideMenuContent() {
|
|
|
12277
12230
|
};
|
|
12278
12231
|
}, [commandService, currentDoc]);
|
|
12279
12232
|
(0, react.useEffect)(() => {
|
|
12280
|
-
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport(
|
|
12233
|
+
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
|
|
12281
12234
|
if (!viewport) return;
|
|
12282
12235
|
const sub = (0, _univerjs_core.fromEventSubject)(viewport.onScrollAfter$).pipe((0, rxjs.throttleTime)(33)).subscribe(handleScroll);
|
|
12283
12236
|
return () => {
|
|
@@ -12285,7 +12238,7 @@ function DocSideMenuContent() {
|
|
|
12285
12238
|
};
|
|
12286
12239
|
}, [renderer]);
|
|
12287
12240
|
const handleClick = (0, _univerjs_ui.useEvent)((menu) => {
|
|
12288
|
-
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport(
|
|
12241
|
+
const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
|
|
12289
12242
|
if (!viewport) return;
|
|
12290
12243
|
if (menu.id === TITLE_ID) {
|
|
12291
12244
|
viewport.scrollToViewportPos({ viewportScrollY: 0 });
|
|
@@ -12460,7 +12413,7 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
|
|
|
12460
12413
|
const { left: aLeft, top: aTop, height } = getAnchorBounding(contentBoxPointGroup);
|
|
12461
12414
|
const left = aLeft + docsLeft;
|
|
12462
12415
|
const top = aTop + docsTop;
|
|
12463
|
-
const viewportMain = scene.getViewport(
|
|
12416
|
+
const viewportMain = scene.getViewport("viewMain");
|
|
12464
12417
|
const editor = this._editorService.getEditor(unitId);
|
|
12465
12418
|
if (viewportMain == null) return;
|
|
12466
12419
|
const { left: boundLeft, top: boundTop, right: boundRight, bottom: boundBottom } = viewportMain.getBounding().viewBound;
|
|
@@ -12521,7 +12474,7 @@ let DocRenderController = class DocRenderController extends _univerjs_core.RxDis
|
|
|
12521
12474
|
}
|
|
12522
12475
|
_addNewRender() {
|
|
12523
12476
|
const { scene, engine } = this._context;
|
|
12524
|
-
const viewMain = new _univerjs_engine_render.Viewport(
|
|
12477
|
+
const viewMain = new _univerjs_engine_render.Viewport("viewMain", scene, {
|
|
12525
12478
|
left: 0,
|
|
12526
12479
|
top: 0,
|
|
12527
12480
|
bottom: 0,
|
|
@@ -12559,13 +12512,13 @@ let DocRenderController = class DocRenderController extends _univerjs_core.RxDis
|
|
|
12559
12512
|
pageMarginLeft: 20,
|
|
12560
12513
|
pageMarginTop: 20
|
|
12561
12514
|
};
|
|
12562
|
-
const documents = new _univerjs_engine_render.Documents(
|
|
12515
|
+
const documents = new _univerjs_engine_render.Documents("__Document_Render_Main__", void 0, config);
|
|
12563
12516
|
documents.zIndex = 10;
|
|
12564
|
-
const docBackground = new _univerjs_engine_render.DocBackground(
|
|
12517
|
+
const docBackground = new _univerjs_engine_render.DocBackground("__Document_Render_Background__", void 0, config);
|
|
12565
12518
|
docBackground.zIndex = 10;
|
|
12566
12519
|
this._context.mainComponent = documents;
|
|
12567
|
-
components.set(
|
|
12568
|
-
components.set(
|
|
12520
|
+
components.set("__Document_Render_Main__", documents);
|
|
12521
|
+
components.set("__Document_Render_Background__", docBackground);
|
|
12569
12522
|
scene.addObjects([documents], 2);
|
|
12570
12523
|
scene.addObjects([docBackground], 0);
|
|
12571
12524
|
if (this._editorService.getEditor(documentModel.getUnitId()) == null) scene.enableLayerCache(2);
|
|
@@ -12579,7 +12532,7 @@ let DocRenderController = class DocRenderController extends _univerjs_core.RxDis
|
|
|
12579
12532
|
if (!skeleton) return;
|
|
12580
12533
|
const { mainComponent, components } = this._context;
|
|
12581
12534
|
const docsComponent = mainComponent;
|
|
12582
|
-
const docBackground = components.get(
|
|
12535
|
+
const docBackground = components.get("__Document_Render_Background__");
|
|
12583
12536
|
docsComponent.changeSkeleton(skeleton);
|
|
12584
12537
|
docBackground.changeSkeleton(skeleton);
|
|
12585
12538
|
const { unitId } = this._context;
|
|
@@ -12604,7 +12557,7 @@ let DocRenderController = class DocRenderController extends _univerjs_core.RxDis
|
|
|
12604
12557
|
var _skeleton$getSkeleton;
|
|
12605
12558
|
const { mainComponent, scene, unitId, components } = this._context;
|
|
12606
12559
|
const docsComponent = mainComponent;
|
|
12607
|
-
const docBackground = components.get(
|
|
12560
|
+
const docBackground = components.get("__Document_Render_Background__");
|
|
12608
12561
|
const pages = (_skeleton$getSkeleton = skeleton.getSkeletonData()) === null || _skeleton$getSkeleton === void 0 ? void 0 : _skeleton$getSkeleton.pages;
|
|
12609
12562
|
if (pages == null) return;
|
|
12610
12563
|
let width = 0;
|
|
@@ -12665,7 +12618,7 @@ function getPageSizeInModernMode(page) {
|
|
|
12665
12618
|
//#endregion
|
|
12666
12619
|
//#region package.json
|
|
12667
12620
|
var name = "@univerjs/docs-ui";
|
|
12668
|
-
var version = "0.
|
|
12621
|
+
var version = "0.22.0";
|
|
12669
12622
|
|
|
12670
12623
|
//#endregion
|
|
12671
12624
|
//#region src/controllers/doc-auto-format.controller.ts
|
|
@@ -12700,7 +12653,7 @@ let DocAutoFormatController = class DocAutoFormatController extends _univerjs_co
|
|
|
12700
12653
|
const params = context.commandParams;
|
|
12701
12654
|
return [{
|
|
12702
12655
|
id: ChangeListNestingLevelCommand.id,
|
|
12703
|
-
params: { type: (params === null || params === void 0 ? void 0 : params.shift) ?
|
|
12656
|
+
params: { type: (params === null || params === void 0 ? void 0 : params.shift) ? -1 : 1 }
|
|
12704
12657
|
}];
|
|
12705
12658
|
},
|
|
12706
12659
|
priority: 100
|
|
@@ -12778,7 +12731,7 @@ let DocAutoFormatController = class DocAutoFormatController extends _univerjs_co
|
|
|
12778
12731
|
if (!bullet) return [];
|
|
12779
12732
|
if (bullet.nestingLevel > 0) return [{
|
|
12780
12733
|
id: ChangeListNestingLevelCommand.id,
|
|
12781
|
-
params: { type:
|
|
12734
|
+
params: { type: -1 }
|
|
12782
12735
|
}];
|
|
12783
12736
|
return [{
|
|
12784
12737
|
id: ListOperationCommand.id,
|
|
@@ -13800,7 +13753,7 @@ var DocPageLayoutService = class extends _univerjs_core.Disposable {
|
|
|
13800
13753
|
}
|
|
13801
13754
|
docsComponent.translate(docsLeft, docsTop);
|
|
13802
13755
|
docBackground.translate(docsLeft, docsTop);
|
|
13803
|
-
const viewport = scene.getViewport(
|
|
13756
|
+
const viewport = scene.getViewport("viewMain");
|
|
13804
13757
|
if (scrollToX !== Number.POSITIVE_INFINITY && viewport != null) viewport.scrollToViewportPos({ viewportScrollX: scrollToX });
|
|
13805
13758
|
return this;
|
|
13806
13759
|
}
|
|
@@ -14950,7 +14903,7 @@ const useResize = (editor, isSingle = true, autoScrollbar, autoScroll) => {
|
|
|
14950
14903
|
if (!editor || !autoScrollbar) return;
|
|
14951
14904
|
const skeleton = editor.render.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
|
|
14952
14905
|
const { scene, mainComponent } = editor.render;
|
|
14953
|
-
const viewportMain = scene.getViewport(
|
|
14906
|
+
const viewportMain = scene.getViewport("viewMain");
|
|
14954
14907
|
const { actualWidth, actualHeight } = skeleton.getActualSize();
|
|
14955
14908
|
const { width, height } = editor.getBoundingClientRect();
|
|
14956
14909
|
let scrollBar = viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.getScrollBar();
|
|
@@ -15267,9 +15220,9 @@ exports.NORMAL_TEXT_SELECTION_PLUGIN_NAME = NORMAL_TEXT_SELECTION_PLUGIN_NAME;
|
|
|
15267
15220
|
exports.NodePositionConvertToCursor = NodePositionConvertToCursor;
|
|
15268
15221
|
exports.NodePositionConvertToRectRange = NodePositionConvertToRectRange;
|
|
15269
15222
|
exports.OrderListCommand = OrderListCommand;
|
|
15270
|
-
exports.PastePluginLark =
|
|
15271
|
-
exports.PastePluginUniver =
|
|
15272
|
-
exports.PastePluginWord =
|
|
15223
|
+
exports.PastePluginLark = LarkPastePlugin;
|
|
15224
|
+
exports.PastePluginUniver = UniverPastePlugin;
|
|
15225
|
+
exports.PastePluginWord = WordPastePlugin;
|
|
15273
15226
|
exports.QuickListCommand = QuickListCommand;
|
|
15274
15227
|
exports.RectRange = RectRange;
|
|
15275
15228
|
exports.ReplaceContentCommand = ReplaceContentCommand;
|