@univerjs/docs-ui 0.23.0 → 0.24.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/index.js CHANGED
@@ -108,7 +108,7 @@ function addCustomDecorationBySelectionFactory(accessor, param) {
108
108
  const { segmentId, id, type, unitId: propUnitId } = param;
109
109
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
110
110
  const univerInstanceService = accessor.get(IUniverInstanceService);
111
- const documentDataModel = propUnitId ? univerInstanceService.getUnit(propUnitId, UniverInstanceType.UNIVER_DOC) : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
111
+ const documentDataModel = propUnitId ? univerInstanceService.getUnit(propUnitId, UniverInstanceType.UNIVER_DOC) : univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
112
112
  if (!documentDataModel) return false;
113
113
  const unitId = documentDataModel.getUnitId();
114
114
  const selections = docSelectionManagerService.getTextRanges({
@@ -316,7 +316,7 @@ let DocAutoFormatService = class DocAutoFormatService extends Disposable {
316
316
  onAutoFormat(id, params) {
317
317
  var _this$_matches$get, _docRanges$find;
318
318
  const autoFormats = (_this$_matches$get = this._matches.get(id)) !== null && _this$_matches$get !== void 0 ? _this$_matches$get : [];
319
- const unit = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
319
+ const unit = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
320
320
  const docRanges = this._textSelectionManagerService.getDocRanges();
321
321
  const selection = (_docRanges$find = docRanges.find((range) => range.isActive)) !== null && _docRanges$find !== void 0 ? _docRanges$find : docRanges[0];
322
322
  if (unit && selection) {
@@ -401,7 +401,7 @@ let DocMenuStyleService = class DocMenuStyleService extends Disposable {
401
401
  }
402
402
  getDefaultStyle() {
403
403
  var _this$_renderManagerS;
404
- const docDataModel = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
404
+ const docDataModel = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
405
405
  if (docDataModel == null) return { ...DEFAULT_TEXT_STYLE };
406
406
  const unitId = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId();
407
407
  const docSkeletonManagerService = (_this$_renderManagerS = this._renderManagerService.getRenderById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService);
@@ -501,7 +501,7 @@ const BreakLineCommand = {
501
501
  }
502
502
  const { horizontalLine } = params !== null && params !== void 0 ? params : {};
503
503
  const { segmentId } = activeTextRange;
504
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
504
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
505
505
  const originBody = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId !== null && segmentId !== void 0 ? segmentId : "").getBody();
506
506
  if (docDataModel == null || originBody == null) return false;
507
507
  const unitId = docDataModel.getUnitId();
@@ -1616,7 +1616,7 @@ const MergeTwoParagraphCommand = {
1616
1616
  const ranges = docSelectionManagerService.getTextRanges();
1617
1617
  if (activeRange == null || ranges == null) return false;
1618
1618
  const { segmentId, style } = activeRange;
1619
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
1619
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
1620
1620
  const originBody = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
1621
1621
  if (docDataModel == null || originBody == null) return false;
1622
1622
  const dataStream = originBody.dataStream;
@@ -1696,7 +1696,7 @@ const RemoveHorizontalLineCommand = {
1696
1696
  const ranges = docSelectionManagerService.getTextRanges();
1697
1697
  if (activeRange == null || ranges == null) return false;
1698
1698
  const { segmentId, style } = activeRange;
1699
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
1699
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
1700
1700
  const originBody = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
1701
1701
  if (docDataModel == null || originBody == null) return false;
1702
1702
  const actualRange = activeRange;
@@ -2069,10 +2069,6 @@ const DeleteCurrentParagraphCommand = {
2069
2069
  //#endregion
2070
2070
  //#region src/services/clipboard/copy-content-cache.ts
2071
2071
  const COPY_CONTENT_CACHE_LIMIT = 10;
2072
- const ID_LENGTH$2 = 6;
2073
- function genId() {
2074
- return generateRandomId(ID_LENGTH$2);
2075
- }
2076
2072
  function extractId(html) {
2077
2073
  const match = html.match(/data-copy-id="([^\s]+)"/);
2078
2074
  if (match && match[1]) return match[1];
@@ -2785,7 +2781,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
2785
2781
  }
2786
2782
  async legacyPaste(options) {
2787
2783
  let { html, text, files } = options;
2788
- const currentDocInstance = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
2784
+ const currentDocInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
2789
2785
  const docUnitId = (currentDocInstance === null || currentDocInstance === void 0 ? void 0 : currentDocInstance.getUnitId()) || "";
2790
2786
  if (!html && !text && files.length) html = await this._createImagePasteHtml(files);
2791
2787
  if (!html && !text) {
@@ -2839,7 +2835,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
2839
2835
  const { body: _body } = docData;
2840
2836
  if (_body == null) return false;
2841
2837
  let body = normalizeBody(_body);
2842
- if (!((_this$_univerInstance = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId())) return false;
2838
+ if (!((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId())) return false;
2843
2839
  this._clipboardHooks.forEach((hook) => {
2844
2840
  if (hook.onBeforePaste) body = hook.onBeforePaste(body);
2845
2841
  });
@@ -2879,7 +2875,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
2879
2875
  }
2880
2876
  async _setClipboardData(documentList, needCache = true) {
2881
2877
  var _documentList$0$body;
2882
- const copyId = genId();
2878
+ const copyId = generateRandomId(6);
2883
2879
  const text = (documentList.length > 1 ? documentList.map((doc) => {
2884
2880
  var _doc$body;
2885
2881
  return ((_doc$body = doc.body) === null || _doc$body === void 0 ? void 0 : _doc$body.dataStream) || "";
@@ -2996,7 +2992,7 @@ let DocClipboardService = class DocClipboardService extends Disposable {
2996
2992
  if (copyCache) return copyCache;
2997
2993
  }
2998
2994
  if (!_unitId) {
2999
- const currentDocInstance = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
2995
+ const currentDocInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3000
2996
  _unitId = (currentDocInstance === null || currentDocInstance === void 0 ? void 0 : currentDocInstance.getUnitId()) || "";
3001
2997
  }
3002
2998
  const doc = this._htmlToUDM.convert(html, { unitId: _unitId });
@@ -3209,7 +3205,7 @@ const DocSelectAllCommand = {
3209
3205
  var _docRanges$find;
3210
3206
  const univerInstanceService = accessor.get(IUniverInstanceService);
3211
3207
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
3212
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
3208
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3213
3209
  const docRanges = docSelectionManagerService.getDocRanges();
3214
3210
  const activeRange = (_docRanges$find = docRanges.find((range) => range.isActive)) !== null && _docRanges$find !== void 0 ? _docRanges$find : docRanges[0];
3215
3211
  if (docDataModel == null || activeRange == null) return false;
@@ -3526,7 +3522,7 @@ const SetInlineFormatCommand = {
3526
3522
  const activeRange = (_docRanges$find = docRanges.find((r) => r.isActive)) !== null && _docRanges$find !== void 0 ? _docRanges$find : docRanges[0];
3527
3523
  if (docRanges.length === 0) return false;
3528
3524
  const { segmentId } = docRanges[0];
3529
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
3525
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3530
3526
  if (docDataModel == null) return false;
3531
3527
  const body = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
3532
3528
  if (body == null) return false;
@@ -3959,7 +3955,7 @@ const ListOperationCommand = {
3959
3955
  const univerInstanceService = accessor.get(IUniverInstanceService);
3960
3956
  const commandService = accessor.get(ICommandService);
3961
3957
  const listType = params.listType;
3962
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
3958
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
3963
3959
  const docRanges = (_ref = (_params$docRange = params.docRange) !== null && _params$docRange !== void 0 ? _params$docRange : docSelectionManagerService.getDocRanges()) !== null && _ref !== void 0 ? _ref : [];
3964
3960
  if (docDataModel == null || docRanges.length === 0) return false;
3965
3961
  const segmentId = docRanges[0].segmentId;
@@ -4001,7 +3997,7 @@ const ChangeListTypeCommand = {
4001
3997
  const univerInstanceService = accessor.get(IUniverInstanceService);
4002
3998
  const commandService = accessor.get(ICommandService);
4003
3999
  const { listType } = params;
4004
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
4000
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
4005
4001
  const activeRanges = (_params$docRange2 = params.docRange) !== null && _params$docRange2 !== void 0 ? _params$docRange2 : docSelectionManagerService.getDocRanges();
4006
4002
  if (docDataModel == null || activeRanges == null || !activeRanges.length) return false;
4007
4003
  const { segmentId } = activeRanges[0];
@@ -4049,7 +4045,7 @@ const ChangeListNestingLevelCommand = {
4049
4045
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
4050
4046
  const univerInstanceService = accessor.get(IUniverInstanceService);
4051
4047
  const commandService = accessor.get(ICommandService);
4052
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
4048
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
4053
4049
  const activeRange = docSelectionManagerService.getActiveTextRange();
4054
4050
  if (docDataModel == null || activeRange == null) return false;
4055
4051
  const { segmentId } = activeRange;
@@ -4121,7 +4117,7 @@ const ToggleCheckListCommand = {
4121
4117
  const univerInstanceService = accessor.get(IUniverInstanceService);
4122
4118
  const commandService = accessor.get(ICommandService);
4123
4119
  const { index, segmentId, textRanges } = params;
4124
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
4120
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
4125
4121
  if (docDataModel == null) return false;
4126
4122
  if (((_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.paragraphs) == null) return false;
4127
4123
  const unitId = docDataModel.getUnitId();
@@ -4166,7 +4162,7 @@ const QuickListCommand = {
4166
4162
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
4167
4163
  const univerInstanceService = accessor.get(IUniverInstanceService);
4168
4164
  const commandService = accessor.get(ICommandService);
4169
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
4165
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
4170
4166
  const activeRange = docSelectionManagerService.getActiveTextRange();
4171
4167
  if (docDataModel == null || activeRange == null) return false;
4172
4168
  const { segmentId, startOffset } = activeRange;
@@ -4523,7 +4519,7 @@ const QuickHeadingCommand = {
4523
4519
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
4524
4520
  const univerInstanceService = accessor.get(IUniverInstanceService);
4525
4521
  const commandService = accessor.get(ICommandService);
4526
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
4522
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
4527
4523
  const activeRange = docSelectionManagerService.getActiveTextRange();
4528
4524
  if (docDataModel == null || activeRange == null || !activeRange.collapsed) return false;
4529
4525
  const { segmentId, startOffset } = activeRange;
@@ -6991,7 +6987,7 @@ const DocTableInsertRowCommand = {
6991
6987
  const rangeInfo = getRangeInfoFromRanges(docSelectionManagerService.getActiveTextRange(), activeRectRanges);
6992
6988
  if (rangeInfo == null) return false;
6993
6989
  const { segmentId } = rangeInfo;
6994
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
6990
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
6995
6991
  const body = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
6996
6992
  if (docDataModel == null || body == null) return false;
6997
6993
  const docSkeletonManagerService = getCommandSkeleton(accessor, docDataModel.getUnitId());
@@ -7368,7 +7364,7 @@ var Editor = class extends Disposable {
7368
7364
  * @deprecated use `IEditorService.focus` as instead. this is for internal usage.
7369
7365
  */
7370
7366
  focus() {
7371
- const curDoc = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
7367
+ const curDoc = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
7372
7368
  const editorUnitId = this.getEditorId();
7373
7369
  if (curDoc == null || curDoc.getUnitId() !== editorUnitId) this._univerInstanceService.setCurrentUnitForType(editorUnitId);
7374
7370
  this._param.render.with(DocSelectionRenderService).focus();
@@ -9516,11 +9512,11 @@ function DocSwitchModeMenuItemFactory(accessor) {
9516
9512
  const subscription = commandService.onCommandExecuted((c) => {
9517
9513
  if (c.id === RichTextEditingMutation.id) {
9518
9514
  var _instance$getSnapshot;
9519
- const instance = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
9515
+ const instance = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
9520
9516
  subscriber.next((instance === null || instance === void 0 || (_instance$getSnapshot = instance.getSnapshot()) === null || _instance$getSnapshot === void 0 ? void 0 : _instance$getSnapshot.documentStyle.documentFlavor) === DocumentFlavor.MODERN);
9521
9517
  }
9522
9518
  });
9523
- const instance = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
9519
+ const instance = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
9524
9520
  subscriber.next((instance === null || instance === void 0 || (_instance$getSnapshot2 = instance.getSnapshot()) === null || _instance$getSnapshot2 === void 0 ? void 0 : _instance$getSnapshot2.documentStyle.documentFlavor) === DocumentFlavor.MODERN);
9525
9521
  return () => subscription.dispose();
9526
9522
  })
@@ -9587,7 +9583,7 @@ function getFontStyleAtCursor(accessor) {
9587
9583
  const univerInstanceService = accessor.get(IUniverInstanceService);
9588
9584
  const textSelectionService = accessor.get(DocSelectionManagerService);
9589
9585
  const docMenuStyleService = accessor.get(DocMenuStyleService);
9590
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
9586
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
9591
9587
  const docRanges = textSelectionService.getDocRanges();
9592
9588
  const activeRange = (_docRanges$find2 = docRanges.find((r) => r.isActive)) !== null && _docRanges$find2 !== void 0 ? _docRanges$find2 : docRanges[0];
9593
9589
  const defaultTextStyle = docMenuStyleService.getDefaultStyle();
@@ -10867,7 +10863,7 @@ const DocParagraphSettingCommand = {
10867
10863
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
10868
10864
  const univerInstanceService = accessor.get(IUniverInstanceService);
10869
10865
  const commandService = accessor.get(ICommandService);
10870
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
10866
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
10871
10867
  const docRanges = docSelectionManagerService.getDocRanges();
10872
10868
  if (!docDataModel || docRanges.length === 0 || !config) return false;
10873
10869
  const segmentId = docRanges[0].segmentId;
@@ -10932,7 +10928,7 @@ const useDocRanges = () => {
10932
10928
  };
10933
10929
  const useCurrentParagraph = () => {
10934
10930
  var _segment$getBody$para, _segment$getBody, _segment$getBody$data, _segment$getBody2, _BuildTextUtils$range;
10935
- const docDataModel = useDependency(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
10931
+ const docDataModel = useDependency(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
10936
10932
  const docRanges = useDocRanges();
10937
10933
  if (!docDataModel || docRanges.length === 0) return [];
10938
10934
  const segmentId = docRanges[0].segmentId;
@@ -11045,7 +11041,7 @@ const useFirstParagraphLineSpacing = (paragraph) => {
11045
11041
  const univerInstanceService = useDependency(IUniverInstanceService);
11046
11042
  const skeleton = useMemo(() => {
11047
11043
  var _renderManagerService;
11048
- const docDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
11044
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
11049
11045
  if (!docDataModel) return;
11050
11046
  return (_renderManagerService = renderManagerService.getRenderById(docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSkeletonManagerService).getSkeleton();
11051
11047
  }, []);
@@ -12482,7 +12478,7 @@ let DocRenderController = class DocRenderController extends RxDisposable {
12482
12478
  });
12483
12479
  scene.attachControl();
12484
12480
  scene.onMouseWheel$.subscribeEvent((evt, state) => {
12485
- const currentDocUnit = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
12481
+ const currentDocUnit = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
12486
12482
  if ((currentDocUnit === null || currentDocUnit === void 0 ? void 0 : currentDocUnit.getUnitId()) !== this._context.unitId) return;
12487
12483
  const e = evt;
12488
12484
  if (e.ctrlKey) {
@@ -12617,7 +12613,7 @@ function getPageSizeInModernMode(page) {
12617
12613
  //#endregion
12618
12614
  //#region package.json
12619
12615
  var name = "@univerjs/docs-ui";
12620
- var version = "0.23.0";
12616
+ var version = "0.24.0";
12621
12617
 
12622
12618
  //#endregion
12623
12619
  //#region src/controllers/doc-auto-format.controller.ts
@@ -13841,7 +13837,7 @@ let DocSelectionRenderController = class DocSelectionRenderController extends Di
13841
13837
  }));
13842
13838
  this.disposeWithMe(document.onPointerDown$.subscribeEvent((evt, state) => {
13843
13839
  if (this._isEditorReadOnly(unitId)) return;
13844
- const docDataModel = this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
13840
+ const docDataModel = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
13845
13841
  if ((docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getUnitId()) !== unitId) this._instanceSrv.setCurrentUnitForType(unitId);
13846
13842
  const skeleton = this._docSkeletonManagerService.getSkeleton();
13847
13843
  const { offsetX, offsetY } = evt;
@@ -14060,7 +14056,7 @@ DocZoomRenderController = __decorate([
14060
14056
  ], DocZoomRenderController);
14061
14057
 
14062
14058
  //#endregion
14063
- //#region src/services/doc-print-interceptor-service.ts
14059
+ //#region src/services/doc-print-interceptor.service.ts
14064
14060
  const PRINTING_COMPONENT_COLLECT = createInterceptorKey("PRINTING_COMPONENT_COLLECT");
14065
14061
  const PRINTING_DOM_COLLECT = createInterceptorKey("PRINTING_DOM_COLLECT");
14066
14062
  var DocPrintInterceptorService = class extends Disposable {
@@ -14262,7 +14258,7 @@ let DocsRenderService = class DocsRenderService extends RxDisposable {
14262
14258
  _createRenderer(doc) {
14263
14259
  var _this$_instanceSrv$ge;
14264
14260
  const unitId = doc.getUnitId();
14265
- const workbookId = (_this$_instanceSrv$ge = this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC)) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getUnitId();
14261
+ const workbookId = (_this$_instanceSrv$ge = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getUnitId();
14266
14262
  this._renderManagerService.created$.subscribe((renderer) => {
14267
14263
  if (renderer.unitId === workbookId) {
14268
14264
  renderer.engine.getCanvas().setId(DOC_MAIN_CANVAS_ID);
@@ -14527,7 +14523,7 @@ let UniverDocsUIPlugin = class UniverDocsUIPlugin extends Plugin {
14527
14523
  const currentService = this._injector.get(IUniverInstanceService);
14528
14524
  const editorService = this._injector.get(IEditorService);
14529
14525
  try {
14530
- const doc = currentService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
14526
+ const doc = currentService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
14531
14527
  if (!doc) return;
14532
14528
  const id = doc.getUnitId();
14533
14529
  if (!editorService.isEditor(id)) currentService.focusUnit(doc.getUnitId());
@@ -69,7 +69,7 @@ export { DocAutoFormatService } from './services/doc-auto-format.service';
69
69
  export { DocEventManagerService } from './services/doc-event-manager.service';
70
70
  export { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
71
71
  export { calcDocRangePositions, DocCanvasPopManagerService } from './services/doc-popup-manager.service';
72
- export { DocPrintInterceptorService, type IDocPrintComponentContext, type IDocPrintContext } from './services/doc-print-interceptor-service';
72
+ export { DocPrintInterceptorService, type IDocPrintComponentContext, type IDocPrintContext } from './services/doc-print-interceptor.service';
73
73
  export { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
74
74
  export { DocsRenderService } from './services/docs-render.service';
75
75
  export { Editor } from './services/editor/editor';
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IDocumentData } from '@univerjs/core';
17
- export declare function genId(): string;
18
17
  export declare function extractId(html: string): string | null;
19
18
  export declare class CopyContentCache {
20
19
  private _cache;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/core/facade`),require(`@univerjs/docs-ui`),require(`@univerjs/engine-render`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs-ui`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsUiFacade={},e.UniverCore,e.UniverCoreFacade,e.UniverDocsUi,e.UniverEngineRender))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class{constructor(e,t,n,r,i,a){this._documentDataModel=e,this._injector=t,this._univerInstanceService=n,this._commandService=r,this._resourceManagerService=i,this._renderManagerService=a,c(this,`id`,void 0),this.id=this._documentDataModel.getUnitId()}getId(){return this._documentDataModel.getUnitId()}getName(){return this.getSnapshot().title||``}getSnapshot(){let e=this._resourceManagerService.getResourcesByType(this.id,t.UniverInstanceType.UNIVER_DOC),n=this._documentDataModel.getSnapshot();return n.resources=e,n}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(t.RedoCommand.id)}appendText(e){let t=this.id,{body:n}=this.getSnapshot();if(!n)throw Error(`The document body is empty`);let i=n.dataStream.length-2,a={startOffset:i,endOffset:i,collapsed:!0,segmentId:``},{segmentId:o}=a;return this._commandService.executeCommand(r.InsertCommand.id,{unitId:t,body:{dataStream:e},range:a,segmentId:o})}setSelection(e,n){var i;let a=(i=this._renderManagerService.getRenderById(this.getId()))==null?void 0:i.with(r.DocSelectionRenderService);a==null||a.removeAllRanges(),a==null||a.addDocRanges([{startOffset:e,endOffset:n,rangeType:t.DOC_RANGE_TYPE.TEXT}],!0)}};d=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.IUniverInstanceService),l(3,t.ICommandService),l(4,t.IResourceManagerService),l(5,i.IRenderManagerService)],d);var f=class extends n.FUniver{createUniverDoc(e){let n=this._univerInstanceService.createUnit(t.UniverInstanceType.UNIVER_DOC,e);return this._injector.createInstance(d,n)}getActiveDocument(){let e=this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_DOC);return e?this._injector.createInstance(d,e):null}getUniverDoc(e){let t=this._univerInstanceService.getUniverDocInstance(e);return t?this._injector.createInstance(d,t):null}};n.FUniver.extend(f),Object.defineProperty(e,`FDocument`,{enumerable:!0,get:function(){return d}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/core/facade`),require(`@univerjs/docs-ui`),require(`@univerjs/engine-render`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs-ui`,`@univerjs/engine-render`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsUiFacade={},e.UniverCore,e.UniverCoreFacade,e.UniverDocsUi,e.UniverEngineRender))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class{constructor(e,t,n,r,i,a){this._documentDataModel=e,this._injector=t,this._univerInstanceService=n,this._commandService=r,this._resourceManagerService=i,this._renderManagerService=a,c(this,`id`,void 0),this.id=this._documentDataModel.getUnitId()}getId(){return this._documentDataModel.getUnitId()}getName(){return this.getSnapshot().title||``}getSnapshot(){let e=this._resourceManagerService.getResourcesByType(this.id,t.UniverInstanceType.UNIVER_DOC),n=this._documentDataModel.getSnapshot();return n.resources=e,n}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(t.RedoCommand.id)}appendText(e){let t=this.id,{body:n}=this.getSnapshot();if(!n)throw Error(`The document body is empty`);let i=n.dataStream.length-2,a={startOffset:i,endOffset:i,collapsed:!0,segmentId:``},{segmentId:o}=a;return this._commandService.executeCommand(r.InsertCommand.id,{unitId:t,body:{dataStream:e},range:a,segmentId:o})}setSelection(e,n){var i;let a=(i=this._renderManagerService.getRenderById(this.getId()))==null?void 0:i.with(r.DocSelectionRenderService);a==null||a.removeAllRanges(),a==null||a.addDocRanges([{startOffset:e,endOffset:n,rangeType:t.DOC_RANGE_TYPE.TEXT}],!0)}};d=u([l(1,(0,t.Inject)(t.Injector)),l(2,t.IUniverInstanceService),l(3,t.ICommandService),l(4,t.IResourceManagerService),l(5,i.IRenderManagerService)],d);var f=class extends n.FUniver{createUniverDoc(e){let n=this._univerInstanceService.createUnit(t.UniverInstanceType.UNIVER_DOC,e);return this._injector.createInstance(d,n)}getActiveDocument(){let e=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC);return e?this._injector.createInstance(d,e):null}getUniverDoc(e){let t=this._univerInstanceService.getUniverDocInstance(e);return t?this._injector.createInstance(d,t):null}};n.FUniver.extend(f),Object.defineProperty(e,`FDocument`,{enumerable:!0,get:function(){return d}})});