@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/lib/es/index.js CHANGED
@@ -50,7 +50,7 @@ function neoGetDocObject(renderContext) {
50
50
  const { mainComponent, scene, engine, components } = renderContext;
51
51
  return {
52
52
  document: mainComponent,
53
- docBackground: components.get(DOCS_VIEW_KEY.BACKGROUND),
53
+ docBackground: components.get("__Document_Render_Background__"),
54
54
  scene,
55
55
  engine
56
56
  };
@@ -65,7 +65,7 @@ function getDocObject(univerInstanceService, renderManagerService) {
65
65
  const { mainComponent, scene, engine, components } = currentRender;
66
66
  return {
67
67
  document: mainComponent,
68
- docBackground: components.get(DOCS_VIEW_KEY.BACKGROUND),
68
+ docBackground: components.get("__Document_Render_Background__"),
69
69
  scene,
70
70
  engine
71
71
  };
@@ -76,7 +76,7 @@ function getDocObjectById(unitId, renderManagerService) {
76
76
  const { mainComponent, scene, engine, components } = currentRender;
77
77
  return {
78
78
  document: mainComponent,
79
- docBackground: components.get(DOCS_VIEW_KEY.BACKGROUND),
79
+ docBackground: components.get("__Document_Render_Background__"),
80
80
  scene,
81
81
  engine
82
82
  };
@@ -229,7 +229,7 @@ function transformToDocDrawingPosition(transform, marginLeft = 0, marginTop = 0)
229
229
  }
230
230
 
231
231
  //#endregion
232
- //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
232
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
233
233
  function _typeof(o) {
234
234
  "@babel/helpers - typeof";
235
235
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -240,7 +240,7 @@ function _typeof(o) {
240
240
  }
241
241
 
242
242
  //#endregion
243
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
243
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
244
244
  function toPrimitive(t, r) {
245
245
  if ("object" != _typeof(t) || !t) return t;
246
246
  var e = t[Symbol.toPrimitive];
@@ -253,14 +253,14 @@ function toPrimitive(t, r) {
253
253
  }
254
254
 
255
255
  //#endregion
256
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
256
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
257
257
  function toPropertyKey(t) {
258
258
  var i = toPrimitive(t, "string");
259
259
  return "symbol" == _typeof(i) ? i : i + "";
260
260
  }
261
261
 
262
262
  //#endregion
263
- //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
263
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
264
264
  function _defineProperty(e, r, t) {
265
265
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
266
266
  value: t,
@@ -271,7 +271,7 @@ function _defineProperty(e, r, t) {
271
271
  }
272
272
 
273
273
  //#endregion
274
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
274
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
275
275
  function __decorateParam(paramIndex, decorator) {
276
276
  return function(target, key) {
277
277
  decorator(target, key, paramIndex);
@@ -279,7 +279,7 @@ function __decorateParam(paramIndex, decorator) {
279
279
  }
280
280
 
281
281
  //#endregion
282
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
282
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
283
283
  function __decorate(decorators, target, key, desc) {
284
284
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
285
285
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -370,7 +370,13 @@ const EnterCommand = {
370
370
  const BODY_DEFAULT_FONTSIZE = 11;
371
371
  const HEADER_FOOTER_DEFAULT_FONTSIZE = 9;
372
372
  const DEFAULT_TEXT_STYLE = {
373
+ /**
374
+ * fontFamily
375
+ */
373
376
  ff: "Arial",
377
+ /**
378
+ * fontSize
379
+ */
374
380
  fs: BODY_DEFAULT_FONTSIZE
375
381
  };
376
382
  let DocMenuStyleService = class DocMenuStyleService extends Disposable {
@@ -594,16 +600,6 @@ const BreakLineCommand = {
594
600
 
595
601
  //#endregion
596
602
  //#region src/commands/commands/table/table.ts
597
- let INSERT_ROW_POSITION = /* @__PURE__ */ function(INSERT_ROW_POSITION) {
598
- INSERT_ROW_POSITION[INSERT_ROW_POSITION["ABOVE"] = 0] = "ABOVE";
599
- INSERT_ROW_POSITION[INSERT_ROW_POSITION["BELLOW"] = 1] = "BELLOW";
600
- return INSERT_ROW_POSITION;
601
- }({});
602
- let INSERT_COLUMN_POSITION = /* @__PURE__ */ function(INSERT_COLUMN_POSITION) {
603
- INSERT_COLUMN_POSITION[INSERT_COLUMN_POSITION["LEFT"] = 0] = "LEFT";
604
- INSERT_COLUMN_POSITION[INSERT_COLUMN_POSITION["RIGHT"] = 1] = "RIGHT";
605
- return INSERT_COLUMN_POSITION;
606
- }({});
607
603
  function genEmptyTable(rowCount, colCount) {
608
604
  let dataStream = DataStreamTreeTokenType.TABLE_START;
609
605
  const paragraphs = [];
@@ -766,7 +762,7 @@ function getInsertRowActionsParams(rangeInfo, position, viewModel) {
766
762
  var _viewModel$getBody;
767
763
  const { startOffset, endOffset, segmentId } = rangeInfo;
768
764
  const vm = viewModel.getSelfOrHeaderFooterViewModel(segmentId);
769
- const index = position === INSERT_ROW_POSITION.ABOVE ? startOffset : endOffset;
765
+ const index = position === 0 ? startOffset : endOffset;
770
766
  let tableRow = null;
771
767
  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;
772
768
  let rowIndex = 0;
@@ -787,17 +783,17 @@ function getInsertRowActionsParams(rangeInfo, position, viewModel) {
787
783
  }
788
784
  if (tableRow == null || tableId == null) return null;
789
785
  return {
790
- offset: position === INSERT_ROW_POSITION.ABOVE ? tableRow.startIndex : tableRow.endIndex + 1,
786
+ offset: position === 0 ? tableRow.startIndex : tableRow.endIndex + 1,
791
787
  colCount: tableRow.children.length,
792
788
  tableId,
793
- insertRowIndex: position === INSERT_ROW_POSITION.ABOVE ? rowIndex : rowIndex + 1
789
+ insertRowIndex: position === 0 ? rowIndex : rowIndex + 1
794
790
  };
795
791
  }
796
792
  function getInsertColumnActionsParams(rangeInfo, position, viewModel) {
797
793
  var _viewModel$getBody2;
798
794
  const { startOffset, endOffset, segmentId } = rangeInfo;
799
795
  const vm = viewModel.getSelfOrHeaderFooterViewModel(segmentId);
800
- const index = position === INSERT_COLUMN_POSITION.LEFT ? startOffset : endOffset;
796
+ const index = position === 0 ? startOffset : endOffset;
801
797
  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;
802
798
  const offsets = [];
803
799
  let table = null;
@@ -828,7 +824,7 @@ function getInsertColumnActionsParams(rangeInfo, position, viewModel) {
828
824
  let cursor = 0;
829
825
  for (const row of table.children) {
830
826
  const cell = row.children[columnIndex];
831
- const insertIndex = position === INSERT_COLUMN_POSITION.LEFT ? cell.startIndex : cell.endIndex + 1;
827
+ const insertIndex = position === 0 ? cell.startIndex : cell.endIndex + 1;
832
828
  offsets.push(insertIndex - cursor);
833
829
  cursor = insertIndex;
834
830
  }
@@ -1031,11 +1027,6 @@ function getDeleteRowContentActionParams(rangeInfo, viewModel) {
1031
1027
  rowCount: table.children.length
1032
1028
  };
1033
1029
  }
1034
- let CellPosition = /* @__PURE__ */ function(CellPosition) {
1035
- CellPosition[CellPosition["NEXT"] = 0] = "NEXT";
1036
- CellPosition[CellPosition["PREV"] = 1] = "PREV";
1037
- return CellPosition;
1038
- }({});
1039
1030
  function getCellOffsets(viewModel, range, position) {
1040
1031
  const { startOffset } = range;
1041
1032
  let targetTable = null;
@@ -1066,7 +1057,7 @@ function getCellOffsets(viewModel, range, position) {
1066
1057
  }
1067
1058
  if (cellIndex === -1 || rowIndex === -1 || targetRow == null) return null;
1068
1059
  let newCell = null;
1069
- if (position === CellPosition.NEXT) {
1060
+ if (position === 0) {
1070
1061
  newCell = targetRow.children[cellIndex + 1];
1071
1062
  if (!newCell) {
1072
1063
  const nextRow = targetTable.children[rowIndex + 1];
@@ -1393,29 +1384,6 @@ const CutContentCommand = {
1393
1384
  }
1394
1385
  };
1395
1386
 
1396
- //#endregion
1397
- //#region src/types/delete-direction.ts
1398
- /**
1399
- * Copyright 2023-present DreamNum Co., Ltd.
1400
- *
1401
- * Licensed under the Apache License, Version 2.0 (the "License");
1402
- * you may not use this file except in compliance with the License.
1403
- * You may obtain a copy of the License at
1404
- *
1405
- * http://www.apache.org/licenses/LICENSE-2.0
1406
- *
1407
- * Unless required by applicable law or agreed to in writing, software
1408
- * distributed under the License is distributed on an "AS IS" BASIS,
1409
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1410
- * See the License for the specific language governing permissions and
1411
- * limitations under the License.
1412
- */
1413
- let DeleteDirection = /* @__PURE__ */ function(DeleteDirection) {
1414
- DeleteDirection[DeleteDirection["LEFT"] = 0] = "LEFT";
1415
- DeleteDirection[DeleteDirection["RIGHT"] = 1] = "RIGHT";
1416
- return DeleteDirection;
1417
- }({});
1418
-
1419
1387
  //#endregion
1420
1388
  //#region src/commands/commands/core-editing.command.ts
1421
1389
  const EditorInsertTextCommandId = "doc.command.insert-text";
@@ -1494,8 +1462,8 @@ const DeleteCommand = {
1494
1462
  const body = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
1495
1463
  if (docDataModel == null || body == null) return false;
1496
1464
  const { startOffset } = range;
1497
- let start = direction === DeleteDirection.LEFT ? startOffset - len : startOffset;
1498
- let end = direction === DeleteDirection.LEFT ? startOffset - 1 : startOffset + len - 1;
1465
+ let start = direction === 0 ? startOffset - len : startOffset;
1466
+ let end = direction === 0 ? startOffset - 1 : startOffset + len - 1;
1499
1467
  const customRange = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((customRange) => customRange.startIndex <= start && customRange.endIndex >= end);
1500
1468
  if (customRange === null || customRange === void 0 ? void 0 : customRange.wholeEntity) {
1501
1469
  start = customRange.startIndex;
@@ -1595,7 +1563,7 @@ const DeleteCustomBlockCommand = {
1595
1563
  if (activeRange == null || documentDataModel == null) return false;
1596
1564
  const { direction, range, unitId, drawingId } = params;
1597
1565
  const { startOffset, segmentId, style } = activeRange;
1598
- const cursor = direction === DeleteDirection.LEFT ? startOffset - 1 : startOffset;
1566
+ const cursor = direction === 0 ? startOffset - 1 : startOffset;
1599
1567
  const textRanges = [{
1600
1568
  startOffset: cursor,
1601
1569
  endOffset: cursor,
@@ -1615,7 +1583,7 @@ const DeleteCustomBlockCommand = {
1615
1583
  const rawActions = [];
1616
1584
  if (startOffset > 0) textX.push({
1617
1585
  t: TextXActionType.RETAIN,
1618
- len: direction === DeleteDirection.LEFT ? startOffset - 1 : startOffset
1586
+ len: direction === 0 ? startOffset - 1 : startOffset
1619
1587
  });
1620
1588
  textX.push({
1621
1589
  t: TextXActionType.DELETE,
@@ -1656,7 +1624,7 @@ const MergeTwoParagraphCommand = {
1656
1624
  const unitId = docDataModel.getUnitId();
1657
1625
  const { startOffset, collapsed } = actualRange;
1658
1626
  if (!collapsed) return false;
1659
- const startIndex = direction === DeleteDirection.LEFT ? startOffset : startOffset + 1;
1627
+ const startIndex = direction === 0 ? startOffset : startOffset + 1;
1660
1628
  let curParagraph;
1661
1629
  let nextParagraph;
1662
1630
  for (const paragraph of originBody.paragraphs) {
@@ -1667,7 +1635,7 @@ const MergeTwoParagraphCommand = {
1667
1635
  curParagraph = paragraph;
1668
1636
  }
1669
1637
  if (curParagraph == null || nextParagraph == null) return false;
1670
- const cursor = direction === DeleteDirection.LEFT ? startOffset - 1 : startOffset;
1638
+ const cursor = direction === 0 ? startOffset - 1 : startOffset;
1671
1639
  const textRanges = [{
1672
1640
  startOffset: cursor,
1673
1641
  endOffset: cursor,
@@ -1895,7 +1863,7 @@ const DeleteLeftCommand = {
1895
1863
  const paragraph = (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.find((p) => p.startIndex === startOffset - 1);
1896
1864
  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);
1897
1865
  else result = await commandService.executeCommand(MergeTwoParagraphCommand.id, {
1898
- direction: DeleteDirection.LEFT,
1866
+ direction: 0,
1899
1867
  range: actualRange
1900
1868
  });
1901
1869
  } else if (preGlyph.streamType === "\b") {
@@ -1906,7 +1874,7 @@ const DeleteLeftCommand = {
1906
1874
  if (drawing.layoutType === PositionedObjectLayoutType.INLINE || (customBlock === null || customBlock === void 0 ? void 0 : customBlock.blockType) === BlockType.CUSTOM) {
1907
1875
  const unitId = docDataModel.getUnitId();
1908
1876
  result = await commandService.executeCommand(DeleteCustomBlockCommand.id, {
1909
- direction: DeleteDirection.LEFT,
1877
+ direction: 0,
1910
1878
  range: activeRange,
1911
1879
  unitId,
1912
1880
  drawingId: preGlyph.drawingId
@@ -1929,7 +1897,7 @@ const DeleteLeftCommand = {
1929
1897
  endOffset: activeRange.endOffset - 1
1930
1898
  },
1931
1899
  segmentId,
1932
- direction: DeleteDirection.LEFT,
1900
+ direction: 0,
1933
1901
  len: prePreGlyph.count,
1934
1902
  textRanges
1935
1903
  });
@@ -1940,7 +1908,7 @@ const DeleteLeftCommand = {
1940
1908
  unitId: docDataModel.getUnitId(),
1941
1909
  range: actualRange,
1942
1910
  segmentId,
1943
- direction: DeleteDirection.LEFT,
1911
+ direction: 0,
1944
1912
  len: preGlyph.count
1945
1913
  });
1946
1914
  }
@@ -1993,7 +1961,7 @@ const DeleteRightCommand = {
1993
1961
  const nextGlyph = skeleton.findNodeByCharIndex(startOffset + 1);
1994
1962
  if (needDeleteGlyph.streamType === DataStreamTreeTokenType.PARAGRAPH && (nextGlyph === null || nextGlyph === void 0 ? void 0 : nextGlyph.streamType) === DataStreamTreeTokenType.SECTION_BREAK) return false;
1995
1963
  if (needDeleteGlyph.content === "\r") result = await commandService.executeCommand(MergeTwoParagraphCommand.id, {
1996
- direction: DeleteDirection.RIGHT,
1964
+ direction: 1,
1997
1965
  range: activeRange
1998
1966
  });
1999
1967
  else if (needDeleteGlyph.streamType === "\b") {
@@ -2003,7 +1971,7 @@ const DeleteRightCommand = {
2003
1971
  if (drawing.layoutType === PositionedObjectLayoutType.INLINE) {
2004
1972
  const unitId = docDataModel.getUnitId();
2005
1973
  result = await commandService.executeCommand(DeleteCustomBlockCommand.id, {
2006
- direction: DeleteDirection.RIGHT,
1974
+ direction: 1,
2007
1975
  range: activeRange,
2008
1976
  unitId,
2009
1977
  drawingId: needDeleteGlyph.drawingId
@@ -2023,7 +1991,7 @@ const DeleteRightCommand = {
2023
1991
  endOffset: endOffset + 1
2024
1992
  },
2025
1993
  segmentId,
2026
- direction: DeleteDirection.RIGHT,
1994
+ direction: 1,
2027
1995
  textRanges,
2028
1996
  len: nextGlyph.count
2029
1997
  });
@@ -2038,7 +2006,7 @@ const DeleteRightCommand = {
2038
2006
  unitId: docDataModel.getUnitId(),
2039
2007
  range: actualRange,
2040
2008
  segmentId,
2041
- direction: DeleteDirection.RIGHT,
2009
+ direction: 1,
2042
2010
  textRanges,
2043
2011
  len: needDeleteGlyph.count
2044
2012
  });
@@ -2447,7 +2415,7 @@ _defineProperty(HtmlToUDMService, "_pluginList", []);
2447
2415
 
2448
2416
  //#endregion
2449
2417
  //#region src/services/clipboard/html-to-udm/paste-plugins/plugin-lark.ts
2450
- const wordPastePlugin = {
2418
+ const LarkPastePlugin = {
2451
2419
  name: "univer-doc-paste-plugin-lark",
2452
2420
  checkPasteType(html) {
2453
2421
  return /lark-record-clipboard/i.test(html);
@@ -2508,7 +2476,7 @@ function getParagraphStyle(el) {
2508
2476
 
2509
2477
  //#endregion
2510
2478
  //#region src/services/clipboard/html-to-udm/paste-plugins/plugin-univer.ts
2511
- const univerPastePlugin = {
2479
+ const UniverPastePlugin = {
2512
2480
  name: "univer-doc-paste-plugin-univer",
2513
2481
  checkPasteType(html) {
2514
2482
  return /UniverNormal/i.test(html);
@@ -2532,7 +2500,7 @@ const univerPastePlugin = {
2532
2500
 
2533
2501
  //#endregion
2534
2502
  //#region src/services/clipboard/html-to-udm/paste-plugins/plugin-word.ts
2535
- const wordPastePlugin$1 = {
2503
+ const WordPastePlugin = {
2536
2504
  name: "univer-doc-paste-plugin-word",
2537
2505
  checkPasteType(html) {
2538
2506
  return /word|mso/i.test(html);
@@ -2758,9 +2726,9 @@ var UDMToHtmlService = class {
2758
2726
 
2759
2727
  //#endregion
2760
2728
  //#region src/services/clipboard/clipboard.service.ts
2761
- HtmlToUDMService.use(wordPastePlugin$1);
2762
- HtmlToUDMService.use(wordPastePlugin);
2763
- HtmlToUDMService.use(univerPastePlugin);
2729
+ HtmlToUDMService.use(LarkPastePlugin);
2730
+ HtmlToUDMService.use(UniverPastePlugin);
2731
+ HtmlToUDMService.use(WordPastePlugin);
2764
2732
  function getTableSlice(body, start, end) {
2765
2733
  var _bodySlice$textRuns, _bodySlice$tables, _bodySlice$paragraphs;
2766
2734
  const bodySlice = getBodySlice(body, start, end + 2);
@@ -4670,12 +4638,6 @@ const SubtitleHeadingCommand = {
4670
4638
 
4671
4639
  //#endregion
4672
4640
  //#region src/services/selection/convert-text-range.ts
4673
- let NodePositionStateType = /* @__PURE__ */ function(NodePositionStateType) {
4674
- NodePositionStateType[NodePositionStateType["NORMAL"] = 0] = "NORMAL";
4675
- NodePositionStateType[NodePositionStateType["START"] = 1] = "START";
4676
- NodePositionStateType[NodePositionStateType["END"] = 2] = "END";
4677
- return NodePositionStateType;
4678
- }({});
4679
4641
  let NodePositionType = /* @__PURE__ */ function(NodePositionType) {
4680
4642
  NodePositionType[NodePositionType["page"] = 0] = "page";
4681
4643
  NodePositionType[NodePositionType["section"] = 1] = "section";
@@ -4774,20 +4736,20 @@ var NodePositionConvertToCursor = class {
4774
4736
  this._docSkeleton = _docSkeleton;
4775
4737
  _defineProperty(this, "_liquid", new Liquid());
4776
4738
  _defineProperty(this, "_currentStartState", {
4777
- page: NodePositionStateType.NORMAL,
4778
- section: NodePositionStateType.NORMAL,
4779
- column: NodePositionStateType.NORMAL,
4780
- line: NodePositionStateType.NORMAL,
4781
- divide: NodePositionStateType.NORMAL,
4782
- glyph: NodePositionStateType.NORMAL
4739
+ page: 0,
4740
+ section: 0,
4741
+ column: 0,
4742
+ line: 0,
4743
+ divide: 0,
4744
+ glyph: 0
4783
4745
  });
4784
4746
  _defineProperty(this, "_currentEndState", {
4785
- page: NodePositionStateType.NORMAL,
4786
- section: NodePositionStateType.NORMAL,
4787
- column: NodePositionStateType.NORMAL,
4788
- line: NodePositionStateType.NORMAL,
4789
- divide: NodePositionStateType.NORMAL,
4790
- glyph: NodePositionStateType.NORMAL
4747
+ page: 0,
4748
+ section: 0,
4749
+ column: 0,
4750
+ line: 0,
4751
+ divide: 0,
4752
+ glyph: 0
4791
4753
  });
4792
4754
  }
4793
4755
  getRangePointData(startOrigin, endOrigin) {
@@ -4874,27 +4836,27 @@ var NodePositionConvertToCursor = class {
4874
4836
  }
4875
4837
  _resetCurrentNodePositionState() {
4876
4838
  this._currentStartState = {
4877
- page: NodePositionStateType.NORMAL,
4878
- section: NodePositionStateType.NORMAL,
4879
- column: NodePositionStateType.NORMAL,
4880
- line: NodePositionStateType.NORMAL,
4881
- divide: NodePositionStateType.NORMAL,
4882
- glyph: NodePositionStateType.NORMAL
4839
+ page: 0,
4840
+ section: 0,
4841
+ column: 0,
4842
+ line: 0,
4843
+ divide: 0,
4844
+ glyph: 0
4883
4845
  };
4884
4846
  this._currentEndState = {
4885
- page: NodePositionStateType.NORMAL,
4886
- section: NodePositionStateType.NORMAL,
4887
- column: NodePositionStateType.NORMAL,
4888
- line: NodePositionStateType.NORMAL,
4889
- divide: NodePositionStateType.NORMAL,
4890
- glyph: NodePositionStateType.NORMAL
4847
+ page: 0,
4848
+ section: 0,
4849
+ column: 0,
4850
+ line: 0,
4851
+ divide: 0,
4852
+ glyph: 0
4891
4853
  };
4892
4854
  }
4893
- _setNodePositionState(type = NodePositionType.page, start, end, current) {
4894
- if (current === start) this._currentStartState[type] = NodePositionStateType.START;
4895
- else this._currentStartState[type] = NodePositionStateType.NORMAL;
4896
- if (current === end) this._currentEndState[type] = NodePositionStateType.END;
4897
- else this._currentEndState[type] = NodePositionStateType.NORMAL;
4855
+ _setNodePositionState(type = 0, start, end, current) {
4856
+ if (current === start) this._currentStartState[type] = 1;
4857
+ else this._currentStartState[type] = 0;
4858
+ if (current === end) this._currentEndState[type] = 2;
4859
+ else this._currentEndState[type] = 0;
4898
4860
  }
4899
4861
  _checkPreviousNodePositionState(typeIndex, isStart = true) {
4900
4862
  let index = typeIndex;
@@ -4906,7 +4868,7 @@ var NodePositionConvertToCursor = class {
4906
4868
  else state = this._currentEndState[type];
4907
4869
  if (state === void 0) return;
4908
4870
  if (resultState === void 0) resultState = state;
4909
- if (state !== resultState) return NodePositionStateType.NORMAL;
4871
+ if (state !== resultState) return 0;
4910
4872
  index--;
4911
4873
  }
4912
4874
  return resultState;
@@ -4925,8 +4887,8 @@ var NodePositionConvertToCursor = class {
4925
4887
  this._setNodePositionState(type, start, end, current);
4926
4888
  const preStartNestType = this._checkPreviousNodePositionState(typeIndex);
4927
4889
  const preEndNestType = this._checkPreviousNodePositionState(typeIndex, false);
4928
- if (preStartNestType === NodePositionStateType.START) start_next = startPosition[nextType];
4929
- if (preEndNestType === NodePositionStateType.END) end_next = endPosition[nextType];
4890
+ if (preStartNestType === 1) start_next = startPosition[nextType];
4891
+ if (preEndNestType === 2) end_next = endPosition[nextType];
4930
4892
  return {
4931
4893
  start_next,
4932
4894
  end_next
@@ -6990,28 +6952,28 @@ const DocTableInsertRowAboveCommand = {
6990
6952
  id: DocTableInsertRowAboveCommandId,
6991
6953
  type: CommandType.COMMAND,
6992
6954
  handler: async (accessor) => {
6993
- return accessor.get(ICommandService).executeCommand(DocTableInsertRowCommandId, { position: INSERT_ROW_POSITION.ABOVE });
6955
+ return accessor.get(ICommandService).executeCommand(DocTableInsertRowCommandId, { position: 0 });
6994
6956
  }
6995
6957
  };
6996
6958
  const DocTableInsertRowBellowCommand = {
6997
6959
  id: DocTableInsertRowBellowCommandId,
6998
6960
  type: CommandType.COMMAND,
6999
6961
  handler: async (accessor) => {
7000
- return accessor.get(ICommandService).executeCommand(DocTableInsertRowCommandId, { position: INSERT_ROW_POSITION.BELLOW });
6962
+ return accessor.get(ICommandService).executeCommand(DocTableInsertRowCommandId, { position: 1 });
7001
6963
  }
7002
6964
  };
7003
6965
  const DocTableInsertColumnLeftCommand = {
7004
6966
  id: DocTableInsertColumnLeftCommandId,
7005
6967
  type: CommandType.COMMAND,
7006
6968
  handler: async (accessor) => {
7007
- return accessor.get(ICommandService).executeCommand(DocTableInsertColumnCommandId, { position: INSERT_COLUMN_POSITION.LEFT });
6969
+ return accessor.get(ICommandService).executeCommand(DocTableInsertColumnCommandId, { position: 0 });
7008
6970
  }
7009
6971
  };
7010
6972
  const DocTableInsertColumnRightCommand = {
7011
6973
  id: DocTableInsertColumnRightCommandId,
7012
6974
  type: CommandType.COMMAND,
7013
6975
  handler: async (accessor) => {
7014
- return accessor.get(ICommandService).executeCommand(DocTableInsertColumnCommandId, { position: INSERT_COLUMN_POSITION.RIGHT });
6976
+ return accessor.get(ICommandService).executeCommand(DocTableInsertColumnCommandId, { position: 1 });
7015
6977
  }
7016
6978
  };
7017
6979
  /**
@@ -7207,8 +7169,8 @@ const DocTableTabCommand = {
7207
7169
  if (viewModel == null) return false;
7208
7170
  if (activeRange == null) return false;
7209
7171
  let offsets = null;
7210
- if (shift) offsets = getCellOffsets(viewModel, activeRange, CellPosition.PREV);
7211
- else offsets = getCellOffsets(viewModel, activeRange, CellPosition.NEXT);
7172
+ if (shift) offsets = getCellOffsets(viewModel, activeRange, 1);
7173
+ else offsets = getCellOffsets(viewModel, activeRange, 0);
7212
7174
  if (offsets) {
7213
7175
  const { startOffset, endOffset } = offsets;
7214
7176
  const textRanges = [{
@@ -7218,7 +7180,7 @@ const DocTableTabCommand = {
7218
7180
  textSelectionManager.replaceDocRanges(textRanges);
7219
7181
  return true;
7220
7182
  }
7221
- if (shift === false) return await commandService.executeCommand(DocTableInsertRowCommand.id, { position: INSERT_ROW_POSITION.BELLOW });
7183
+ if (shift === false) return await commandService.executeCommand(DocTableInsertRowCommand.id, { position: 1 });
7222
7184
  return true;
7223
7185
  }
7224
7186
  };
@@ -8020,15 +7982,6 @@ var TextBubbleShape = class TextBubbleShape extends Shape {
8020
7982
  //#region src/controllers/doc-header-footer.controller.ts
8021
7983
  const HEADER_FOOTER_STROKE_COLOR = "rgba(58, 96, 247, 1)";
8022
7984
  const HEADER_FOOTER_FILL_COLOR = "rgba(58, 96, 247, 0.08)";
8023
- let HeaderFooterType = /* @__PURE__ */ function(HeaderFooterType) {
8024
- HeaderFooterType[HeaderFooterType["FIRST_PAGE_HEADER"] = 0] = "FIRST_PAGE_HEADER";
8025
- HeaderFooterType[HeaderFooterType["FIRST_PAGE_FOOTER"] = 1] = "FIRST_PAGE_FOOTER";
8026
- HeaderFooterType[HeaderFooterType["DEFAULT_HEADER"] = 2] = "DEFAULT_HEADER";
8027
- HeaderFooterType[HeaderFooterType["DEFAULT_FOOTER"] = 3] = "DEFAULT_FOOTER";
8028
- HeaderFooterType[HeaderFooterType["EVEN_PAGE_HEADER"] = 4] = "EVEN_PAGE_HEADER";
8029
- HeaderFooterType[HeaderFooterType["EVEN_PAGE_FOOTER"] = 5] = "EVEN_PAGE_FOOTER";
8030
- return HeaderFooterType;
8031
- }({});
8032
7985
  function checkCreateHeaderFooterType(viewModel, editArea, segmentPage) {
8033
7986
  const { documentStyle } = viewModel.getDataModel().getSnapshot();
8034
7987
  const { defaultHeaderId, defaultFooterId, evenPageHeaderId, evenPageFooterId, firstPageHeaderId, firstPageFooterId, evenAndOddHeaders, useFirstPageHeaderFooter } = documentStyle;
@@ -8039,34 +7992,34 @@ function checkCreateHeaderFooterType(viewModel, editArea, segmentPage) {
8039
7992
  };
8040
7993
  case DocumentEditArea.HEADER:
8041
7994
  if (useFirstPageHeaderFooter === BooleanNumber.TRUE && !firstPageHeaderId) return {
8042
- createType: HeaderFooterType.FIRST_PAGE_HEADER,
7995
+ createType: 0,
8043
7996
  headerFooterId: null
8044
7997
  };
8045
7998
  if (evenAndOddHeaders === BooleanNumber.TRUE && segmentPage % 2 === 0 && !evenPageHeaderId) return {
8046
- createType: HeaderFooterType.EVEN_PAGE_HEADER,
7999
+ createType: 4,
8047
8000
  headerFooterId: null
8048
8001
  };
8049
8002
  return defaultHeaderId ? {
8050
8003
  createType: null,
8051
8004
  headerFooterId: defaultHeaderId
8052
8005
  } : {
8053
- createType: HeaderFooterType.DEFAULT_HEADER,
8006
+ createType: 2,
8054
8007
  headerFooterId: null
8055
8008
  };
8056
8009
  case DocumentEditArea.FOOTER:
8057
8010
  if (useFirstPageHeaderFooter === BooleanNumber.TRUE && !firstPageFooterId) return {
8058
- createType: HeaderFooterType.FIRST_PAGE_FOOTER,
8011
+ createType: 1,
8059
8012
  headerFooterId: null
8060
8013
  };
8061
8014
  if (evenAndOddHeaders === BooleanNumber.TRUE && segmentPage % 2 === 0 && !evenPageFooterId) return {
8062
- createType: HeaderFooterType.EVEN_PAGE_FOOTER,
8015
+ createType: 5,
8063
8016
  headerFooterId: null
8064
8017
  };
8065
8018
  return defaultFooterId ? {
8066
8019
  createType: null,
8067
8020
  headerFooterId: defaultFooterId
8068
8021
  } : {
8069
- createType: HeaderFooterType.DEFAULT_FOOTER,
8022
+ createType: 3,
8070
8023
  headerFooterId: null
8071
8024
  };
8072
8025
  default: throw new Error(`Invalid editArea: ${editArea}`);
@@ -8321,7 +8274,7 @@ function createHeaderFooterAction(segmentId, createType, documentStyle, actions)
8321
8274
  const jsonX = JSONX.getInstance();
8322
8275
  const ID_LEN = 6;
8323
8276
  const firstSegmentId = segmentId !== null && segmentId !== void 0 ? segmentId : generateRandomId(ID_LEN);
8324
- const isHeader = createType === HeaderFooterType.DEFAULT_HEADER || createType === HeaderFooterType.FIRST_PAGE_HEADER || createType === HeaderFooterType.EVEN_PAGE_HEADER;
8277
+ const isHeader = createType === 2 || createType === 0 || createType === 4;
8325
8278
  const insertAction = jsonX.insertOp([isHeader ? "headers" : "footers", firstSegmentId], {
8326
8279
  [isHeader ? "headerId" : "footerId"]: firstSegmentId,
8327
8280
  body: getEmptyHeaderFooterBody()
@@ -8336,27 +8289,27 @@ function createHeaderFooterAction(segmentId, createType, documentStyle, actions)
8336
8289
  let key = "defaultHeaderId";
8337
8290
  let pairKey = "defaultFooterId";
8338
8291
  switch (createType) {
8339
- case HeaderFooterType.DEFAULT_HEADER:
8292
+ case 2:
8340
8293
  key = "defaultHeaderId";
8341
8294
  pairKey = "defaultFooterId";
8342
8295
  break;
8343
- case HeaderFooterType.DEFAULT_FOOTER:
8296
+ case 3:
8344
8297
  key = "defaultFooterId";
8345
8298
  pairKey = "defaultHeaderId";
8346
8299
  break;
8347
- case HeaderFooterType.FIRST_PAGE_HEADER:
8300
+ case 0:
8348
8301
  key = "firstPageHeaderId";
8349
8302
  pairKey = "firstPageFooterId";
8350
8303
  break;
8351
- case HeaderFooterType.FIRST_PAGE_FOOTER:
8304
+ case 1:
8352
8305
  key = "firstPageFooterId";
8353
8306
  pairKey = "firstPageHeaderId";
8354
8307
  break;
8355
- case HeaderFooterType.EVEN_PAGE_HEADER:
8308
+ case 4:
8356
8309
  key = "evenPageHeaderId";
8357
8310
  pairKey = "evenPageFooterId";
8358
8311
  break;
8359
- case HeaderFooterType.EVEN_PAGE_FOOTER:
8312
+ case 5:
8360
8313
  key = "evenPageFooterId";
8361
8314
  pairKey = "evenPageHeaderId";
8362
8315
  break;
@@ -8416,8 +8369,8 @@ const CoreHeaderFooterCommand = {
8416
8369
  if (oldValue === void 0) action = jsonX.insertOp(["documentStyle", key], value);
8417
8370
  else action = jsonX.replaceOp(["documentStyle", key], oldValue, value);
8418
8371
  rawActions.push(action);
8419
- if (key === "useFirstPageHeaderFooter" && value === BooleanNumber.TRUE && !documentStyle.firstPageHeaderId) createHeaderFooterAction(segmentId, editArea === DocumentEditArea.HEADER ? HeaderFooterType.FIRST_PAGE_HEADER : HeaderFooterType.FIRST_PAGE_FOOTER, documentStyle, rawActions);
8420
- else if (key === "evenAndOddHeaders" && value === BooleanNumber.TRUE && !documentStyle.evenPageHeaderId) createHeaderFooterAction(segmentId, editArea === DocumentEditArea.HEADER ? HeaderFooterType.EVEN_PAGE_HEADER : HeaderFooterType.EVEN_PAGE_FOOTER, documentStyle, rawActions);
8372
+ if (key === "useFirstPageHeaderFooter" && value === BooleanNumber.TRUE && !documentStyle.firstPageHeaderId) createHeaderFooterAction(segmentId, editArea === DocumentEditArea.HEADER ? 0 : 1, documentStyle, rawActions);
8373
+ else if (key === "evenAndOddHeaders" && value === BooleanNumber.TRUE && !documentStyle.evenPageHeaderId) createHeaderFooterAction(segmentId, editArea === DocumentEditArea.HEADER ? 4 : 5, documentStyle, rawActions);
8421
8374
  });
8422
8375
  if (rawActions.length === 0) return false;
8423
8376
  doMutation.params.actions = rawActions.reduce((acc, cur) => {
@@ -8701,6 +8654,7 @@ function PageSettings(props) {
8701
8654
  children: localeService.t("page-settings.top")
8702
8655
  }), /* @__PURE__ */ jsx(InputNumber, {
8703
8656
  precision: 2,
8657
+ min: 0,
8704
8658
  max: settings.pageSise.height / 2,
8705
8659
  value: settings.margins.top,
8706
8660
  onChange: (e) => handleMarginChange("top", e)
@@ -8712,6 +8666,7 @@ function PageSettings(props) {
8712
8666
  children: localeService.t("page-settings.bottom")
8713
8667
  }), /* @__PURE__ */ jsx(InputNumber, {
8714
8668
  precision: 2,
8669
+ min: 0,
8715
8670
  max: settings.pageSise.height / 2,
8716
8671
  value: settings.margins.bottom,
8717
8672
  onChange: (e) => handleMarginChange("bottom", e)
@@ -8726,6 +8681,7 @@ function PageSettings(props) {
8726
8681
  children: localeService.t("page-settings.left")
8727
8682
  }), /* @__PURE__ */ jsx(InputNumber, {
8728
8683
  precision: 2,
8684
+ min: 0,
8729
8685
  max: settings.pageSise.width / 2,
8730
8686
  value: settings.margins.left,
8731
8687
  onChange: (e) => handleMarginChange("left", e)
@@ -8737,6 +8693,7 @@ function PageSettings(props) {
8737
8693
  children: localeService.t("page-settings.right")
8738
8694
  }), /* @__PURE__ */ jsx(InputNumber, {
8739
8695
  precision: 2,
8696
+ min: 0,
8740
8697
  max: settings.pageSise.width / 2,
8741
8698
  value: settings.margins.right,
8742
8699
  onChange: (e) => handleMarginChange("right", e)
@@ -9464,38 +9421,33 @@ const listValueFactory$ = (accessor) => {
9464
9421
  return new Observable((subscriber) => {
9465
9422
  const univerInstanceService = accessor.get(IUniverInstanceService);
9466
9423
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
9467
- let textSubscription;
9468
9424
  const subscription = univerInstanceService.focused$.subscribe((unitId) => {
9469
- textSubscription === null || textSubscription === void 0 || textSubscription.unsubscribe();
9425
+ var _docRanges$find;
9470
9426
  if (unitId == null) return;
9471
9427
  const docDataModel = univerInstanceService.getUniverDocInstance(unitId);
9472
9428
  if (docDataModel == null) return;
9473
- textSubscription = docSelectionManagerService.textSelection$.subscribe(() => {
9474
- var _docRanges$find;
9475
- const docRanges = docSelectionManagerService.getDocRanges();
9476
- const range = (_docRanges$find = docRanges.find((r) => r.isActive)) !== null && _docRanges$find !== void 0 ? _docRanges$find : docRanges[0];
9477
- if (range) {
9478
- var _doc$getBody$paragrap, _doc$getBody, _doc$getBody$dataStre, _doc$getBody2;
9479
- const doc = docDataModel.getSelfOrHeaderFooterModel(range === null || range === void 0 ? void 0 : range.segmentId);
9480
- const paragraphs = 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 : "");
9481
- let listType;
9482
- if (paragraphs.every((p) => {
9483
- if (!listType) {
9484
- var _p$bullet;
9485
- listType = (_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType;
9486
- }
9487
- return p.bullet && p.bullet.listType === listType;
9488
- })) {
9489
- subscriber.next(listType);
9490
- return;
9429
+ const docRanges = docSelectionManagerService.getDocRanges();
9430
+ const range = (_docRanges$find = docRanges.find((r) => r.isActive)) !== null && _docRanges$find !== void 0 ? _docRanges$find : docRanges[0];
9431
+ if (range) {
9432
+ var _doc$getBody$paragrap, _doc$getBody, _doc$getBody$dataStre, _doc$getBody2;
9433
+ const doc = docDataModel.getSelfOrHeaderFooterModel(range === null || range === void 0 ? void 0 : range.segmentId);
9434
+ const paragraphs = 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 : "");
9435
+ let listType;
9436
+ if (paragraphs.every((p) => {
9437
+ if (!listType) {
9438
+ var _p$bullet;
9439
+ listType = (_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType;
9491
9440
  }
9441
+ return p.bullet && p.bullet.listType === listType;
9442
+ })) {
9443
+ subscriber.next(listType);
9444
+ return;
9492
9445
  }
9493
- subscriber.next(void 0);
9494
- });
9446
+ }
9447
+ subscriber.next(void 0);
9495
9448
  });
9496
9449
  return () => {
9497
9450
  subscription.unsubscribe();
9498
- textSubscription === null || textSubscription === void 0 || textSubscription.unsubscribe();
9499
9451
  };
9500
9452
  });
9501
9453
  };
@@ -9882,7 +9834,7 @@ function transformBound2OffsetBound(originBound, scene) {
9882
9834
  }
9883
9835
  function transformPosition2Offset(x, y, scene) {
9884
9836
  const { scaleX, scaleY } = scene.getAncestorScale();
9885
- const viewMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
9837
+ const viewMain = scene.getViewport("viewMain");
9886
9838
  if (!viewMain) return {
9887
9839
  x,
9888
9840
  y
@@ -9895,7 +9847,7 @@ function transformPosition2Offset(x, y, scene) {
9895
9847
  }
9896
9848
  function transformOffset2Bound(offsetX, offsetY, scene) {
9897
9849
  const { scaleX, scaleY } = scene.getAncestorScale();
9898
- const viewMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
9850
+ const viewMain = scene.getViewport("viewMain");
9899
9851
  if (!viewMain) return {
9900
9852
  x: offsetX,
9901
9853
  y: offsetY
@@ -9964,7 +9916,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
9964
9916
  if (newPosition) position$.next(newPosition);
9965
9917
  }
9966
9918
  }));
9967
- const viewMain = currentRender.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
9919
+ const viewMain = currentRender.scene.getViewport("viewMain");
9968
9920
  if (viewMain) disposable.add(viewMain.onScrollAfter$.subscribeEvent(() => {
9969
9921
  position$.next(calc());
9970
9922
  }));
@@ -9999,7 +9951,7 @@ let DocCanvasPopManagerService = class DocCanvasPopManagerService extends Dispos
9999
9951
  }
10000
9952
  }
10001
9953
  }));
10002
- const viewMain = currentRender.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
9954
+ const viewMain = currentRender.scene.getViewport("viewMain");
10003
9955
  if (viewMain) disposable.add(viewMain.onScrollAfter$.subscribeEvent(() => {
10004
9956
  const position = calcDocRangePositions(range, currentRender);
10005
9957
  if (position) positions$.next(position);
@@ -10765,7 +10717,7 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
10765
10717
  handleHoverParagraph(p !== null && p !== void 0 ? p : left);
10766
10718
  }));
10767
10719
  let lastScrollY = 0;
10768
- this.disposeWithMe(this._context.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN).onScrollAfter$.subscribeEvent((e) => {
10720
+ this.disposeWithMe(this._context.scene.getViewport("viewMain").onScrollAfter$.subscribeEvent((e) => {
10769
10721
  if (lastScrollY === e.scrollY) return;
10770
10722
  lastScrollY = e.scrollY;
10771
10723
  this.hideParagraphMenu(true);
@@ -10781,18 +10733,19 @@ let DocParagraphMenuService = class DocParagraphMenuService extends Disposable {
10781
10733
  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 : "";
10782
10734
  const paragraphDataStream = paragraph ? dataStream.slice(paragraph.paragraphStart, paragraph.paragraphEnd) : "";
10783
10735
  if (paragraphDataStream === "\b" || paragraphDataStream === "") return;
10736
+ const disposable = this._docPopupManagerService.attachPopupToRect(paragraph.firstLine, {
10737
+ componentKey: "doc.paragraph.menu",
10738
+ direction: "left-center",
10739
+ onClickOutside: () => {
10740
+ this._docSelectionManagerService.textSelection$.pipe(first()).subscribe(() => {
10741
+ if (!this._isCursorInActiveParagraph()) this.hideParagraphMenu(true);
10742
+ });
10743
+ },
10744
+ zIndex: 101
10745
+ }, this._context.unitId);
10784
10746
  this._paragrahMenu = {
10785
10747
  paragraph,
10786
- disposable: this._docPopupManagerService.attachPopupToRect(paragraph.firstLine, {
10787
- componentKey: "doc.paragraph.menu",
10788
- direction: "left-center",
10789
- onClickOutside: () => {
10790
- this._docSelectionManagerService.textSelection$.pipe(first()).subscribe(() => {
10791
- if (!this._isCursorInActiveParagraph()) this.hideParagraphMenu(true);
10792
- });
10793
- },
10794
- zIndex: 101
10795
- }, this._context.unitId),
10748
+ disposable,
10796
10749
  active: false
10797
10750
  };
10798
10751
  }
@@ -11244,7 +11197,7 @@ function ParagraphSetting() {
11244
11197
  title: item.label,
11245
11198
  placement: "bottom",
11246
11199
  children: /* @__PURE__ */ jsx("span", {
11247
- className: 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-blend-color-dodge/90": horizontalAlignValue === item.value }),
11200
+ className: 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 }),
11248
11201
  onClick: () => setHorizontalAlign(item.value),
11249
11202
  children: item.icon
11250
11203
  })
@@ -12276,7 +12229,7 @@ function DocSideMenuContent() {
12276
12229
  };
12277
12230
  }, [commandService, currentDoc]);
12278
12231
  useEffect(() => {
12279
- const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
12232
+ const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
12280
12233
  if (!viewport) return;
12281
12234
  const sub = fromEventSubject(viewport.onScrollAfter$).pipe(throttleTime(33)).subscribe(handleScroll);
12282
12235
  return () => {
@@ -12284,7 +12237,7 @@ function DocSideMenuContent() {
12284
12237
  };
12285
12238
  }, [renderer]);
12286
12239
  const handleClick = useEvent((menu) => {
12287
- const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
12240
+ const viewport = renderer === null || renderer === void 0 ? void 0 : renderer.scene.getViewport("viewMain");
12288
12241
  if (!viewport) return;
12289
12242
  if (menu.id === TITLE_ID) {
12290
12243
  viewport.scrollToViewportPos({ viewportScrollY: 0 });
@@ -12459,7 +12412,7 @@ let DocBackScrollRenderController = class DocBackScrollRenderController extends
12459
12412
  const { left: aLeft, top: aTop, height } = getAnchorBounding(contentBoxPointGroup);
12460
12413
  const left = aLeft + docsLeft;
12461
12414
  const top = aTop + docsTop;
12462
- const viewportMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
12415
+ const viewportMain = scene.getViewport("viewMain");
12463
12416
  const editor = this._editorService.getEditor(unitId);
12464
12417
  if (viewportMain == null) return;
12465
12418
  const { left: boundLeft, top: boundTop, right: boundRight, bottom: boundBottom } = viewportMain.getBounding().viewBound;
@@ -12520,7 +12473,7 @@ let DocRenderController = class DocRenderController extends RxDisposable {
12520
12473
  }
12521
12474
  _addNewRender() {
12522
12475
  const { scene, engine } = this._context;
12523
- const viewMain = new Viewport(VIEWPORT_KEY.VIEW_MAIN, scene, {
12476
+ const viewMain = new Viewport("viewMain", scene, {
12524
12477
  left: 0,
12525
12478
  top: 0,
12526
12479
  bottom: 0,
@@ -12558,13 +12511,13 @@ let DocRenderController = class DocRenderController extends RxDisposable {
12558
12511
  pageMarginLeft: 20,
12559
12512
  pageMarginTop: 20
12560
12513
  };
12561
- const documents = new Documents(DOCS_VIEW_KEY.MAIN, void 0, config);
12514
+ const documents = new Documents("__Document_Render_Main__", void 0, config);
12562
12515
  documents.zIndex = 10;
12563
- const docBackground = new DocBackground(DOCS_VIEW_KEY.BACKGROUND, void 0, config);
12516
+ const docBackground = new DocBackground("__Document_Render_Background__", void 0, config);
12564
12517
  docBackground.zIndex = 10;
12565
12518
  this._context.mainComponent = documents;
12566
- components.set(DOCS_VIEW_KEY.MAIN, documents);
12567
- components.set(DOCS_VIEW_KEY.BACKGROUND, docBackground);
12519
+ components.set("__Document_Render_Main__", documents);
12520
+ components.set("__Document_Render_Background__", docBackground);
12568
12521
  scene.addObjects([documents], 2);
12569
12522
  scene.addObjects([docBackground], 0);
12570
12523
  if (this._editorService.getEditor(documentModel.getUnitId()) == null) scene.enableLayerCache(2);
@@ -12578,7 +12531,7 @@ let DocRenderController = class DocRenderController extends RxDisposable {
12578
12531
  if (!skeleton) return;
12579
12532
  const { mainComponent, components } = this._context;
12580
12533
  const docsComponent = mainComponent;
12581
- const docBackground = components.get(DOCS_VIEW_KEY.BACKGROUND);
12534
+ const docBackground = components.get("__Document_Render_Background__");
12582
12535
  docsComponent.changeSkeleton(skeleton);
12583
12536
  docBackground.changeSkeleton(skeleton);
12584
12537
  const { unitId } = this._context;
@@ -12603,7 +12556,7 @@ let DocRenderController = class DocRenderController extends RxDisposable {
12603
12556
  var _skeleton$getSkeleton;
12604
12557
  const { mainComponent, scene, unitId, components } = this._context;
12605
12558
  const docsComponent = mainComponent;
12606
- const docBackground = components.get(DOCS_VIEW_KEY.BACKGROUND);
12559
+ const docBackground = components.get("__Document_Render_Background__");
12607
12560
  const pages = (_skeleton$getSkeleton = skeleton.getSkeletonData()) === null || _skeleton$getSkeleton === void 0 ? void 0 : _skeleton$getSkeleton.pages;
12608
12561
  if (pages == null) return;
12609
12562
  let width = 0;
@@ -12664,7 +12617,7 @@ function getPageSizeInModernMode(page) {
12664
12617
  //#endregion
12665
12618
  //#region package.json
12666
12619
  var name = "@univerjs/docs-ui";
12667
- var version = "0.21.1";
12620
+ var version = "0.22.0";
12668
12621
 
12669
12622
  //#endregion
12670
12623
  //#region src/controllers/doc-auto-format.controller.ts
@@ -12699,7 +12652,7 @@ let DocAutoFormatController = class DocAutoFormatController extends Disposable {
12699
12652
  const params = context.commandParams;
12700
12653
  return [{
12701
12654
  id: ChangeListNestingLevelCommand.id,
12702
- params: { type: (params === null || params === void 0 ? void 0 : params.shift) ? ChangeListNestingLevelType.decrease : ChangeListNestingLevelType.increase }
12655
+ params: { type: (params === null || params === void 0 ? void 0 : params.shift) ? -1 : 1 }
12703
12656
  }];
12704
12657
  },
12705
12658
  priority: 100
@@ -12777,7 +12730,7 @@ let DocAutoFormatController = class DocAutoFormatController extends Disposable {
12777
12730
  if (!bullet) return [];
12778
12731
  if (bullet.nestingLevel > 0) return [{
12779
12732
  id: ChangeListNestingLevelCommand.id,
12780
- params: { type: ChangeListNestingLevelType.decrease }
12733
+ params: { type: -1 }
12781
12734
  }];
12782
12735
  return [{
12783
12736
  id: ListOperationCommand.id,
@@ -13799,7 +13752,7 @@ var DocPageLayoutService = class extends Disposable {
13799
13752
  }
13800
13753
  docsComponent.translate(docsLeft, docsTop);
13801
13754
  docBackground.translate(docsLeft, docsTop);
13802
- const viewport = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
13755
+ const viewport = scene.getViewport("viewMain");
13803
13756
  if (scrollToX !== Number.POSITIVE_INFINITY && viewport != null) viewport.scrollToViewportPos({ viewportScrollX: scrollToX });
13804
13757
  return this;
13805
13758
  }
@@ -14949,7 +14902,7 @@ const useResize = (editor, isSingle = true, autoScrollbar, autoScroll) => {
14949
14902
  if (!editor || !autoScrollbar) return;
14950
14903
  const skeleton = editor.render.with(DocSkeletonManagerService).getSkeleton();
14951
14904
  const { scene, mainComponent } = editor.render;
14952
- const viewportMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
14905
+ const viewportMain = scene.getViewport("viewMain");
14953
14906
  const { actualWidth, actualHeight } = skeleton.getActualSize();
14954
14907
  const { width, height } = editor.getBoundingClientRect();
14955
14908
  let scrollBar = viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.getScrollBar();
@@ -15145,4 +15098,4 @@ const RichTextEditor = (props) => {
15145
15098
  };
15146
15099
 
15147
15100
  //#endregion
15148
- export { AfterSpaceCommand, AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand, BreakLineCommand, BulletListCommand, ChangeListNestingLevelCommand, ChangeListNestingLevelType, ChangeListTypeCommand, CheckListCommand, CoverContentCommand, CreateDocTableCommand, CutContentCommand, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX, DOCS_COMPONENT_DEFAULT_Z_INDEX, DOCS_COMPONENT_HEADER_LAYER_INDEX, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteCommand, DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, DocAutoFormatService, DocBackScrollRenderController, DocCanvasPopManagerService, DocCopyCommand, DocCreateTableOperation, DocCutCommand, DocEventManagerService, DocIMEInputManagerService, DocPasteCommand, DocPrintInterceptorService, DocRenderController, DocSelectAllCommand, DocSelectionRenderService, DocStateChangeManagerService, DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand, DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand, DocTableTabCommand, DocUIController, DocsRenderService, menuSchema as DocsUIMenuSchema, Editor, EditorInsertTextCommandId, EditorService, EnterCommand, HorizontalLineCommand, IDocClipboardService, IEditorService, IMEInputCommand, InnerPasteCommand, InsertCommand, InsertCustomRangeCommand, ListOperationCommand, MergeTwoParagraphCommand, MoveCursorOperation, MoveSelectionOperation, NORMAL_TEXT_SELECTION_PLUGIN_NAME, NodePositionConvertToCursor, NodePositionConvertToRectRange, OrderListCommand, wordPastePlugin as PastePluginLark, univerPastePlugin as PastePluginUniver, wordPastePlugin$1 as PastePluginWord, QuickListCommand, RectRange, ReplaceContentCommand, ReplaceSelectionCommand, ReplaceSnapshotCommand, ReplaceTextRunsCommand, ResetInlineFormatTextBackgroundColorCommand, RichTextEditor, SetDocZoomRatioCommand, SetDocZoomRatioOperation, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, SetParagraphNamedStyleCommand, SwitchDocModeCommand, TEXT_RANGE_LAYER_INDEX, TabCommand, TextRange, ToggleCheckListCommand, UniverDocsUIPlugin, UpdateCommand, VIEWPORT_KEY, addCustomDecorationBySelectionFactory, addCustomDecorationFactory, calcDocRangePositions, convertBodyToHtml, convertPositionsToRectRanges, deleteCustomDecorationFactory, docDrawingPositionToTransform, genTableSource, generateParagraphs, getAnchorBounding, getCanvasOffsetByEngine, getCommandSkeleton, getCursorWhenDelete, getCustomBlockIdsInSelections, getCutActionsFromDocRanges, getDocObject, getDocObjectById, getEmptyTableCell, getEmptyTableRow, getLineBounding, getOneTextSelectionRange, getRichTextEditPath, getTableColumn, hasParagraphInTable, isInSameTableCell, isValidRectRange, neoGetDocObject, transformToDocDrawingPosition, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, whenDocAndEditorFocused };
15101
+ export { AfterSpaceCommand, AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand, BreakLineCommand, BulletListCommand, ChangeListNestingLevelCommand, ChangeListNestingLevelType, ChangeListTypeCommand, CheckListCommand, CoverContentCommand, CreateDocTableCommand, CutContentCommand, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX, DOCS_COMPONENT_DEFAULT_Z_INDEX, DOCS_COMPONENT_HEADER_LAYER_INDEX, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteCommand, DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, DocAutoFormatService, DocBackScrollRenderController, DocCanvasPopManagerService, DocCopyCommand, DocCreateTableOperation, DocCutCommand, DocEventManagerService, DocIMEInputManagerService, DocPasteCommand, DocPrintInterceptorService, DocRenderController, DocSelectAllCommand, DocSelectionRenderService, DocStateChangeManagerService, DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand, DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand, DocTableTabCommand, DocUIController, DocsRenderService, menuSchema as DocsUIMenuSchema, Editor, EditorInsertTextCommandId, EditorService, EnterCommand, HorizontalLineCommand, IDocClipboardService, IEditorService, IMEInputCommand, InnerPasteCommand, InsertCommand, InsertCustomRangeCommand, ListOperationCommand, MergeTwoParagraphCommand, MoveCursorOperation, MoveSelectionOperation, NORMAL_TEXT_SELECTION_PLUGIN_NAME, NodePositionConvertToCursor, NodePositionConvertToRectRange, OrderListCommand, LarkPastePlugin as PastePluginLark, UniverPastePlugin as PastePluginUniver, WordPastePlugin as PastePluginWord, QuickListCommand, RectRange, ReplaceContentCommand, ReplaceSelectionCommand, ReplaceSnapshotCommand, ReplaceTextRunsCommand, ResetInlineFormatTextBackgroundColorCommand, RichTextEditor, SetDocZoomRatioCommand, SetDocZoomRatioOperation, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, SetParagraphNamedStyleCommand, SwitchDocModeCommand, TEXT_RANGE_LAYER_INDEX, TabCommand, TextRange, ToggleCheckListCommand, UniverDocsUIPlugin, UpdateCommand, VIEWPORT_KEY, addCustomDecorationBySelectionFactory, addCustomDecorationFactory, calcDocRangePositions, convertBodyToHtml, convertPositionsToRectRanges, deleteCustomDecorationFactory, docDrawingPositionToTransform, genTableSource, generateParagraphs, getAnchorBounding, getCanvasOffsetByEngine, getCommandSkeleton, getCursorWhenDelete, getCustomBlockIdsInSelections, getCutActionsFromDocRanges, getDocObject, getDocObjectById, getEmptyTableCell, getEmptyTableRow, getLineBounding, getOneTextSelectionRange, getRichTextEditPath, getTableColumn, hasParagraphInTable, isInSameTableCell, isValidRectRange, neoGetDocObject, transformToDocDrawingPosition, useEditor, useEditorClickOutside, useIsFocusing, useKeyboardEvent, useLeftAndRightArrow, useOnChange, useResize, whenDocAndEditorFocused };