@univerjs/sheets-hyper-link-ui 0.4.1 → 0.4.2-nightly.202410301606

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.
Files changed (36) hide show
  1. package/lib/es/facade.js +1 -0
  2. package/lib/es/index.js +104 -560
  3. package/lib/locale/en-US.js +38 -0
  4. package/lib/locale/fa-IR.js +38 -0
  5. package/lib/locale/ru-RU.js +38 -0
  6. package/lib/locale/vi-VN.js +38 -0
  7. package/lib/locale/zh-CN.js +38 -0
  8. package/lib/locale/zh-TW.js +38 -0
  9. package/lib/types/controllers/menu.d.ts +5 -6
  10. package/lib/types/controllers/url.controller.d.ts +3 -1
  11. package/lib/types/facade/f-workbook.d.ts +13 -0
  12. package/lib/types/{types/interfaces/i-sheet-url-params.d.ts → facade/index.d.ts} +0 -6
  13. package/lib/types/index.d.ts +0 -4
  14. package/lib/types/services/resolver.service.d.ts +4 -8
  15. package/lib/umd/facade.js +1 -0
  16. package/lib/umd/index.js +2 -2
  17. package/lib/umd/locale/en-US.js +1 -0
  18. package/lib/umd/locale/fa-IR.js +1 -0
  19. package/lib/umd/locale/ru-RU.js +1 -0
  20. package/lib/umd/locale/vi-VN.js +1 -0
  21. package/lib/umd/locale/zh-CN.js +1 -0
  22. package/lib/umd/locale/zh-TW.js +1 -0
  23. package/package.json +27 -25
  24. package/LICENSE +0 -176
  25. package/lib/cjs/index.js +0 -9
  26. package/lib/locale/en-US.json +0 -35
  27. package/lib/locale/fa-IR.json +0 -35
  28. package/lib/locale/ru-RU.json +0 -35
  29. package/lib/locale/vi-VN.json +0 -35
  30. package/lib/locale/zh-CN.json +0 -35
  31. package/lib/locale/zh-TW.json +0 -35
  32. package/lib/types/commands/commands/add-hyper-link.command.d.ts +0 -19
  33. package/lib/types/commands/commands/remove-hyper-link.command.d.ts +0 -19
  34. package/lib/types/commands/commands/update-hyper-link.command.d.ts +0 -17
  35. package/lib/types/types/interfaces/i-sheet-hyper-link-info.d.ts +0 -10
  36. package/lib/types/types/interfaces/index.d.ts +0 -17
package/lib/es/index.js CHANGED
@@ -2,18 +2,18 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { Tools, Inject, LocaleService, UniverInstanceType, isValidRange, IUniverInstanceService, ICommandService, IConfigService, RANGE_TYPE, Rectangle, Injector, Disposable, Range, ObjectMatrix, CommandType, IUndoRedoService, BuildTextUtils, DataStreamTreeTokenType, CustomRangeType, TextX, CellValueType, sequenceExecuteAsync, generateRandomId, getBodySlice, useDependency, IContextService, ThemeService, ColorKit, DisposableCollection, FOCUSING_SHEET, DOCS_ZEN_EDITOR_UNIT_ID_KEY, sequenceExecute, useObservable as useObservable$1, DataValidationType, IPermissionService, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, InterceptorEffectEnum, DependentOn, Plugin } from "@univerjs/core";
6
- import { SheetHyperLinkType, ERROR_RANGE, HyperLinkModel, RemoveHyperLinkMutation, AddHyperLinkMutation, UniverSheetsHyperLinkPlugin } from "@univerjs/sheets-hyper-link";
7
- import { ScrollToRangeOperation, COPY_TYPE, virtualizeDiscreteRanges, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, IEditorBridgeService, SheetSkeletonManagerService, IMarkSelectionService, SheetCanvasPopManagerService, getEditingCustomRangePosition, getCustomRangePosition, whenSheetEditorFocused, getCurrentRangeDisable$, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, SheetPermissionInterceptorBaseController, HoverManagerService, HoverRenderController } from "@univerjs/sheets-ui";
5
+ import { Tools, Inject, LocaleService, UniverInstanceType, isValidRange, IUniverInstanceService, ICommandService, IConfigService, RANGE_TYPE, Rectangle, Injector, Disposable, Range, ObjectMatrix, useDependency, IContextService, ThemeService, CustomRangeType, BuildTextUtils, ColorKit, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DisposableCollection, FOCUSING_SHEET, generateRandomId, useObservable as useObservable$1, DataValidationType, CommandType, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IPermissionService, InterceptorEffectEnum, DataStreamTreeTokenType, TextX, DependentOn, Plugin } from "@univerjs/core";
6
+ import { SheetHyperLinkType, ERROR_RANGE, HyperLinkModel, RemoveHyperLinkMutation, AddHyperLinkMutation, SheetsHyperLinkParserService, UpdateRichHyperLinkCommand, UpdateHyperLinkCommand, AddRichHyperLinkCommand, AddHyperLinkCommand, CancelRichHyperLinkCommand, CancelHyperLinkCommand, UniverSheetsHyperLinkPlugin } from "@univerjs/sheets-hyper-link";
7
+ import { ScrollToRangeOperation, COPY_TYPE, virtualizeDiscreteRanges, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, IEditorBridgeService, IMarkSelectionService, SheetCanvasPopManagerService, getEditingCustomRangePosition, getCustomRangePosition, whenSheetEditorFocused, getCurrentRangeDisable$, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, SheetPermissionInterceptorBaseController, HoverManagerService, HoverRenderController, SheetSkeletonManagerService } from "@univerjs/sheets-ui";
8
8
  import { MessageType, FormLayout, Input, Select, Button, Tooltip } from "@univerjs/design";
9
- import { deserializeRangeWithSheet, serializeRangeWithSheet, serializeRange, IDefinedNamesService, serializeRangeToRefString } from "@univerjs/engine-formula";
10
- import { SetSelectionsOperation, SetWorksheetActiveOperation, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookCopyPermission, WorksheetCopyPermission, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, SheetInterceptorService, RemoveSheetCommand, INTERCEPTOR_POINT, RefRangeService, handleDefaultRangeChangeWithEffectRefCommands, SetRangeValuesCommand } from "@univerjs/sheets";
9
+ import { deserializeRangeWithSheet, IDefinedNamesService, serializeRangeWithSheet, serializeRangeToRefString, serializeRange } from "@univerjs/engine-formula";
10
+ import { SetSelectionsOperation, SetWorksheetActiveOperation, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookCopyPermission, WorksheetCopyPermission, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, SheetInterceptorService, RemoveSheetCommand, INTERCEPTOR_POINT, RefRangeService, SetRangeValuesMutation, SetRangeValuesCommand, AFTER_CELL_EDIT } from "@univerjs/sheets";
11
11
  import { IMessageService, useObservable, IZenZoneService, useEvent, KeyCode, MenuItemType, MenuPosition, MenuGroup, MetaKeys, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IShortcutService, IMenuManagerService } from "@univerjs/ui";
12
+ import { DocSelectionRenderService, DocBackScrollRenderController, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
13
+ import { IRenderManagerService } from "@univerjs/engine-render";
14
+ import { Subject, BehaviorSubject, of, map, filter, switchMap, distinctUntilChanged, debounceTime, Observable } from "rxjs";
12
15
  import { DocSelectionManagerService } from "@univerjs/docs";
13
- import { Subject, BehaviorSubject, map, mergeMap, Observable, debounceTime } from "rxjs";
14
- import { addCustomRangeBySelectionFactory, replaceSelectionFactory, DocSelectionRenderService, DocBackScrollRenderController, deleteCustomRangeFactory, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
15
16
  import require$$0, { useState, useMemo, useRef, useEffect, forwardRef, createElement } from "react";
16
- import { IRenderManagerService } from "@univerjs/engine-render";
17
17
  import { RangeSelector } from "@univerjs/sheets-formula-ui";
18
18
  function isLegalLink(link) {
19
19
  return Tools.isLegalUrl(link);
@@ -62,40 +62,16 @@ let SheetsHyperLinkResolverService = (_a = class {
62
62
  constructor(_univerInstanceService, _commandService, _definedNamesService, _messageService, _localeService, _configService) {
63
63
  this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._definedNamesService = _definedNamesService, this._messageService = _messageService, this._localeService = _localeService, this._configService = _configService;
64
64
  }
65
- _getURLName(params) {
66
- var _a15;
67
- const { gid, range, rangeid, unitid } = params, workbook = unitid ? this._univerInstanceService.getUnit(unitid, UniverInstanceType.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), invalidLink = {
68
- type: SheetHyperLinkType.INVALID,
69
- name: this._localeService.t("hyperLink.message.refError")
70
- };
71
- if (!workbook)
72
- return invalidLink;
73
- const sheet = gid ? workbook.getSheetBySheetId(gid) : workbook.getActiveSheet(), sheetName = (_a15 = sheet == null ? void 0 : sheet.getName()) != null ? _a15 : "";
74
- if (range) {
75
- if (!sheet) return invalidLink;
76
- const rangeObj = deserializeRangeWithSheet(range).range;
77
- return isValidRange(rangeObj, sheet) && range !== ERROR_RANGE ? {
78
- type: SheetHyperLinkType.RANGE,
79
- name: serializeRangeWithSheet(sheetName, rangeObj)
80
- } : invalidLink;
65
+ navigate(info) {
66
+ switch (info.type) {
67
+ case SheetHyperLinkType.URL:
68
+ this.navigateToOtherWebsite(info.url);
69
+ break;
70
+ default:
71
+ this._navigateToUniver(info.searchObj);
81
72
  }
82
- if (rangeid) {
83
- const range2 = this._definedNamesService.getValueById(workbook.getUnitId(), rangeid);
84
- return range2 ? {
85
- type: SheetHyperLinkType.DEFINE_NAME,
86
- name: range2.formulaOrRefString
87
- } : invalidLink;
88
- }
89
- if (gid) {
90
- const worksheet = workbook.getSheetBySheetId(gid);
91
- return worksheet ? {
92
- type: SheetHyperLinkType.SHEET,
93
- name: worksheet.getName()
94
- } : invalidLink;
95
- }
96
- return invalidLink;
97
73
  }
98
- navigateTo(params) {
74
+ _navigateToUniver(params) {
99
75
  const { gid, range, rangeid } = params, workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
100
76
  if (!workbook)
101
77
  return;
@@ -130,38 +106,6 @@ let SheetsHyperLinkResolverService = (_a = class {
130
106
  this.navigateToSheetById(unitId, gid);
131
107
  }
132
108
  }
133
- buildHyperLink(unitId, sheetId, range) {
134
- return `#${SheetHyperLinkType.SHEET}=${sheetId}${range ? `&${typeof range == "string" ? SheetHyperLinkType.DEFINE_NAME : SheetHyperLinkType.RANGE}=${typeof range == "string" ? range : serializeRange(range)}` : ""}`;
135
- }
136
- parseHyperLink(urlStr) {
137
- var _a15, _b, _c, _d;
138
- if (urlStr.startsWith("#")) {
139
- const search = new URLSearchParams(urlStr.slice(1)), searchObj = {
140
- gid: (_a15 = search.get("gid")) != null ? _a15 : "",
141
- range: (_b = search.get("range")) != null ? _b : "",
142
- rangeid: (_c = search.get("rangeid")) != null ? _c : "",
143
- unitid: (_d = search.get("unitid")) != null ? _d : ""
144
- }, urlInfo = this._getURLName(searchObj);
145
- return {
146
- type: urlInfo.type,
147
- name: urlInfo.name,
148
- url: urlStr,
149
- searchObj,
150
- handler: /* @__PURE__ */ __name(() => {
151
- this.navigateTo(searchObj);
152
- }, "handler")
153
- };
154
- } else
155
- return {
156
- type: SheetHyperLinkType.URL,
157
- name: urlStr,
158
- url: urlStr,
159
- handler: /* @__PURE__ */ __name(() => {
160
- this.navigateToOtherWebsite(urlStr);
161
- }, "handler"),
162
- searchObj: null
163
- };
164
- }
165
109
  async navigateToRange(unitId, subUnitId, range) {
166
110
  const worksheet = await this.navigateToSheetById(unitId, subUnitId);
167
111
  if (worksheet) {
@@ -180,27 +124,6 @@ let SheetsHyperLinkResolverService = (_a = class {
180
124
  });
181
125
  }
182
126
  }
183
- async navigateToSheet(unitId, sheetName) {
184
- const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
185
- if (!workbook)
186
- return !1;
187
- const worksheet = workbook.getActiveSheet();
188
- if ((worksheet == null ? void 0 : worksheet.getName()) === sheetName)
189
- return !0;
190
- const targetSheet = workbook.getSheetBySheetName(sheetName);
191
- if (!targetSheet) {
192
- this._messageService.show({
193
- content: this._localeService.t("hyperLink.message.noSheet"),
194
- type: MessageType.Error
195
- });
196
- return;
197
- }
198
- const sheetId = targetSheet.getSheetId();
199
- return workbook.getHiddenWorksheets().indexOf(sheetId) > -1 && this._messageService.show({
200
- content: this._localeService.t("hyperLink.message.hiddenSheet"),
201
- type: MessageType.Error
202
- }), await this._commandService.executeCommand(SetWorksheetActiveOperation.id, { unitId, subUnitId: sheetId });
203
- }
204
127
  async navigateToSheetById(unitId, subUnitId) {
205
128
  const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
206
129
  if (!workbook)
@@ -219,8 +142,8 @@ let SheetsHyperLinkResolverService = (_a = class {
219
142
  type: MessageType.Error
220
143
  }), !1);
221
144
  }
222
- async navigateToDefineName(unitId, rangeid) {
223
- return this._definedNamesService.focusRange(unitId, rangeid), !0;
145
+ async navigateToDefineName(unitId, rangeId) {
146
+ return this._definedNamesService.focusRange(unitId, rangeId), !0;
224
147
  }
225
148
  async navigateToOtherWebsite(url) {
226
149
  var _a15;
@@ -253,15 +176,15 @@ let SheetsHyperLinkCopyPasteController = (_a2 = class extends Disposable {
253
176
  this._plainTextFilter.clear();
254
177
  });
255
178
  }
256
- registerPlainTextFilter(filter) {
257
- this._plainTextFilter.add(filter);
179
+ registerPlainTextFilter(filter2) {
180
+ this._plainTextFilter.add(filter2);
258
181
  }
259
- removePlainTextFilter(filter) {
260
- this._plainTextFilter.delete(filter);
182
+ removePlainTextFilter(filter2) {
183
+ this._plainTextFilter.delete(filter2);
261
184
  }
262
185
  /* If return false the process of paste text will be stop */
263
186
  _filterPlainText(text) {
264
- return Array.from(this._plainTextFilter).every((filter) => filter(text));
187
+ return Array.from(this._plainTextFilter).every((filter2) => filter2(text));
265
188
  }
266
189
  _initCopyPaste() {
267
190
  this._sheetClipboardService.addClipboardHook({
@@ -414,246 +337,7 @@ reactJsxRuntime_production_min.jsx = q;
414
337
  reactJsxRuntime_production_min.jsxs = q;
415
338
  jsxRuntime.exports = reactJsxRuntime_production_min;
416
339
  var jsxRuntimeExports = jsxRuntime.exports;
417
- const AddHyperLinkCommand = {
418
- type: CommandType.COMMAND,
419
- id: "sheets.command.add-hyper-link",
420
- // eslint-disable-next-line max-lines-per-function
421
- async handler(accessor, params) {
422
- var _a15;
423
- if (!params)
424
- return !1;
425
- const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), renderManagerService = accessor.get(IRenderManagerService), univerInstanceService = accessor.get(IUniverInstanceService), hyperLinkModel = accessor.get(HyperLinkModel), editorBridgeService = accessor.get(IEditorBridgeService), { unitId, subUnitId, link } = params, workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), currentRender = renderManagerService.getRenderById(unitId);
426
- if (!currentRender || !workbook)
427
- return !1;
428
- const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
429
- if (!worksheet || !skeleton)
430
- return !1;
431
- const { payload, display, row, column, id } = link, cellData = worksheet.getCell(row, column), doc = skeleton.getBlankCellDocumentModel(cellData), snapshot = doc.documentModel.getSnapshot(), body = Tools.deepClone(snapshot.body);
432
- if (!body)
433
- return !1;
434
- let textX;
435
- if (display ? textX = BuildTextUtils.selection.replace({
436
- selection: {
437
- startOffset: 0,
438
- endOffset: body.dataStream.length - 2,
439
- collapsed: !0
440
- },
441
- body: {
442
- dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
443
- customRanges: [{
444
- startIndex: 0,
445
- endIndex: display.length + 1,
446
- rangeType: CustomRangeType.HYPERLINK,
447
- rangeId: id,
448
- properties: {
449
- url: payload
450
- // refId: id,
451
- }
452
- }]
453
- },
454
- doc: doc.documentModel
455
- }) : textX = BuildTextUtils.customRange.add({
456
- body,
457
- range: { startOffset: 0, endOffset: body.dataStream.length - 2, collapsed: !1 },
458
- rangeId: id,
459
- rangeType: CustomRangeType.HYPERLINK,
460
- properties: {
461
- url: payload,
462
- refId: id
463
- }
464
- }), !textX)
465
- return !1;
466
- const newBody = TextX.apply(body, textX.serialize()), newCellData = {
467
- p: {
468
- ...snapshot,
469
- body: newBody
470
- },
471
- t: CellValueType.STRING
472
- }, finalCellData = await editorBridgeService.beforeSetRangeValue(workbook, worksheet, row, column, newCellData), redoParams = {
473
- unitId,
474
- subUnitId,
475
- cellValue: {
476
- [link.row]: {
477
- [link.column]: finalCellData
478
- }
479
- }
480
- }, redo = {
481
- id: SetRangeValuesMutation.id,
482
- params: redoParams
483
- }, undoParams = SetRangeValuesUndoMutationFactory(accessor, redoParams), undo = {
484
- id: SetRangeValuesMutation.id,
485
- params: undoParams
486
- }, redos = [redo], undos = [undo], modelLink = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
487
- return modelLink && (redos.push({
488
- id: RemoveHyperLinkMutation.id,
489
- params: {
490
- unitId,
491
- subUnitId,
492
- id: modelLink.id
493
- }
494
- }), undos.push({
495
- id: AddHyperLinkMutation.id,
496
- params: {
497
- unitId,
498
- subUnitId,
499
- link: modelLink
500
- }
501
- })), await sequenceExecuteAsync(redos, commandService) ? (undoRedoService.pushUndoRedo({
502
- redoMutations: redos,
503
- undoMutations: undos,
504
- unitID: unitId
505
- }), !0) : !1;
506
- }
507
- }, AddRichHyperLinkCommand = {
508
- id: "sheets.command.add-rich-hyper-link",
509
- type: CommandType.COMMAND,
510
- handler: /* @__PURE__ */ __name(async (accessor, params) => {
511
- if (!params)
512
- return !1;
513
- const { documentId, link } = params, commandService = accessor.get(ICommandService), textSelectionService = accessor.get(DocSelectionManagerService), newId = generateRandomId(), { payload } = link;
514
- if (!textSelectionService.getActiveTextRange())
515
- return !1;
516
- const replaceSelection = addCustomRangeBySelectionFactory(accessor, {
517
- unitId: documentId,
518
- rangeId: newId,
519
- rangeType: CustomRangeType.HYPERLINK,
520
- properties: {
521
- url: payload,
522
- refId: newId
523
- }
524
- });
525
- return replaceSelection ? commandService.syncExecuteCommand(replaceSelection.id, replaceSelection.params) : !1;
526
- }, "handler")
527
- }, UpdateHyperLinkCommand = {
528
- type: CommandType.COMMAND,
529
- id: "sheets.command.update-hyper-link",
530
- // eslint-disable-next-line max-lines-per-function, complexity
531
- async handler(accessor, params) {
532
- var _a15, _b, _c, _d;
533
- if (!params)
534
- return !1;
535
- const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), renderManagerService = accessor.get(IRenderManagerService), univerInstanceService = accessor.get(IUniverInstanceService), hyperLinkModel = accessor.get(HyperLinkModel), editorBridgeService = accessor.get(IEditorBridgeService), { unitId, subUnitId, payload: link, row, column, id } = params, workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), currentRender = renderManagerService.getRenderById(unitId);
536
- if (!currentRender || !workbook)
537
- return !1;
538
- const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
539
- if (!worksheet || !skeleton)
540
- return !1;
541
- const { payload, display = "" } = link, cellData = worksheet.getCell(row, column);
542
- if (!cellData)
543
- return !1;
544
- const doc = skeleton.getCellDocumentModelWithFormula(cellData);
545
- if (!(doc != null && doc.documentModel))
546
- return !1;
547
- const snapshot = doc.documentModel.getSnapshot(), range = (_c = (_b = snapshot.body) == null ? void 0 : _b.customRanges) == null ? void 0 : _c.find((range2) => range2.rangeId === id);
548
- if (!range)
549
- return !1;
550
- const newId = generateRandomId(), textRun = (_d = getBodySlice(doc.documentModel.getBody(), range.startIndex, range.endIndex + 1).textRuns) == null ? void 0 : _d[0];
551
- textRun && (textRun.ed = display.length + 1);
552
- const replaceSelection = replaceSelectionFactory(accessor, {
553
- unitId,
554
- body: {
555
- dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
556
- customRanges: [{
557
- rangeId: newId,
558
- rangeType: CustomRangeType.HYPERLINK,
559
- startIndex: 0,
560
- endIndex: display.length + 1,
561
- properties: {
562
- url: payload
563
- }
564
- }],
565
- textRuns: textRun ? [textRun] : void 0
566
- },
567
- selection: {
568
- startOffset: range.startIndex,
569
- endOffset: range.endIndex + 1,
570
- collapsed: !1
571
- },
572
- doc: doc.documentModel
573
- });
574
- if (!replaceSelection)
575
- return !1;
576
- const newBody = TextX.apply(Tools.deepClone(snapshot.body), replaceSelection.textX.serialize()), newCellData = {
577
- p: {
578
- ...snapshot,
579
- body: newBody
580
- },
581
- t: CellValueType.STRING
582
- }, finalCellData = await editorBridgeService.beforeSetRangeValue(workbook, worksheet, row, column, newCellData), redo = {
583
- id: SetRangeValuesMutation.id,
584
- params: {
585
- unitId,
586
- subUnitId,
587
- cellValue: {
588
- [row]: {
589
- [column]: finalCellData
590
- }
591
- }
592
- }
593
- }, undoParams = SetRangeValuesUndoMutationFactory(accessor, redo.params), undo = {
594
- id: SetRangeValuesMutation.id,
595
- params: undoParams
596
- }, redos = [redo], undos = [undo], modelLink = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
597
- return modelLink && (redos.push({
598
- id: RemoveHyperLinkMutation.id,
599
- params: {
600
- unitId,
601
- subUnitId,
602
- id: modelLink.id
603
- }
604
- }), undos.push({
605
- id: AddHyperLinkMutation.id,
606
- params: {
607
- unitId,
608
- subUnitId,
609
- link: modelLink
610
- }
611
- })), await sequenceExecuteAsync(redos, commandService) ? (undoRedoService.pushUndoRedo({
612
- redoMutations: redos,
613
- undoMutations: undos,
614
- unitID: unitId
615
- }), !0) : !1;
616
- }
617
- }, UpdateRichHyperLinkCommand = {
618
- type: CommandType.COMMAND,
619
- id: "sheets.command.update-rich-hyper-link",
620
- handler: /* @__PURE__ */ __name((accessor, params) => {
621
- var _a15, _b, _c, _d;
622
- if (!params)
623
- return !1;
624
- const { documentId: unitId, payload, id: rangeId } = params, univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), doc = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
625
- if (!doc)
626
- return !1;
627
- const range = (_b = (_a15 = doc.getBody()) == null ? void 0 : _a15.customRanges) == null ? void 0 : _b.find((range2) => range2.rangeId === rangeId);
628
- if (!range)
629
- return !1;
630
- const display = (_c = params.payload.display) != null ? _c : "", newId = generateRandomId(), textRun = (_d = getBodySlice(doc.getBody(), range.startIndex, range.endIndex + 1).textRuns) == null ? void 0 : _d[0];
631
- textRun && (textRun.ed = display.length + 1);
632
- const replaceSelection = replaceSelectionFactory(accessor, {
633
- unitId,
634
- body: {
635
- dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
636
- customRanges: [{
637
- rangeId: newId,
638
- rangeType: CustomRangeType.HYPERLINK,
639
- startIndex: 0,
640
- endIndex: display.length + 1,
641
- properties: {
642
- url: payload.payload
643
- }
644
- }],
645
- textRuns: textRun ? [textRun] : void 0
646
- },
647
- selection: {
648
- startOffset: range.startIndex,
649
- endOffset: range.endIndex + 1,
650
- collapsed: !1
651
- },
652
- doc
653
- });
654
- return replaceSelection ? commandService.syncExecuteCommand(replaceSelection.id, replaceSelection.params) : !1;
655
- }, "handler")
656
- }, _SheetsHyperLinkSidePanelService = class _SheetsHyperLinkSidePanelService extends Disposable {
340
+ const _SheetsHyperLinkSidePanelService = class _SheetsHyperLinkSidePanelService extends Disposable {
657
341
  constructor() {
658
342
  super(...arguments);
659
343
  __publicField(this, "_customHyperLinks", /* @__PURE__ */ new Map());
@@ -688,14 +372,12 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
688
372
  cellLinkEditButtons
689
373
  }, CellLinkEdit = /* @__PURE__ */ __name(() => {
690
374
  var _a15;
691
- const [id, setId] = useState(""), [hide, setHide] = useState(!1), [display, setDisplay] = useState(""), [showLabel, setShowLabel] = useState(!0), [type, setType] = useState(SheetHyperLinkType.URL), [payload, setPayload] = useState(""), localeService = useDependency(LocaleService), definedNameService = useDependency(IDefinedNamesService), editorBridgeService = useDependency(IEditorBridgeService), univerInstanceService = useDependency(IUniverInstanceService), popupService = useDependency(SheetsHyperLinkPopupService), editing = useObservable(popupService.currentEditing$), resolverService = useDependency(SheetsHyperLinkResolverService), commandService = useDependency(ICommandService), sidePanelService = useDependency(SheetsHyperLinkSidePanelService), sidePanelOptions = useMemo(() => sidePanelService.getOptions(), [sidePanelService]), zenZoneService = useDependency(IZenZoneService), renderManagerService = useDependency(IRenderManagerService), markSelectionService = useDependency(IMarkSelectionService), textSelectionService = useDependency(DocSelectionManagerService), contextService = useDependency(IContextService), themeService = useDependency(ThemeService), docSelectionManagerService = useDependency(DocSelectionManagerService), rangeSelectorActionsRef = useRef({}), customHyperLinkSidePanel = useMemo(() => {
375
+ const [id, setId] = useState(""), [hide, setHide] = useState(!1), [display, setDisplay] = useState(""), [showLabel, setShowLabel] = useState(!0), [type, setType] = useState(SheetHyperLinkType.URL), [payload, setPayload] = useState(""), localeService = useDependency(LocaleService), definedNameService = useDependency(IDefinedNamesService), editorBridgeService = useDependency(IEditorBridgeService), univerInstanceService = useDependency(IUniverInstanceService), popupService = useDependency(SheetsHyperLinkPopupService), editing = useObservable(popupService.currentEditing$), parserService = useDependency(SheetsHyperLinkParserService), resolverService = useDependency(SheetsHyperLinkResolverService), commandService = useDependency(ICommandService), sidePanelService = useDependency(SheetsHyperLinkSidePanelService), sidePanelOptions = useMemo(() => sidePanelService.getOptions(), [sidePanelService]), zenZoneService = useDependency(IZenZoneService), renderManagerService = useDependency(IRenderManagerService), markSelectionService = useDependency(IMarkSelectionService), textSelectionService = useDependency(DocSelectionManagerService), contextService = useDependency(IContextService), themeService = useDependency(ThemeService), docSelectionManagerService = useDependency(DocSelectionManagerService), rangeSelectorActionsRef = useRef({}), customHyperLinkSidePanel = useMemo(() => {
692
376
  if (!sidePanelService.isBuiltInLinkType(type))
693
377
  return sidePanelService.getCustomHyperLink(type);
694
378
  }, [sidePanelService, type]), [showError, setShowError] = useState(!1), [isFocusRangeSelector, isFocusRangeSelectorSet] = useState(!1), setByPayload = useRef(!1), workbook = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), subUnitId = (workbook == null ? void 0 : workbook.getActiveSheet().getSheetId()) || "";
695
379
  useEffect(() => {
696
- isFocusRangeSelectorSet(!1);
697
- }, [subUnitId]), useEffect(() => {
698
- var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
380
+ var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
699
381
  if ((editing == null ? void 0 : editing.row) !== void 0 && editing.col !== void 0) {
700
382
  const { label, customRange, row, col } = editing;
701
383
  let link;
@@ -720,11 +402,11 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
720
402
  column: col
721
403
  };
722
404
  } else {
723
- const doc = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC), selection = textSelectionService.getActiveTextRange(), customRange2 = selection && ((_m = BuildTextUtils.customRange.getCustomRangesInterestsWithRange(selection, (_l = (_k = doc == null ? void 0 : doc.getBody()) == null ? void 0 : _k.customRanges) != null ? _l : [])) == null ? void 0 : _m[0]);
405
+ const doc = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC), currentSelection = textSelectionService.getActiveTextRange(), body = doc == null ? void 0 : doc.getBody(), selection = currentSelection && body ? BuildTextUtils.selection.getInsertSelection(currentSelection, body) : null, customRange2 = selection && ((_l = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (_k = body == null ? void 0 : body.customRanges) != null ? _k : [])) == null ? void 0 : _l[0]);
724
406
  setShowLabel(!1), link = {
725
407
  id: "",
726
408
  display: label != null ? label : "",
727
- payload: (_o = (_n = customRange2 == null ? void 0 : customRange2.properties) == null ? void 0 : _n.url) != null ? _o : "",
409
+ payload: (_n = (_m = customRange2 == null ? void 0 : customRange2.properties) == null ? void 0 : _m.url) != null ? _n : "",
728
410
  row,
729
411
  column: col
730
412
  };
@@ -737,14 +419,14 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
737
419
  return;
738
420
  }
739
421
  setDisplay(link.display);
740
- const linkInfo = resolverService.parseHyperLink(link.payload);
422
+ const linkInfo = parserService.parseHyperLink(link.payload);
741
423
  switch (setType(linkInfo.type === SheetHyperLinkType.INVALID ? SheetHyperLinkType.RANGE : linkInfo.type), linkInfo.type) {
742
424
  case SheetHyperLinkType.URL: {
743
425
  setPayload(linkInfo.url), linkInfo.url === link.display && (setByPayload.current = !0);
744
426
  break;
745
427
  }
746
428
  case SheetHyperLinkType.RANGE: {
747
- const params = linkInfo.searchObj, sheetName = params.gid && (_r = (_q = (_p = univerInstanceService.getUnit(editing.unitId)) == null ? void 0 : _p.getSheetBySheetId(params.gid)) == null ? void 0 : _q.getName()) != null ? _r : "", payload2 = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
429
+ const params = linkInfo.searchObj, sheetName = params.gid && (_q = (_p = (_o = univerInstanceService.getUnit(editing.unitId)) == null ? void 0 : _o.getSheetBySheetId(params.gid)) == null ? void 0 : _p.getName()) != null ? _q : "", payload2 = serializeRangeWithSheet(sheetName, deserializeRangeWithSheet(params.range).range);
748
430
  setPayload(payload2), payload2 === link.display && (setByPayload.current = !0);
749
431
  break;
750
432
  }
@@ -791,10 +473,10 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
791
473
  return () => {
792
474
  id2 && markSelectionService.removeShape(id2);
793
475
  };
794
- }, [editing, markSelectionService, themeService, univerInstanceService]);
795
- const payloadInitial = useMemo(() => payload, [type]);
796
- useEffect(() => {
797
- const render2 = renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId()), disposeCollection = new DisposableCollection();
476
+ }, [editing, markSelectionService, themeService, univerInstanceService]), useEffect(() => {
477
+ isFocusRangeSelectorSet(type === SheetHyperLinkType.RANGE);
478
+ }, [type]), useEffect(() => {
479
+ const render2 = (editing == null ? void 0 : editing.type) === HyperLinkEditSourceType.ZEN_EDITOR ? renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY) : renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId()), disposeCollection = new DisposableCollection();
798
480
  if (render2) {
799
481
  const selectionRenderService = render2.with(DocSelectionRenderService);
800
482
  selectionRenderService.setReserveRangesStatus(!0), disposeCollection.add(() => {
@@ -804,9 +486,9 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
804
486
  return () => {
805
487
  editorBridgeService.disableForceKeepVisible(), disposeCollection.dispose();
806
488
  };
807
- }, [editorBridgeService, renderManagerService]), useEffect(() => (popupService.setIsKeepVisible(type === SheetHyperLinkType.RANGE), () => {
489
+ }, [editing == null ? void 0 : editing.type, editorBridgeService, renderManagerService]), useEffect(() => (popupService.setIsKeepVisible(isFocusRangeSelector), () => {
808
490
  popupService.setIsKeepVisible(!1);
809
- }), [type]), useEffect(() => () => {
491
+ }), [isFocusRangeSelector, popupService]), useEffect(() => () => {
810
492
  zenZoneService.temporaryHidden && (zenZoneService.show(), contextService.setContextValue(FOCUSING_SHEET, !1));
811
493
  }, [contextService, zenZoneService]);
812
494
  const linkTypeOptions = [
@@ -906,7 +588,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
906
588
  if (type !== SheetHyperLinkType.RANGE)
907
589
  return;
908
590
  const handleOutClick = (_a16 = rangeSelectorActionsRef.current) == null ? void 0 : _a16.handleOutClick;
909
- handleOutClick && handleOutClick(e, isFocusRangeSelectorSet);
591
+ handleOutClick && handleOutClick(e, () => isFocusRangeSelectorSet(!1));
910
592
  }, "handlePanelClick");
911
593
  return editing ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.cellLinkEdit, style: { display: hide ? "none" : "block" }, onClick: handlePanelClick, children: [
912
594
  showLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -930,7 +612,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
930
612
  )
931
613
  }
932
614
  ) : null,
933
- /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("hyperLink.form.type"), contentStyle: { marginBottom: 0 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
615
+ /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("hyperLink.form.type"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
934
616
  Select,
935
617
  {
936
618
  options: linkTypeOptions,
@@ -952,7 +634,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
952
634
  setPayload(newLink), newLink && (setByPayload.current || !display || display === payload) && (setDisplay(newLink), setByPayload.current = !0);
953
635
  }, "onChange"),
954
636
  placeholder: localeService.t("hyperLink.form.linkPlaceholder"),
955
- autoFocus: !showLabel,
637
+ autoFocus: !0,
956
638
  onKeyDown: /* @__PURE__ */ __name((e) => {
957
639
  e.keyCode === KeyCode.ENTER && handleSubmit();
958
640
  }, "onKeyDown")
@@ -967,12 +649,10 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
967
649
  subUnitId,
968
650
  isOnlyOneRange: !0,
969
651
  isSupportAcrossSheet: !0,
970
- initValue: payloadInitial,
652
+ initValue: payload,
971
653
  onChange: handleRangeChange,
972
654
  isFocus: isFocusRangeSelector,
973
- onBlur: /* @__PURE__ */ __name(() => {
974
- isFocusRangeSelectorSet(!1);
975
- }, "onBlur"),
655
+ onFocus: /* @__PURE__ */ __name(() => isFocusRangeSelectorSet(!0), "onFocus"),
976
656
  actions: rangeSelectorActionsRef.current,
977
657
  onRangeSelectorDialogVisibleChange: /* @__PURE__ */ __name(async (visible) => {
978
658
  var _a16, _b;
@@ -986,9 +666,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
986
666
  selections: [{ range: { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col } }]
987
667
  }), zenZoneService.show(), contextService.setContextValue(FOCUSING_SHEET, !1);
988
668
  const docBackScrollRenderController = (_a16 = renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY)) == null ? void 0 : _a16.with(DocBackScrollRenderController), range = (_b = docSelectionManagerService.getTextRanges({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY })) == null ? void 0 : _b[0];
989
- docBackScrollRenderController && range && setTimeout(() => {
990
- docBackScrollRenderController.scrollToRange(range), docSelectionManagerService.refreshSelection({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY });
991
- }, 100);
669
+ docBackScrollRenderController && range && (docBackScrollRenderController.scrollToRange(range), docSelectionManagerService.refreshSelection({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY }));
992
670
  }
993
671
  editorBridgeService.disableForceKeepVisible(), setHide(!1);
994
672
  }
@@ -1170,95 +848,7 @@ function clsx() {
1170
848
  return n2;
1171
849
  }
1172
850
  __name(clsx, "clsx");
1173
- const CancelHyperLinkCommand = {
1174
- type: CommandType.COMMAND,
1175
- id: "sheets.command.cancel-hyper-link",
1176
- // eslint-disable-next-line max-lines-per-function
1177
- handler(accessor, params) {
1178
- var _a15, _b, _c;
1179
- if (!params)
1180
- return !1;
1181
- const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), renderManagerService = accessor.get(IRenderManagerService), univerInstanceService = accessor.get(IUniverInstanceService), hyperLinkModel = accessor.get(HyperLinkModel), { unitId, subUnitId, row, column, id } = params, workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), currentRender = renderManagerService.getRenderById(unitId);
1182
- if (!currentRender || !workbook)
1183
- return !1;
1184
- const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
1185
- if (!worksheet || !skeleton)
1186
- return !1;
1187
- const cellData = worksheet.getCell(row, column);
1188
- if (!cellData)
1189
- return !1;
1190
- const doc = skeleton.getCellDocumentModelWithFormula(cellData);
1191
- if (!(doc != null && doc.documentModel))
1192
- return !1;
1193
- const snapshot = Tools.deepClone(doc.documentModel.getSnapshot());
1194
- if (!((_c = (_b = snapshot.body) == null ? void 0 : _b.customRanges) == null ? void 0 : _c.find((range2) => range2.rangeId === id)))
1195
- return !1;
1196
- const textX = BuildTextUtils.customRange.delete(accessor, { documentDataModel: doc.documentModel, rangeId: id });
1197
- if (!textX)
1198
- return !1;
1199
- const newBody = TextX.apply(snapshot.body, textX.serialize()), redos = [], undos = [], setRangeParams = {
1200
- unitId,
1201
- subUnitId,
1202
- cellValue: {
1203
- [row]: {
1204
- [column]: {
1205
- p: {
1206
- ...snapshot,
1207
- body: newBody
1208
- },
1209
- t: CellValueType.STRING
1210
- }
1211
- }
1212
- }
1213
- };
1214
- redos.push({
1215
- id: SetRangeValuesMutation.id,
1216
- params: setRangeParams
1217
- });
1218
- const undoParams = SetRangeValuesUndoMutationFactory(accessor, setRangeParams);
1219
- undos.push({
1220
- id: SetRangeValuesMutation.id,
1221
- params: undoParams
1222
- });
1223
- const link = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
1224
- return link && (redos.push({
1225
- id: RemoveHyperLinkMutation.id,
1226
- params: {
1227
- unitId,
1228
- subUnitId,
1229
- id
1230
- }
1231
- }), undos.push({
1232
- id: AddHyperLinkMutation.id,
1233
- params: {
1234
- unitId,
1235
- subUnitId,
1236
- link: {
1237
- ...link
1238
- }
1239
- }
1240
- })), sequenceExecute(redos, commandService).result ? (undoRedoService.pushUndoRedo({
1241
- redoMutations: redos,
1242
- undoMutations: undos,
1243
- unitID: unitId
1244
- }), !0) : !1;
1245
- }
1246
- }, CancelRichHyperLinkCommand = {
1247
- type: CommandType.COMMAND,
1248
- id: "sheets.command.cancel-rich-hyper-link",
1249
- handler(accessor, params) {
1250
- var _a15, _b;
1251
- if (!params)
1252
- return !1;
1253
- const { id: linkId, documentId } = params, commandService = accessor.get(ICommandService), doc = accessor.get(IUniverInstanceService).getUnit(documentId, UniverInstanceType.UNIVER_DOC), link = (_b = (_a15 = doc == null ? void 0 : doc.getBody()) == null ? void 0 : _a15.customRanges) == null ? void 0 : _b.find((i) => i.rangeId === linkId);
1254
- let insert = null;
1255
- link && link.endIndex === doc.getBody().dataStream.length - 3 && (insert = {
1256
- dataStream: " "
1257
- });
1258
- const doMutation = deleteCustomRangeFactory(accessor, { unitId: documentId, rangeId: linkId, insert });
1259
- return doMutation ? commandService.syncExecuteCommand(doMutation.id, doMutation.params) : !1;
1260
- }
1261
- }, cellLink = "univer-cell-link", cellLinkType = "univer-cell-link-type", cellLinkContent = "univer-cell-link-content", cellLinkContentError = "univer-cell-link-content-error", cellLinkUrl = "univer-cell-link-url", cellLinkOperations = "univer-cell-link-operations", cellLinkOperation = "univer-cell-link-operation", cellLinkOperationError = "univer-cell-link-operation-error", styles = {
851
+ const cellLink = "univer-cell-link", cellLinkType = "univer-cell-link-type", cellLinkContent = "univer-cell-link-content", cellLinkContentError = "univer-cell-link-content-error", cellLinkUrl = "univer-cell-link-url", cellLinkOperations = "univer-cell-link-operations", cellLinkOperation = "univer-cell-link-operation", cellLinkOperationError = "univer-cell-link-operation-error", styles = {
1262
852
  cellLink,
1263
853
  cellLinkType,
1264
854
  cellLinkContent,
@@ -1275,7 +865,7 @@ const CancelHyperLinkCommand = {
1275
865
  [SheetHyperLinkType.INVALID]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {})
1276
866
  }, CellLinkPopup = /* @__PURE__ */ __name(() => {
1277
867
  var _a15, _b;
1278
- const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService), zenZoneService = useDependency(IZenZoneService);
868
+ const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService), parserHyperLinkService = useDependency(SheetsHyperLinkParserService), zenZoneService = useDependency(IZenZoneService);
1279
869
  if (useObservable$1(zenZoneService.visible$), useEffect(() => {
1280
870
  setCurrentPopup(popupService.currentPopup);
1281
871
  const ob = popupService.currentPopup$.subscribe((popup) => {
@@ -1289,14 +879,14 @@ const CancelHyperLinkCommand = {
1289
879
  const { unitId, subUnitId, customRange, row, col } = currentPopup;
1290
880
  if (!((_a15 = customRange == null ? void 0 : customRange.properties) != null && _a15.url))
1291
881
  return null;
1292
- const linkObj = resolverService.parseHyperLink((_b = customRange.properties.url) != null ? _b : ""), isError = linkObj.type === SheetHyperLinkType.INVALID;
882
+ const linkObj = parserHyperLinkService.parseHyperLink((_b = customRange.properties.url) != null ? _b : ""), isError = linkObj.type === SheetHyperLinkType.INVALID;
1293
883
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLink, onClick: /* @__PURE__ */ __name(() => popupService.hideCurrentPopup(), "onClick"), children: [
1294
884
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
1295
885
  "div",
1296
886
  {
1297
887
  className: clsx(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }),
1298
888
  onClick: /* @__PURE__ */ __name(() => {
1299
- zenZoneService.visible || linkObj.handler();
889
+ zenZoneService.visible || resolverService.navigate(linkObj);
1300
890
  }, "onClick"),
1301
891
  children: [
1302
892
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
@@ -1466,7 +1056,7 @@ let SheetsHyperLinkPopupService = (_a3 = class extends Disposable {
1466
1056
  collapsed: body.dataStream.length - 2 === 0,
1467
1057
  label: BuildTextUtils.transform.getPlainText(body.dataStream)
1468
1058
  };
1469
- const links = BuildTextUtils.customRange.getCustomRangesInterestsWithRange(textRange, (_c = (_b = body.customRanges) == null ? void 0 : _b.filter((i) => i.rangeType === CustomRangeType.HYPERLINK)) != null ? _c : []);
1059
+ const links = BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(textRange, (_c = (_b = body.customRanges) == null ? void 0 : _b.filter((i) => i.rangeType === CustomRangeType.HYPERLINK)) != null ? _c : []);
1470
1060
  let start = textRange.startOffset, end = textRange.endOffset;
1471
1061
  return links.forEach((link) => {
1472
1062
  start = Math.min(start, link.startIndex), end = Math.max(end, link.endIndex + 1);
@@ -1631,16 +1221,17 @@ const getShouldDisableCellLink = /* @__PURE__ */ __name((worksheet, row, col) =>
1631
1221
  const row = selections[0].range.startRow, col = selections[0].range.startColumn;
1632
1222
  return getShouldDisableCellLink(worksheet, row, col);
1633
1223
  }, "getShouldDisableCurrentCellLink"), shouldDisableAddLink = /* @__PURE__ */ __name((accessor) => {
1634
- var _a15;
1224
+ var _a15, _b;
1635
1225
  const textSelectionService = accessor.get(DocSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService), textRanges = textSelectionService.getDocRanges();
1636
1226
  if (!textRanges.length || textRanges.length > 1)
1637
1227
  return !0;
1638
1228
  const activeRange = textRanges[0], doc = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
1639
1229
  if (!doc || !activeRange || activeRange.collapsed)
1640
1230
  return !0;
1641
- const body = doc.getSelfOrHeaderFooterModel(activeRange.segmentId).getBody(), paragraphs = body == null ? void 0 : body.paragraphs;
1642
- if (!paragraphs)
1231
+ const body = doc.getSelfOrHeaderFooterModel(activeRange.segmentId).getBody();
1232
+ if (!body)
1643
1233
  return !0;
1234
+ const paragraphs = (_a15 = body == null ? void 0 : body.paragraphs) != null ? _a15 : [];
1644
1235
  for (let i = 0, len = paragraphs.length; i < len; i++) {
1645
1236
  const p2 = paragraphs[i];
1646
1237
  if (activeRange.startOffset <= p2.startIndex && activeRange.endOffset > p2.startIndex)
@@ -1648,7 +1239,7 @@ const getShouldDisableCellLink = /* @__PURE__ */ __name((worksheet, row, col) =>
1648
1239
  if (p2.startIndex > activeRange.endOffset)
1649
1240
  break;
1650
1241
  }
1651
- return !BuildTextUtils.customRange.getCustomRangesInterestsWithRange(activeRange, (_a15 = body.customRanges) != null ? _a15 : []).every((range) => range.rangeType === CustomRangeType.HYPERLINK);
1242
+ return !BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(activeRange, (_b = body.customRanges) != null ? _b : []).every((range) => range.rangeType === CustomRangeType.HYPERLINK);
1652
1243
  }, "shouldDisableAddLink"), OpenHyperLinkEditPanelOperation = {
1653
1244
  type: CommandType.OPERATION,
1654
1245
  id: "sheet.operation.open-hyper-link-edit-panel",
@@ -1693,13 +1284,23 @@ const getShouldDisableCellLink = /* @__PURE__ */ __name((worksheet, row, col) =>
1693
1284
  const commandService = accessor.get(ICommandService);
1694
1285
  return accessor.get(SheetsHyperLinkPopupService).currentEditing ? commandService.executeCommand(CloseHyperLinkPopupOperation.id) : commandService.executeCommand(InsertHyperLinkOperation.id);
1695
1286
  }
1696
- }, getLinkDisable$ = /* @__PURE__ */ __name((accessor) => {
1697
- const disableRange$ = getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }), univerInstanceService = accessor.get(IUniverInstanceService), sheetSelectionService = accessor.get(SheetsSelectionsService), disableCell$ = univerInstanceService.focused$.pipe(
1698
- map((focused) => focused ? univerInstanceService.getUnit(focused, UniverInstanceType.UNIVER_SHEET) : null),
1699
- mergeMap((unit) => unit ? unit.activeSheet$ : new Observable((sub) => {
1700
- sub.next(null);
1701
- })),
1702
- mergeMap((sheet) => sheetSelectionService.selectionMoveEnd$.pipe(map((selections) => sheet && { selections, sheet }))),
1287
+ }, getEditingLinkDisable$ = /* @__PURE__ */ __name((accessor, unitId = DOCS_ZEN_EDITOR_UNIT_ID_KEY) => {
1288
+ var _a15;
1289
+ const univerInstanceService = accessor.get(IUniverInstanceService), docSelctionService = (_a15 = accessor.get(IRenderManagerService).getRenderById(unitId)) == null ? void 0 : _a15.with(DocSelectionRenderService);
1290
+ return docSelctionService ? docSelctionService.textSelectionInner$.pipe(map(() => {
1291
+ const state = accessor.get(IEditorBridgeService).getEditCellState();
1292
+ if (!state)
1293
+ return !0;
1294
+ const target = getSheetCommandTarget(univerInstanceService, { unitId: state.unitId, subUnitId: state.sheetId });
1295
+ return !(target != null && target.worksheet) || getShouldDisableCellLink(target.worksheet, state.row, state.column) ? !0 : shouldDisableAddLink(accessor);
1296
+ })) : of(!0);
1297
+ }, "getEditingLinkDisable$"), getLinkDisable$ = /* @__PURE__ */ __name((accessor) => {
1298
+ const disableRange$ = getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }, !0), univerInstanceService = accessor.get(IUniverInstanceService), sheetSelectionService = accessor.get(SheetsSelectionsService), editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null, disableCell$ = univerInstanceService.focused$.pipe(
1299
+ filter((focused) => !!focused),
1300
+ map((focused) => univerInstanceService.getUnit(focused, UniverInstanceType.UNIVER_SHEET)),
1301
+ filter((unit) => !!unit),
1302
+ switchMap((unit) => unit.activeSheet$),
1303
+ switchMap((sheet) => sheetSelectionService.selectionMoveEnd$.pipe(map((selections) => sheet && { selections, sheet }))),
1703
1304
  map((sheetWithSelection) => {
1704
1305
  if (!sheetWithSelection)
1705
1306
  return !0;
@@ -1707,25 +1308,20 @@ const getShouldDisableCellLink = /* @__PURE__ */ __name((worksheet, row, col) =>
1707
1308
  if (!selections.length)
1708
1309
  return !0;
1709
1310
  const row = selections[0].range.startRow, col = selections[0].range.startColumn;
1710
- return getShouldDisableCellLink(sheet, row, col);
1711
- })
1712
- );
1713
- return disableRange$.pipe(mergeMap((disableRange) => disableCell$.pipe(map((disableCell) => disableRange || disableCell))));
1714
- }, "getLinkDisable$"), getZenLinkDisable$ = /* @__PURE__ */ __name((accessor) => {
1715
- const univerInstanceService = accessor.get(IUniverInstanceService);
1716
- return univerInstanceService.focused$.pipe(
1717
- mergeMap((focused) => !focused || focused !== DOCS_ZEN_EDITOR_UNIT_ID_KEY ? new Observable((sub) => sub.next(null)) : accessor.get(DocSelectionManagerService).textSelection$),
1718
- map((selection) => {
1719
- if (!selection || selection.unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY)
1311
+ if (getShouldDisableCellLink(sheet, row, col))
1720
1312
  return !0;
1721
- const state = accessor.get(IEditorBridgeService).getEditCellState();
1722
- if (!state)
1723
- return !0;
1724
- const target = getSheetCommandTarget(univerInstanceService, { unitId: state.unitId, subUnitId: state.sheetId });
1725
- return !(target != null && target.worksheet) || getShouldDisableCellLink(target.worksheet, state.row, state.column) ? !0 : shouldDisableAddLink(accessor);
1726
- })
1313
+ }),
1314
+ switchMap((disableCell) => disableCell ? of(!0) : (editorBridgeService ? editorBridgeService.visible$ : of(null)).pipe(map((visible) => visible != null && visible.visible ? DOCS_NORMAL_EDITOR_UNIT_ID_KEY : void 0)).pipe(
1315
+ switchMap(
1316
+ (editing) => editing ? getEditingLinkDisable$(accessor, editing) : of(!1)
1317
+ )
1318
+ ))
1727
1319
  );
1728
- }, "getZenLinkDisable$"), linkMenu = {
1320
+ return disableRange$.pipe(
1321
+ distinctUntilChanged(),
1322
+ switchMap((disableRange) => disableCell$.pipe(map((disableCell) => disableRange || disableCell)))
1323
+ );
1324
+ }, "getLinkDisable$"), linkMenu = {
1729
1325
  commandId: InsertHyperLinkOperation.id,
1730
1326
  type: MenuItemType.BUTTON,
1731
1327
  positions: [MenuPosition.CONTEXT_MENU],
@@ -1741,7 +1337,7 @@ const getShouldDisableCellLink = /* @__PURE__ */ __name((worksheet, row, col) =>
1741
1337
  ...linkMenu,
1742
1338
  id: genZenEditorMenuId(linkMenu.commandId),
1743
1339
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, DOCS_ZEN_EDITOR_UNIT_ID_KEY),
1744
- disabled$: getZenLinkDisable$(accessor)
1340
+ disabled$: getEditingLinkDisable$(accessor)
1745
1341
  }), "zenEditorInsertLinkMenuFactory"), linkToolbarMenu = {
1746
1342
  tooltip: "hyperLink.form.addTitle",
1747
1343
  positions: MenuPosition.TOOLBAR_START,
@@ -1758,7 +1354,7 @@ const getShouldDisableCellLink = /* @__PURE__ */ __name((worksheet, row, col) =>
1758
1354
  ...linkToolbarMenu,
1759
1355
  id: genZenEditorMenuId(linkToolbarMenu.commandId),
1760
1356
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, DOCS_ZEN_EDITOR_UNIT_ID_KEY),
1761
- disabled$: getZenLinkDisable$(accessor)
1357
+ disabled$: getEditingLinkDisable$(accessor)
1762
1358
  }), "zenEditorInsertLinkMenuToolbarFactory"), InsertLinkShortcut = {
1763
1359
  id: InsertHyperLinkToolbarOperation.id,
1764
1360
  binding: KeyCode.K | MetaKeys.CTRL_COMMAND,
@@ -1961,7 +1557,7 @@ let SheetsHyperLinkPopupController = (_a6 = class extends Disposable {
1961
1557
  _initHoverEditingListener() {
1962
1558
  let subscribe = null;
1963
1559
  this.disposeWithMe(
1964
- this._editorBridgeService.currentEditCellState$.pipe(mergeMap((state) => this._editorBridgeService.visible$.pipe(map((visible) => ({ visible, state }))))).subscribe(({ visible, state }) => {
1560
+ this._editorBridgeService.currentEditCellState$.pipe(switchMap((state) => this._editorBridgeService.visible$.pipe(map((visible) => ({ visible, state }))))).subscribe(({ visible, state }) => {
1965
1561
  if (!state || state.editorUnitId !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY)
1966
1562
  return;
1967
1563
  if (!visible.visible) {
@@ -2008,11 +1604,11 @@ let SheetsHyperLinkPopupController = (_a6 = class extends Disposable {
2008
1604
  _initZenEditor() {
2009
1605
  this.disposeWithMe(
2010
1606
  this._zenZoneService.visible$.subscribe((visible) => {
2011
- visible && (this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING), this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING), this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING), this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING));
1607
+ visible ? (this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING), this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING), this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING), this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING)) : (this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR), this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.ZEN_EDITOR));
2012
1608
  })
2013
1609
  ), this.disposeWithMe(
2014
1610
  this._univerInstanceService.focused$.pipe(
2015
- mergeMap((id) => {
1611
+ switchMap((id) => {
2016
1612
  const render2 = id === DOCS_ZEN_EDITOR_UNIT_ID_KEY ? this._renderManagerService.getRenderById(id) : null;
2017
1613
  return render2 ? render2.with(DocEventManagerService).hoverCustomRanges$.pipe(debounceTime(200)) : new Observable((sub) => {
2018
1614
  sub.next(null);
@@ -2204,56 +1800,7 @@ let SheetsHyperLinkRichTextRefRangeController = (_a10 = class extends Disposable
2204
1800
  }
2205
1801
  _registerRange(unitId, subUnitId, row, col, p2) {
2206
1802
  var _a15, _b, _c, _d;
2207
- const map2 = this._enusreMap(unitId, subUnitId), data = Tools.deepClone(p2), handleRangeChange = /* @__PURE__ */ __name((commandInfo) => {
2208
- var _a16, _b2;
2209
- const dataCopy = Tools.deepClone(data);
2210
- (_b2 = (_a16 = dataCopy.body) == null ? void 0 : _a16.customRanges) == null || _b2.forEach((customRange) => {
2211
- var _a17;
2212
- if (customRange.rangeType === CustomRangeType.HYPERLINK) {
2213
- const payload = (_a17 = customRange.properties) == null ? void 0 : _a17.url, range = this._isLegalRangeUrl(unitId, payload);
2214
- if (range) {
2215
- const resultRange = handleDefaultRangeChangeWithEffectRefCommands(range, commandInfo), newPayload = `#gid=${subUnitId}&range=${resultRange ? serializeRange(resultRange) : ERROR_RANGE}`;
2216
- customRange.properties.url = newPayload;
2217
- }
2218
- }
2219
- });
2220
- const position = handleDefaultRangeChangeWithEffectRefCommands({ startRow: row, endRow: row, startColumn: col, endColumn: col }, commandInfo);
2221
- return position ? {
2222
- redos: [{
2223
- id: SetRangeValuesMutation.id,
2224
- params: {
2225
- unitId,
2226
- subUnitId,
2227
- cellValue: {
2228
- [position.startRow]: {
2229
- [position.startColumn]: {
2230
- p: dataCopy
2231
- }
2232
- }
2233
- }
2234
- }
2235
- }],
2236
- undos: [
2237
- {
2238
- id: SetRangeValuesMutation.id,
2239
- params: {
2240
- unitId,
2241
- subUnitId,
2242
- cellValue: {
2243
- [row]: {
2244
- [col]: {
2245
- p: data
2246
- }
2247
- }
2248
- }
2249
- }
2250
- }
2251
- ]
2252
- } : {
2253
- redos: [],
2254
- undos: []
2255
- };
2256
- }, "handleRangeChange");
1803
+ const map2 = this._enusreMap(unitId, subUnitId);
2257
1804
  if ((_b = (_a15 = p2.body) == null ? void 0 : _a15.customRanges) != null && _b.some((customRange) => {
2258
1805
  var _a16;
2259
1806
  return customRange.rangeType === CustomRangeType.HYPERLINK && this._isLegalRangeUrl(unitId, (_a16 = customRange.properties) == null ? void 0 : _a16.url);
@@ -2263,7 +1810,9 @@ let SheetsHyperLinkRichTextRefRangeController = (_a10 = class extends Disposable
2263
1810
  var _a16;
2264
1811
  if (customRange.rangeType === CustomRangeType.HYPERLINK) {
2265
1812
  const payload = (_a16 = customRange.properties) == null ? void 0 : _a16.url, range = this._isLegalRangeUrl(unitId, payload);
2266
- range && disposableCollection.add(this._refRangeService.registerRefRange(range, handleRangeChange, unitId, subUnitId));
1813
+ range && disposableCollection.add(this._refRangeService.watchRange(unitId, subUnitId, range, (before, after) => {
1814
+ customRange.properties.url = `#gid=${subUnitId}&range=${after ? serializeRange(after) : ERROR_RANGE}`;
1815
+ }));
2267
1816
  }
2268
1817
  }), map2.setValue(row, col, disposableCollection);
2269
1818
  }
@@ -2404,15 +1953,15 @@ let SheetHyperLinkSetRangeController = (_a11 = class extends Disposable {
2404
1953
  }));
2405
1954
  }
2406
1955
  _initAfterEditor() {
2407
- this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
1956
+ this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(AFTER_CELL_EDIT, {
2408
1957
  handler: /* @__PURE__ */ __name((cell, context, next) => {
2409
1958
  if (!cell || cell.p)
2410
1959
  return next(cell);
2411
1960
  if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
2412
- const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
2413
- if (!skeleton)
1961
+ const { unitId, subUnitId } = context, workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET), worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId);
1962
+ if (!worksheet)
2414
1963
  return next(cell);
2415
- const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
1964
+ const doc = worksheet.getBlankCellDocumentModel(cell);
2416
1965
  if (!doc.documentModel)
2417
1966
  return next(cell);
2418
1967
  const textX = BuildTextUtils.selection.replace({
@@ -2513,13 +2062,7 @@ let SheetsHyperLinkUIController = (_a12 = class extends Disposable {
2513
2062
  OpenHyperLinkEditPanelOperation,
2514
2063
  CloseHyperLinkPopupOperation,
2515
2064
  InsertHyperLinkOperation,
2516
- InsertHyperLinkToolbarOperation,
2517
- AddHyperLinkCommand,
2518
- UpdateHyperLinkCommand,
2519
- CancelHyperLinkCommand,
2520
- UpdateRichHyperLinkCommand,
2521
- CancelRichHyperLinkCommand,
2522
- AddRichHyperLinkCommand
2065
+ InsertHyperLinkToolbarOperation
2523
2066
  ].forEach((command) => {
2524
2067
  this._commandService.registerCommand(command);
2525
2068
  });
@@ -2544,16 +2087,20 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
2544
2087
  return kind && result && __defProp$1(target, key, result), result;
2545
2088
  }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a13;
2546
2089
  let SheetHyperLinkUrlController = (_a13 = class extends Disposable {
2547
- constructor(_resolverService) {
2548
- super(), this._resolverService = _resolverService, this._handleInitUrl();
2090
+ constructor(_parserService, _resolverService) {
2091
+ super(), this._parserService = _parserService, this._resolverService = _resolverService, this._handleInitUrl();
2549
2092
  }
2550
2093
  _handleInitUrl() {
2551
2094
  const hash = location.hash;
2552
- hash && this._resolverService.parseHyperLink(hash).handler();
2095
+ if (hash) {
2096
+ const linkInfo = this._parserService.parseHyperLink(hash);
2097
+ this._resolverService.navigate(linkInfo);
2098
+ }
2553
2099
  }
2554
2100
  }, __name(_a13, "SheetHyperLinkUrlController"), _a13);
2555
2101
  SheetHyperLinkUrlController = __decorateClass$1([
2556
- __decorateParam$1(0, Inject(SheetsHyperLinkResolverService))
2102
+ __decorateParam$1(0, Inject(SheetsHyperLinkParserService)),
2103
+ __decorateParam$1(1, Inject(SheetsHyperLinkResolverService))
2557
2104
  ], SheetHyperLinkUrlController);
2558
2105
  var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2559
2106
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
@@ -2598,8 +2145,6 @@ UniverSheetsHyperLinkUIPlugin = __decorateClass([
2598
2145
  __decorateParam(2, IConfigService)
2599
2146
  ], UniverSheetsHyperLinkUIPlugin);
2600
2147
  export {
2601
- AddHyperLinkCommand,
2602
- CancelHyperLinkCommand,
2603
2148
  CloseHyperLinkPopupOperation,
2604
2149
  InsertHyperLinkOperation,
2605
2150
  InsertLinkShortcut,
@@ -2608,6 +2153,5 @@ export {
2608
2153
  SheetsHyperLinkPopupService,
2609
2154
  SheetsHyperLinkResolverService,
2610
2155
  SheetsHyperLinkSidePanelService,
2611
- UniverSheetsHyperLinkUIPlugin,
2612
- UpdateHyperLinkCommand
2156
+ UniverSheetsHyperLinkUIPlugin
2613
2157
  };