@univerjs/sheets-hyper-link-ui 0.3.0-alpha.1 → 0.3.0-nightly.202410111606

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -2,20 +2,19 @@ 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, OnLifecycle, LifecycleStages, Injector, Disposable, Range, ObjectMatrix, CommandType, IUndoRedoService, BuildTextUtils, DataStreamTreeTokenType, CustomRangeType, TextX, CellValueType, sequenceExecuteAsync, generateRandomId, getBodySlice, useDependency, IContextService, getOriginCellValue, DisposableCollection, createInternalEditorID, FOCUSING_SHEET, DOCS_ZEN_EDITOR_UNIT_ID_KEY, sequenceExecute, DataValidationType, ThemeService, InterceptorEffectEnum, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IPermissionService, DependentOn, Plugin } from "@univerjs/core";
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, createInternalEditorID, 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
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, SheetSkeletonManagerService, IEditorBridgeService, IMarkSelectionService, SheetCanvasPopManagerService, getEditingCustomRangePosition, getCustomRangePosition, whenSheetEditorFocused, getCurrentRangeDisable$, HoverManagerService, SheetPermissionInterceptorBaseController, HoverRenderController, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange } from "@univerjs/sheets-ui";
7
+ import { ScrollToRangeOperation, COPY_TYPE, virtualizeDiscreteRanges, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, SheetSkeletonManagerService, IEditorBridgeService, IMarkSelectionService, SheetCanvasPopManagerService, getEditingCustomRangePosition, getCustomRangePosition, whenSheetEditorFocused, getCurrentRangeDisable$, IAutoFillService, APPLY_TYPE, getAutoFillRepeatRange, SheetPermissionInterceptorBaseController, HoverManagerService, HoverRenderController } from "@univerjs/sheets-ui";
8
8
  import { MessageType, FormLayout, Input, Select, Button, Tooltip } from "@univerjs/design";
9
9
  import { deserializeRangeWithSheet, serializeRangeWithSheet, serializeRange, IDefinedNamesService, serializeRangeToRefString } from "@univerjs/engine-formula";
10
- import { SetSelectionsOperation, SetWorksheetActiveOperation, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, SheetInterceptorService, RemoveSheetCommand, INTERCEPTOR_POINT, SetRangeValuesCommand, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookCopyPermission, WorksheetCopyPermission, RefRangeService, handleDefaultRangeChangeWithEffectRefCommands } from "@univerjs/sheets";
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";
11
11
  import { IMessageService, useObservable, IZenZoneService, useEvent, KeyCode, MenuItemType, MenuPosition, MenuGroup, MetaKeys, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IShortcutService, IMenuManagerService } from "@univerjs/ui";
12
12
  import { DocSelectionManagerService } from "@univerjs/docs";
13
13
  import { Subject, BehaviorSubject, map, mergeMap, Observable, debounceTime } from "rxjs";
14
- import { addCustomRangeBySelectionFactory, replaceSelectionFactory, DocSelectionRenderService, RangeSelector, deleteCustomRangeFactory, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
14
+ import { addCustomRangeBySelectionFactory, replaceSelectionFactory, DocSelectionRenderService, RangeSelector, DocBackScrollRenderController, deleteCustomRangeFactory, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
15
15
  import require$$0, { useState, useMemo, useRef, useEffect, forwardRef, createElement } from "react";
16
16
  import { IRenderManagerService } from "@univerjs/engine-render";
17
17
  import cs from "clsx";
18
- const SHEET_HYPER_LINK_UI_PLUGIN = "SHEET_HYPER_LINK_UI_PLUGIN";
19
18
  function isLegalLink(link) {
20
19
  return Tools.isLegalUrl(link);
21
20
  }
@@ -101,7 +100,28 @@ let SheetsHyperLinkResolverService = (_a = class {
101
100
  if (!workbook)
102
101
  return;
103
102
  const unitId = workbook.getUnitId();
104
- if (rangeid && this.navigateToDefineName(unitId, rangeid), !!gid) {
103
+ if (rangeid) {
104
+ const item = this._definedNamesService.getValueById(unitId, rangeid);
105
+ if (!item)
106
+ return;
107
+ const { formulaOrRefString } = item, worksheet = this._definedNamesService.getWorksheetByRef(unitId, formulaOrRefString);
108
+ if (!worksheet) {
109
+ this._messageService.show({
110
+ content: this._localeService.t("hyperLink.message.refError"),
111
+ type: MessageType.Error
112
+ });
113
+ return;
114
+ }
115
+ if (worksheet.isSheetHidden()) {
116
+ this._messageService.show({
117
+ content: this._localeService.t("hyperLink.message.hiddenSheet"),
118
+ type: MessageType.Error
119
+ });
120
+ return;
121
+ }
122
+ this.navigateToDefineName(unitId, rangeid);
123
+ }
124
+ if (gid) {
105
125
  if (range) {
106
126
  const rangeInfo = deserializeRangeWithSheet(range);
107
127
  isValidRange(rangeInfo.range) && range !== ERROR_RANGE && this.navigateToRange(unitId, gid, rangeInfo.range);
@@ -218,6 +238,7 @@ SheetsHyperLinkResolverService = __decorateClass$c([
218
238
  __decorateParam$c(4, Inject(LocaleService)),
219
239
  __decorateParam$c(5, IConfigService)
220
240
  ], SheetsHyperLinkResolverService);
241
+ const SHEET_HYPER_LINK_UI_PLUGIN = "SHEET_HYPER_LINK_UI_PLUGIN";
221
242
  var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
222
243
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
223
244
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -364,7 +385,6 @@ let SheetsHyperLinkCopyPasteController = (_a2 = class extends Disposable {
364
385
  }
365
386
  }, __name(_a2, "SheetsHyperLinkCopyPasteController"), _a2);
366
387
  SheetsHyperLinkCopyPasteController = __decorateClass$b([
367
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkCopyPasteController),
368
388
  __decorateParam$b(0, ISheetClipboardService),
369
389
  __decorateParam$b(1, Inject(HyperLinkModel)),
370
390
  __decorateParam$b(2, Inject(Injector)),
@@ -668,12 +688,12 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
668
688
  cellLinkEditButtons
669
689
  }, CellLinkEdit = /* @__PURE__ */ __name(() => {
670
690
  var _a15;
671
- 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), customHyperLinkSidePanel = useMemo(() => {
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), customHyperLinkSidePanel = useMemo(() => {
672
692
  if (!sidePanelService.isBuiltInLinkType(type))
673
693
  return sidePanelService.getCustomHyperLink(type);
674
694
  }, [sidePanelService, type]), [showError, setShowError] = useState(!1), setByPayload = useRef(!1);
675
695
  useEffect(() => {
676
- var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
696
+ var _a16, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
677
697
  if ((editing == null ? void 0 : editing.row) !== void 0 && editing.col !== void 0) {
678
698
  const { label, customRange, row, col } = editing;
679
699
  let link;
@@ -689,20 +709,20 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
689
709
  const workbook2 = univerInstanceService.getUnit(editing.unitId), worksheet = workbook2 == null ? void 0 : workbook2.getSheetBySheetId(editing.subUnitId), cell = worksheet == null ? void 0 : worksheet.getCellRaw(editing.row, editing.col), range = (_f = (_e = (_d = cell == null ? void 0 : cell.p) == null ? void 0 : _d.body) == null ? void 0 : _e.customRanges) == null ? void 0 : _f.find((range2) => {
690
710
  var _a17;
691
711
  return range2.rangeType === CustomRangeType.HYPERLINK && ((_a17 = range2.properties) == null ? void 0 : _a17.url);
692
- }), cellValue = `${(_g = getOriginCellValue(cell)) != null ? _g : ""}`;
693
- cell && (cell.p || cellValue) && setShowLabel(!1), link = {
712
+ }), cellValue = cell == null ? void 0 : cell.v;
713
+ cell && (!BuildTextUtils.transform.isEmptyDocument((_h = (_g = cell.p) == null ? void 0 : _g.body) == null ? void 0 : _h.dataStream) || cellValue) && setShowLabel(!1), link = {
694
714
  id: "",
695
715
  display: "",
696
- payload: (_i = (_h = range == null ? void 0 : range.properties) == null ? void 0 : _h.url) != null ? _i : "",
716
+ payload: (_j = (_i = range == null ? void 0 : range.properties) == null ? void 0 : _i.url) != null ? _j : "",
697
717
  row,
698
718
  column: col
699
719
  };
700
720
  } else {
701
- const doc = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC), selection = textSelectionService.getActiveTextRange(), customRange2 = selection && ((_l = BuildTextUtils.customRange.getCustomRangesInterestsWithRange(selection, (_k = (_j = doc == null ? void 0 : doc.getBody()) == null ? void 0 : _j.customRanges) != null ? _k : [])) == null ? void 0 : _l[0]);
721
+ 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]);
702
722
  setShowLabel(!1), link = {
703
723
  id: "",
704
724
  display: label != null ? label : "",
705
- payload: (_n = (_m = customRange2 == null ? void 0 : customRange2.properties) == null ? void 0 : _m.url) != null ? _n : "",
725
+ payload: (_o = (_n = customRange2 == null ? void 0 : customRange2.properties) == null ? void 0 : _n.url) != null ? _o : "",
706
726
  row,
707
727
  column: col
708
728
  };
@@ -722,7 +742,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
722
742
  break;
723
743
  }
724
744
  case SheetHyperLinkType.RANGE: {
725
- 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);
745
+ 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);
726
746
  setPayload(payload2), payload2 === link.display && (setByPayload.current = !0);
727
747
  break;
728
748
  }
@@ -742,10 +762,9 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
742
762
  }
743
763
  }
744
764
  }, [editing, resolverService, sidePanelService, textSelectionService, univerInstanceService]), useEffect(() => {
745
- var _a16;
746
765
  let id2 = null;
747
- if (editing && editing.type === HyperLinkEditSourceType.VIEWING && Tools.isDefine(editing.row) && Tools.isDefine(editing.col)) {
748
- const worksheet = (_a16 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _a16.getSheetBySheetId(editing.subUnitId), mergeInfo = worksheet == null ? void 0 : worksheet.getMergedCell(editing.row, editing.col);
766
+ if (editing && !editing.customRangeId && editing.type === HyperLinkEditSourceType.VIEWING && Tools.isDefine(editing.row) && Tools.isDefine(editing.col)) {
767
+ const workbook2 = univerInstanceService.getUnit(editing.unitId, UniverInstanceType.UNIVER_SHEET), worksheet = workbook2 == null ? void 0 : workbook2.getSheetBySheetId(editing.subUnitId), mergeInfo = worksheet == null ? void 0 : worksheet.getMergedCell(editing.row, editing.col), color = new ColorKit(themeService.getCurrentTheme().hyacinth500).toRgb();
749
768
  id2 = markSelectionService.addShape(
750
769
  {
751
770
  range: mergeInfo != null ? mergeInfo : {
@@ -756,7 +775,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
756
775
  },
757
776
  style: {
758
777
  hasAutoFill: !1,
759
- fill: "rgb(255, 189, 55, 0.35)",
778
+ fill: `rgb(${color.r}, ${color.g}, ${color.b}, 0.12)`,
760
779
  strokeWidth: 1,
761
780
  stroke: "#FFBD37",
762
781
  widgets: {}
@@ -770,7 +789,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
770
789
  return () => {
771
790
  id2 && markSelectionService.removeShape(id2);
772
791
  };
773
- }, [editing, markSelectionService]);
792
+ }, [editing, markSelectionService, themeService, univerInstanceService]);
774
793
  const payloadInitial = useMemo(() => payload, [type]);
775
794
  useEffect(() => {
776
795
  const render2 = renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId()), disposeCollection = new DisposableCollection();
@@ -937,13 +956,25 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
937
956
  isSingleChoice: !0,
938
957
  value: payloadInitial,
939
958
  onChange: handleRangeChange,
940
- disableInput: editing.type === HyperLinkEditSourceType.ZEN_EDITOR,
959
+ dialogOnly: !0,
941
960
  onSelectorVisibleChange: /* @__PURE__ */ __name(async (visible) => {
942
- visible ? (editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (zenZoneService.hide(), contextService.setContextValue(FOCUSING_SHEET, !0)), editing.type !== HyperLinkEditSourceType.VIEWING && editorBridgeService.enableForceKeepVisible(), setHide(!0)) : (await resolverService.navigateToRange(editing.unitId, editing.subUnitId, { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col }), editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (await commandService.executeCommand(SetSelectionsOperation.id, {
943
- unitId: editing.unitId,
944
- subUnitId: editing.subUnitId,
945
- selections: [{ range: { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col } }]
946
- }), zenZoneService.show(), contextService.setContextValue(FOCUSING_SHEET, !1)), editorBridgeService.disableForceKeepVisible(), setHide(!1));
961
+ var _a16, _b;
962
+ if (visible)
963
+ editing.type === HyperLinkEditSourceType.ZEN_EDITOR && (zenZoneService.hide(), contextService.setContextValue(FOCUSING_SHEET, !0)), editing.type !== HyperLinkEditSourceType.VIEWING && editorBridgeService.enableForceKeepVisible(), setHide(!0);
964
+ else {
965
+ if (await resolverService.navigateToRange(editing.unitId, editing.subUnitId, { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col }), editing.type === HyperLinkEditSourceType.ZEN_EDITOR) {
966
+ await commandService.executeCommand(SetSelectionsOperation.id, {
967
+ unitId: editing.unitId,
968
+ subUnitId: editing.subUnitId,
969
+ selections: [{ range: { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col } }]
970
+ }), zenZoneService.show(), contextService.setContextValue(FOCUSING_SHEET, !1);
971
+ 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];
972
+ docBackScrollRenderController && range && setTimeout(() => {
973
+ docBackScrollRenderController.scrollToRange(range), docSelectionManagerService.refreshSelection({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY });
974
+ }, 100);
975
+ }
976
+ editorBridgeService.disableForceKeepVisible(), setHide(!1);
977
+ }
947
978
  }, "onSelectorVisibleChange")
948
979
  }
949
980
  ) }),
@@ -1212,8 +1243,8 @@ const CancelHyperLinkCommand = {
1212
1243
  [SheetHyperLinkType.INVALID]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {})
1213
1244
  }, CellLinkPopup = /* @__PURE__ */ __name(() => {
1214
1245
  var _a15, _b;
1215
- const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService);
1216
- if (useEffect(() => {
1246
+ 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);
1247
+ if (useObservable$1(zenZoneService.visible$), useEffect(() => {
1217
1248
  setCurrentPopup(popupService.currentPopup);
1218
1249
  const ob = popupService.currentPopup$.subscribe((popup) => {
1219
1250
  setCurrentPopup(popup);
@@ -1228,10 +1259,19 @@ const CancelHyperLinkCommand = {
1228
1259
  return null;
1229
1260
  const linkObj = resolverService.parseHyperLink((_b = customRange.properties.url) != null ? _b : ""), isError = linkObj.type === SheetHyperLinkType.INVALID;
1230
1261
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLink, onClick: /* @__PURE__ */ __name(() => popupService.hideCurrentPopup(), "onClick"), children: [
1231
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cs(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }), onClick: linkObj.handler, children: [
1232
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
1233
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { showIfEllipsis: !0, title: linkObj.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles.cellLinkUrl, children: linkObj.name }) })
1234
- ] }),
1262
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
1263
+ "div",
1264
+ {
1265
+ className: cs(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }),
1266
+ onClick: /* @__PURE__ */ __name(() => {
1267
+ zenZoneService.visible || linkObj.handler();
1268
+ }, "onClick"),
1269
+ children: [
1270
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
1271
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { showIfEllipsis: !0, title: linkObj.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles.cellLinkUrl, children: linkObj.name }) })
1272
+ ]
1273
+ }
1274
+ ),
1235
1275
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLinkOperations, children: [
1236
1276
  currentPopup.copyPermission && /* @__PURE__ */ jsxRuntimeExports.jsx(
1237
1277
  "div",
@@ -1408,6 +1448,9 @@ let SheetsHyperLinkPopupService = (_a3 = class extends Disposable {
1408
1448
  const hyperLinkRangeSelectorId = createInternalEditorID("hyper-link-edit");
1409
1449
  this._editorService.getFocusId() !== hyperLinkRangeSelectorId && (this._rangeSelectorService.getCurrentSelectorId() === hyperLinkRangeSelectorId && this._rangeSelectorService.selectorModalVisible || this.endEditing());
1410
1450
  }, "onClickOutside"),
1451
+ onContextMenu: /* @__PURE__ */ __name(() => {
1452
+ this.endEditing();
1453
+ }, "onContextMenu"),
1411
1454
  hiddenType: "hide"
1412
1455
  };
1413
1456
  }
@@ -1688,299 +1731,163 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
1688
1731
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1689
1732
  return kind && result && __defProp$9(target, key, result), result;
1690
1733
  }, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a4;
1691
- let SheetsHyperLinkRemoveSheetController = (_a4 = class extends Disposable {
1692
- constructor(_sheetInterceptorService, _univerInstanceService, _hyperLinkModel) {
1693
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._hyperLinkModel = _hyperLinkModel, this._initSheetChange();
1734
+ let SheetsHyperLinkAutoFillController = (_a4 = class extends Disposable {
1735
+ constructor(_autoFillService, _hyperLinkModel) {
1736
+ super(), this._autoFillService = _autoFillService, this._hyperLinkModel = _hyperLinkModel, this._initAutoFill();
1694
1737
  }
1695
- _initSheetChange() {
1696
- this.disposeWithMe(
1697
- this._sheetInterceptorService.interceptCommand({
1698
- getMutations: /* @__PURE__ */ __name((commandInfo) => {
1699
- var _a15;
1700
- if (commandInfo.id === RemoveSheetCommand.id) {
1701
- const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
1702
- if (!workbook)
1703
- return { redos: [], undos: [] };
1704
- const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId());
1705
- if (!subUnitId)
1706
- return { redos: [], undos: [] };
1707
- const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId), redos = links.map((link) => ({
1708
- id: RemoveHyperLinkMutation.id,
1709
- params: {
1710
- unitId,
1711
- subUnitId,
1712
- id: link.id
1713
- }
1714
- })), undos = links.map((link) => ({
1715
- id: AddHyperLinkMutation.id,
1716
- params: {
1717
- unitId,
1718
- subUnitId,
1719
- link
1738
+ // eslint-disable-next-line max-lines-per-function
1739
+ _initAutoFill() {
1740
+ const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), generalApplyFunc = /* @__PURE__ */ __name((location2, applyType) => {
1741
+ const { source: sourceRange, target: targetRange, unitId, subUnitId } = location2, virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]), [vSourceRange, vTargetRange] = virtualRange.ranges, { mapFunc } = virtualRange, sourceStartCell = {
1742
+ row: vSourceRange.startRow,
1743
+ col: vSourceRange.startColumn
1744
+ }, repeats = getAutoFillRepeatRange(vSourceRange, vTargetRange), redos = [], undos = [];
1745
+ return repeats.forEach((repeat) => {
1746
+ const targetStartCell = repeat.repeatStartCell, relativeRange = repeat.relativeRange, sourceRange2 = {
1747
+ startRow: sourceStartCell.row,
1748
+ startColumn: sourceStartCell.col,
1749
+ endColumn: sourceStartCell.col,
1750
+ endRow: sourceStartCell.row
1751
+ }, targetRange2 = {
1752
+ startRow: targetStartCell.row,
1753
+ startColumn: targetStartCell.col,
1754
+ endColumn: targetStartCell.col,
1755
+ endRow: targetStartCell.row
1756
+ };
1757
+ Range.foreach(relativeRange, (row, col) => {
1758
+ const sourcePositionRange = Rectangle.getPositionRange(
1759
+ {
1760
+ startRow: row,
1761
+ startColumn: col,
1762
+ endColumn: col,
1763
+ endRow: row
1764
+ },
1765
+ sourceRange2
1766
+ ), { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, sourceRow, sourceCol), targetPositionRange = Rectangle.getPositionRange(
1767
+ {
1768
+ startRow: row,
1769
+ startColumn: col,
1770
+ endColumn: col,
1771
+ endRow: row
1772
+ },
1773
+ targetRange2
1774
+ ), { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn), id = Tools.generateRandomId(), currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
1775
+ currentLink && redos.push({
1776
+ id: RemoveHyperLinkMutation.id,
1777
+ params: {
1778
+ unitId,
1779
+ subUnitId,
1780
+ id: currentLink.id
1781
+ }
1782
+ }), (APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) && link && (redos.push({
1783
+ id: AddHyperLinkMutation.id,
1784
+ params: {
1785
+ unitId,
1786
+ subUnitId,
1787
+ link: {
1788
+ ...link,
1789
+ id,
1790
+ row: targetRow,
1791
+ column: targetCol
1720
1792
  }
1721
- }));
1722
- return { redos, undos };
1723
- }
1724
- return { redos: [], undos: [] };
1725
- }, "getMutations")
1726
- })
1727
- );
1793
+ }
1794
+ }), undos.push({
1795
+ id: RemoveHyperLinkMutation.id,
1796
+ params: {
1797
+ unitId,
1798
+ subUnitId,
1799
+ id
1800
+ }
1801
+ })), currentLink && undos.push({
1802
+ id: AddHyperLinkMutation.id,
1803
+ params: {
1804
+ unitId,
1805
+ subUnitId,
1806
+ link: currentLink
1807
+ }
1808
+ });
1809
+ });
1810
+ }), {
1811
+ undos,
1812
+ redos
1813
+ };
1814
+ }, "generalApplyFunc"), hook = {
1815
+ id: SHEET_HYPER_LINK_UI_PLUGIN,
1816
+ onFillData: /* @__PURE__ */ __name((location2, direction, applyType) => applyType === APPLY_TYPE.COPY || applyType === APPLY_TYPE.ONLY_FORMAT || applyType === APPLY_TYPE.SERIES ? generalApplyFunc(location2, applyType) : noopReturnFunc(), "onFillData")
1817
+ };
1818
+ this.disposeWithMe(this._autoFillService.addHook(hook));
1728
1819
  }
1729
- }, __name(_a4, "SheetsHyperLinkRemoveSheetController"), _a4);
1730
- SheetsHyperLinkRemoveSheetController = __decorateClass$9([
1731
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRemoveSheetController),
1732
- __decorateParam$9(0, Inject(SheetInterceptorService)),
1733
- __decorateParam$9(1, IUniverInstanceService),
1734
- __decorateParam$9(2, Inject(HyperLinkModel))
1735
- ], SheetsHyperLinkRemoveSheetController);
1820
+ }, __name(_a4, "SheetsHyperLinkAutoFillController"), _a4);
1821
+ SheetsHyperLinkAutoFillController = __decorateClass$9([
1822
+ __decorateParam$9(0, IAutoFillService),
1823
+ __decorateParam$9(1, Inject(HyperLinkModel))
1824
+ ], SheetsHyperLinkAutoFillController);
1736
1825
  var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1737
1826
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1738
1827
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1739
1828
  return kind && result && __defProp$8(target, key, result), result;
1740
1829
  }, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a5;
1741
- let SheetsHyperLinkRenderController = (_a5 = class extends Disposable {
1742
- constructor(_context, _hyperLinkModel, _sheetSkeletonManagerService, _renderManagerService) {
1743
- super(), this._context = _context, this._hyperLinkModel = _hyperLinkModel, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._renderManagerService = _renderManagerService, this._initSkeletonChange();
1744
- }
1745
- _initSkeletonChange() {
1746
- const markSkeletonDirty = /* @__PURE__ */ __name(() => {
1747
- var _a15;
1748
- const workbook = this._context.unit, unitId = workbook.getUnitId(), subUnitId = (_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId();
1749
- if (!subUnitId) {
1750
- console.warn("No active sheet found");
1751
- return;
1752
- }
1753
- const skeleton = this._sheetSkeletonManagerService.getOrCreateSkeleton({ sheetId: subUnitId }), currentRender = this._renderManagerService.getRenderById(unitId);
1754
- skeleton == null || skeleton.makeDirty(!0), skeleton == null || skeleton.calculate(), currentRender && currentRender.mainComponent.makeForceDirty();
1755
- }, "markSkeletonDirty");
1756
- this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(debounceTime(16)).subscribe(() => {
1757
- markSkeletonDirty();
1758
- }));
1759
- }
1760
- }, __name(_a5, "SheetsHyperLinkRenderController"), _a5);
1761
- SheetsHyperLinkRenderController = __decorateClass$8([
1762
- __decorateParam$8(1, Inject(HyperLinkModel)),
1763
- __decorateParam$8(2, Inject(SheetSkeletonManagerService)),
1764
- __decorateParam$8(3, IRenderManagerService)
1765
- ], SheetsHyperLinkRenderController);
1766
- var _a6;
1767
- let SheetsHyperLinkRenderManagerController = (_a6 = class extends Disposable {
1768
- constructor(_sheetInterceptorService, _hyperLinkModel, _themeService) {
1769
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._themeService = _themeService, this._initViewModelIntercept();
1830
+ let SheetsHyperLinkPermissionController = (_a5 = class extends Disposable {
1831
+ constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
1832
+ super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
1770
1833
  }
1771
- _initViewModelIntercept() {
1834
+ _commandExecutedListener() {
1772
1835
  this.disposeWithMe(
1773
- this._sheetInterceptorService.intercept(
1774
- INTERCEPTOR_POINT.CELL_CONTENT,
1775
- {
1776
- effect: InterceptorEffectEnum.Value,
1777
- priority: 100,
1778
- handler: /* @__PURE__ */ __name((cell, pos, next) => {
1779
- const { row, col, unitId, subUnitId } = pos, link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1780
- return next(link ? {
1781
- ...cell,
1782
- linkUrl: link.payload,
1783
- linkId: link.id
1784
- } : cell);
1785
- }, "handler")
1786
- }
1787
- )
1836
+ this._commandService.beforeCommandExecuted((command) => {
1837
+ command.id === InsertLinkShortcut.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1838
+ workbookTypes: [WorkbookEditablePermission],
1839
+ rangeTypes: [RangeProtectionPermissionEditPoint],
1840
+ worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission]
1841
+ }) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
1842
+ })
1788
1843
  );
1789
1844
  }
1790
- }, __name(_a6, "SheetsHyperLinkRenderManagerController"), _a6);
1791
- SheetsHyperLinkRenderManagerController = __decorateClass$8([
1792
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRenderManagerController),
1793
- __decorateParam$8(0, Inject(SheetInterceptorService)),
1794
- __decorateParam$8(1, Inject(HyperLinkModel)),
1795
- __decorateParam$8(2, Inject(ThemeService))
1796
- ], SheetsHyperLinkRenderManagerController);
1845
+ }, __name(_a5, "SheetsHyperLinkPermissionController"), _a5);
1846
+ SheetsHyperLinkPermissionController = __decorateClass$8([
1847
+ __decorateParam$8(0, Inject(LocaleService)),
1848
+ __decorateParam$8(1, ICommandService),
1849
+ __decorateParam$8(2, Inject(SheetPermissionInterceptorBaseController))
1850
+ ], SheetsHyperLinkPermissionController);
1797
1851
  var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1798
1852
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1799
1853
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1800
1854
  return kind && result && __defProp$7(target, key, result), result;
1801
- }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a7;
1802
- let SheetHyperLinkSetRangeController = (_a7 = class extends Disposable {
1803
- constructor(_sheetInterceptorService, _hyperLinkModel, _selectionManagerService, _univerInstanceService, _editorBridgeService, _renderManagerService) {
1804
- super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._univerInstanceService = _univerInstanceService, this._editorBridgeService = _editorBridgeService, this._renderManagerService = _renderManagerService, this._initCommandInterceptor(), this._initAfterEditor();
1855
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a6;
1856
+ let SheetsHyperLinkPopupController = (_a6 = class extends Disposable {
1857
+ constructor(_hoverManagerService, _sheetsHyperLinkPopupService, _renderManagerService, _permissionService, _sheetPermissionInterceptorBaseController, _commandService, _editorBridgeService, _textSelectionManagerService, _univerInstanceService, _zenZoneService) {
1858
+ super(), this._hoverManagerService = _hoverManagerService, this._sheetsHyperLinkPopupService = _sheetsHyperLinkPopupService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandService = _commandService, this._editorBridgeService = _editorBridgeService, this._textSelectionManagerService = _textSelectionManagerService, this._univerInstanceService = _univerInstanceService, this._zenZoneService = _zenZoneService, this._initHoverListener(), this._initCommandListener(), this._initHoverEditingListener(), this._initTextSelectionListener(), this._initZenEditor();
1805
1859
  }
1806
- _initCommandInterceptor() {
1807
- this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
1860
+ _getLinkPermission(location2) {
1861
+ const { unitId, subUnitId, row: currentRow, col: currentCol } = location2, workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
1862
+ if (!(workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId)))
1863
+ return {
1864
+ viewPermission: !1,
1865
+ editPermission: !1,
1866
+ copyPermission: !1
1867
+ };
1868
+ const viewPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1869
+ workbookTypes: [WorkbookViewPermission],
1870
+ worksheetTypes: [WorksheetViewPermission],
1871
+ rangeTypes: [RangeProtectionPermissionViewPoint]
1872
+ }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), editPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1873
+ workbookTypes: [WorkbookEditablePermission],
1874
+ worksheetTypes: [WorksheetEditPermission, WorksheetInsertHyperlinkPermission],
1875
+ rangeTypes: [RangeProtectionPermissionEditPoint]
1876
+ }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), copyPermission = this._permissionService.composePermission([new WorkbookCopyPermission(unitId).id, new WorksheetCopyPermission(unitId, subUnitId).id]).every((permission) => permission.value);
1877
+ return {
1878
+ viewPermission,
1879
+ editPermission,
1880
+ copyPermission
1881
+ };
1808
1882
  }
1809
- _initSetRangeValuesCommandInterceptor() {
1810
- this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
1811
- getMutations: /* @__PURE__ */ __name((command) => {
1812
- if (command.id === SetRangeValuesCommand.id) {
1813
- const params = command.params, { unitId, subUnitId } = params, redos = [], undos = [];
1814
- return params.cellValue && new ObjectMatrix(params.cellValue).forValue((row, col) => {
1815
- const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1816
- link && (redos.push({
1817
- id: RemoveHyperLinkMutation.id,
1818
- params: {
1819
- unitId,
1820
- subUnitId,
1821
- id: link.id
1822
- }
1823
- }), undos.push({
1824
- id: AddHyperLinkMutation.id,
1825
- params: {
1826
- unitId,
1827
- subUnitId,
1828
- link
1829
- }
1830
- }));
1831
- }), {
1832
- undos,
1833
- redos
1834
- };
1835
- }
1836
- return {
1837
- redos: [],
1838
- undos: []
1839
- };
1840
- }, "getMutations")
1841
- }));
1842
- }
1843
- _initClearSelectionCommandInterceptor() {
1844
- this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
1845
- getMutations: /* @__PURE__ */ __name((command) => {
1846
- if (command.id === ClearSelectionContentCommand.id || command.id === ClearSelectionAllCommand.id || command.id === ClearSelectionFormatCommand.id) {
1847
- const redos = [], undos = [], selection = this._selectionManagerService.getCurrentLastSelection(), target = getSheetCommandTarget(this._univerInstanceService);
1848
- if (selection && target) {
1849
- const { unitId, subUnitId } = target;
1850
- Range.foreach(selection.range, (row, col) => {
1851
- const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
1852
- link && (redos.push({
1853
- id: RemoveHyperLinkMutation.id,
1854
- params: {
1855
- unitId,
1856
- subUnitId,
1857
- id: link.id
1858
- }
1859
- }), undos.push({
1860
- id: AddHyperLinkMutation.id,
1861
- params: {
1862
- unitId,
1863
- subUnitId,
1864
- link
1865
- }
1866
- }));
1867
- });
1868
- }
1869
- return {
1870
- redos,
1871
- undos
1872
- };
1873
- }
1874
- return {
1875
- redos: [],
1876
- undos: []
1877
- };
1878
- }, "getMutations")
1879
- }));
1880
- }
1881
- _initAfterEditor() {
1882
- this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
1883
- handler: /* @__PURE__ */ __name((cell, context, next) => {
1884
- if (!cell || cell.p)
1885
- return next(cell);
1886
- if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
1887
- const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
1888
- if (!skeleton)
1889
- return next(cell);
1890
- const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
1891
- if (!doc.documentModel)
1892
- return next(cell);
1893
- const textX = BuildTextUtils.selection.replace({
1894
- selection: {
1895
- startOffset: 0,
1896
- endOffset: cell.v.length,
1897
- collapsed: !1
1898
- },
1899
- body: {
1900
- dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${cell.v}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
1901
- customRanges: [{
1902
- startIndex: 0,
1903
- endIndex: cell.v.length + 1,
1904
- rangeId: generateRandomId(),
1905
- rangeType: CustomRangeType.HYPERLINK,
1906
- properties: {
1907
- url: cell.v
1908
- }
1909
- }]
1910
- },
1911
- doc: doc.documentModel
1912
- });
1913
- if (!textX)
1914
- return next(cell);
1915
- const body = doc.documentModel.getBody();
1916
- return TextX.apply(body, textX.serialize()), next({
1917
- ...cell,
1918
- p: {
1919
- id: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
1920
- body,
1921
- documentStyle: {
1922
- pageSize: {
1923
- width: 1 / 0,
1924
- height: 1 / 0
1925
- }
1926
- }
1927
- }
1928
- });
1929
- }
1930
- return next(cell);
1931
- }, "handler")
1932
- }));
1933
- }
1934
- }, __name(_a7, "SheetHyperLinkSetRangeController"), _a7);
1935
- SheetHyperLinkSetRangeController = __decorateClass$7([
1936
- OnLifecycle(LifecycleStages.Starting, SheetHyperLinkSetRangeController),
1937
- __decorateParam$7(0, Inject(SheetInterceptorService)),
1938
- __decorateParam$7(1, Inject(HyperLinkModel)),
1939
- __decorateParam$7(2, Inject(SheetsSelectionsService)),
1940
- __decorateParam$7(3, IUniverInstanceService),
1941
- __decorateParam$7(4, IEditorBridgeService),
1942
- __decorateParam$7(5, IRenderManagerService)
1943
- ], SheetHyperLinkSetRangeController);
1944
- var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
1945
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
1946
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
1947
- return kind && result && __defProp$6(target, key, result), result;
1948
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a8;
1949
- let SheetsHyperLinkPopupController = (_a8 = class extends Disposable {
1950
- constructor(_hoverManagerService, _sheetsHyperLinkPopupService, _renderManagerService, _permissionService, _sheetPermissionInterceptorBaseController, _commandService, _editorBridgeService, _textSelectionManagerService, _univerInstanceService, _zenZoneService) {
1951
- super(), this._hoverManagerService = _hoverManagerService, this._sheetsHyperLinkPopupService = _sheetsHyperLinkPopupService, this._renderManagerService = _renderManagerService, this._permissionService = _permissionService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandService = _commandService, this._editorBridgeService = _editorBridgeService, this._textSelectionManagerService = _textSelectionManagerService, this._univerInstanceService = _univerInstanceService, this._zenZoneService = _zenZoneService, this._initHoverListener(), this._initCommandListener(), this._initHoverEditingListener(), this._initTextSelectionListener(), this._initZenEditor();
1952
- }
1953
- _getLinkPermission(location2) {
1954
- const { unitId, subUnitId, row: currentRow, col: currentCol } = location2, workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
1955
- if (!(workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId)))
1956
- return {
1957
- viewPermission: !1,
1958
- editPermission: !1,
1959
- copyPermission: !1
1960
- };
1961
- const viewPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1962
- workbookTypes: [WorkbookViewPermission],
1963
- worksheetTypes: [WorksheetViewPermission],
1964
- rangeTypes: [RangeProtectionPermissionViewPoint]
1965
- }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), editPermission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
1966
- workbookTypes: [WorkbookEditablePermission],
1967
- worksheetTypes: [WorksheetEditPermission, WorksheetInsertHyperlinkPermission],
1968
- rangeTypes: [RangeProtectionPermissionEditPoint]
1969
- }, [{ startRow: currentRow, startColumn: currentCol, endRow: currentRow, endColumn: currentCol }]), copyPermission = this._permissionService.composePermission([new WorkbookCopyPermission(unitId).id, new WorksheetCopyPermission(unitId, subUnitId).id]).every((permission) => permission.value);
1970
- return {
1971
- viewPermission,
1972
- editPermission,
1973
- copyPermission
1974
- };
1975
- }
1976
- _initHoverListener() {
1977
- this.disposeWithMe(
1978
- // hover over not editing cell
1979
- this._hoverManagerService.currentRichText$.pipe(debounceTime(200)).subscribe((currentCell) => {
1980
- var _a15;
1981
- if (!currentCell) {
1982
- this._sheetsHyperLinkPopupService.hideCurrentPopup();
1983
- return;
1883
+ _initHoverListener() {
1884
+ this.disposeWithMe(
1885
+ // hover over not editing cell
1886
+ this._hoverManagerService.currentRichText$.pipe(debounceTime(200)).subscribe((currentCell) => {
1887
+ var _a15;
1888
+ if (!currentCell) {
1889
+ this._sheetsHyperLinkPopupService.hideCurrentPopup();
1890
+ return;
1984
1891
  }
1985
1892
  const { unitId, subUnitId, row, col } = currentCell, renderer = this._renderManagerService.getRenderById(unitId);
1986
1893
  if (!renderer)
@@ -2105,242 +2012,125 @@ let SheetsHyperLinkPopupController = (_a8 = class extends Disposable {
2105
2012
  HIDE_COMMAND_LIST.includes(command.id) && this._sheetsHyperLinkPopupService.hideCurrentPopup();
2106
2013
  }));
2107
2014
  }
2108
- }, __name(_a8, "SheetsHyperLinkPopupController"), _a8);
2109
- SheetsHyperLinkPopupController = __decorateClass$6([
2110
- OnLifecycle(LifecycleStages.Rendered, SheetsHyperLinkPopupController),
2111
- __decorateParam$6(0, Inject(HoverManagerService)),
2112
- __decorateParam$6(1, Inject(SheetsHyperLinkPopupService)),
2113
- __decorateParam$6(2, Inject(IRenderManagerService)),
2114
- __decorateParam$6(3, Inject(IPermissionService)),
2115
- __decorateParam$6(4, Inject(SheetPermissionInterceptorBaseController)),
2116
- __decorateParam$6(5, ICommandService),
2117
- __decorateParam$6(6, IEditorBridgeService),
2118
- __decorateParam$6(7, Inject(DocSelectionManagerService)),
2119
- __decorateParam$6(8, IUniverInstanceService),
2120
- __decorateParam$6(9, IZenZoneService)
2015
+ }, __name(_a6, "SheetsHyperLinkPopupController"), _a6);
2016
+ SheetsHyperLinkPopupController = __decorateClass$7([
2017
+ __decorateParam$7(0, Inject(HoverManagerService)),
2018
+ __decorateParam$7(1, Inject(SheetsHyperLinkPopupService)),
2019
+ __decorateParam$7(2, Inject(IRenderManagerService)),
2020
+ __decorateParam$7(3, Inject(IPermissionService)),
2021
+ __decorateParam$7(4, Inject(SheetPermissionInterceptorBaseController)),
2022
+ __decorateParam$7(5, ICommandService),
2023
+ __decorateParam$7(6, IEditorBridgeService),
2024
+ __decorateParam$7(7, Inject(DocSelectionManagerService)),
2025
+ __decorateParam$7(8, IUniverInstanceService),
2026
+ __decorateParam$7(9, IZenZoneService)
2121
2027
  ], SheetsHyperLinkPopupController);
2122
- const menuSchema = {
2123
- [RibbonStartGroup.OTHERS]: {
2124
- [InsertHyperLinkToolbarOperation.id]: {
2125
- order: 2,
2126
- menuItemFactory: insertLinkMenuToolbarFactory
2127
- },
2128
- [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2129
- order: 2,
2130
- menuItemFactory: zenEditorInsertLinkMenuToolbarFactory
2131
- }
2132
- },
2133
- [ContextMenuPosition.MAIN_AREA]: {
2134
- [ContextMenuGroup.OTHERS]: {
2135
- order: 1,
2136
- [InsertHyperLinkToolbarOperation.id]: {
2137
- order: 0,
2138
- menuItemFactory: insertLinkMenuFactory
2139
- },
2140
- [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2141
- order: 0,
2142
- menuItemFactory: zenEditorInsertLinkMenuFactory
2143
- }
2144
- }
2145
- }
2146
- };
2147
- var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2148
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2149
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2150
- return kind && result && __defProp$5(target, key, result), result;
2151
- }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a9;
2152
- let SheetsHyperLinkUIController = (_a9 = class extends Disposable {
2153
- constructor(_componentManager, _commandService, _menuManagerService, _injector, _shortcutService) {
2154
- super(), this._componentManager = _componentManager, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._injector = _injector, this._shortcutService = _shortcutService, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
2155
- }
2156
- _initComponents() {
2157
- [
2158
- [CellLinkPopup, CellLinkPopup.componentKey],
2159
- [CellLinkEdit, CellLinkEdit.componentKey],
2160
- [LinkSingle, "LinkSingle"]
2161
- ].forEach(([comp, key]) => {
2162
- this._componentManager.register(key, comp);
2163
- });
2164
- }
2165
- _initCommands() {
2166
- [
2167
- OpenHyperLinkEditPanelOperation,
2168
- CloseHyperLinkPopupOperation,
2169
- InsertHyperLinkOperation,
2170
- InsertHyperLinkToolbarOperation,
2171
- AddHyperLinkCommand,
2172
- UpdateHyperLinkCommand,
2173
- CancelHyperLinkCommand,
2174
- UpdateRichHyperLinkCommand,
2175
- CancelRichHyperLinkCommand,
2176
- AddRichHyperLinkCommand
2177
- ].forEach((command) => {
2178
- this._commandService.registerCommand(command);
2179
- });
2180
- }
2181
- _initMenus() {
2182
- this._menuManagerService.mergeMenu(menuSchema);
2183
- }
2184
- _initShortCut() {
2185
- this._shortcutService.registerShortcut(InsertLinkShortcut);
2186
- }
2187
- }, __name(_a9, "SheetsHyperLinkUIController"), _a9);
2188
- SheetsHyperLinkUIController = __decorateClass$5([
2189
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkUIController),
2190
- __decorateParam$5(0, Inject(ComponentManager)),
2191
- __decorateParam$5(1, ICommandService),
2192
- __decorateParam$5(2, IMenuManagerService),
2193
- __decorateParam$5(3, Inject(Injector)),
2194
- __decorateParam$5(4, Inject(IShortcutService))
2195
- ], SheetsHyperLinkUIController);
2196
- var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2197
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2028
+ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2029
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2198
2030
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2199
- return kind && result && __defProp$4(target, key, result), result;
2200
- }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a10;
2201
- let SheetsHyperLinkAutoFillController = (_a10 = class extends Disposable {
2202
- constructor(_autoFillService, _hyperLinkModel) {
2203
- super(), this._autoFillService = _autoFillService, this._hyperLinkModel = _hyperLinkModel, this._initAutoFill();
2031
+ return kind && result && __defProp$6(target, key, result), result;
2032
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a7;
2033
+ let SheetsHyperLinkRemoveSheetController = (_a7 = class extends Disposable {
2034
+ constructor(_sheetInterceptorService, _univerInstanceService, _hyperLinkModel) {
2035
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._hyperLinkModel = _hyperLinkModel, this._initSheetChange();
2204
2036
  }
2205
- // eslint-disable-next-line max-lines-per-function
2206
- _initAutoFill() {
2207
- const noopReturnFunc = /* @__PURE__ */ __name(() => ({ redos: [], undos: [] }), "noopReturnFunc"), generalApplyFunc = /* @__PURE__ */ __name((location2, applyType) => {
2208
- const { source: sourceRange, target: targetRange, unitId, subUnitId } = location2, virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]), [vSourceRange, vTargetRange] = virtualRange.ranges, { mapFunc } = virtualRange, sourceStartCell = {
2209
- row: vSourceRange.startRow,
2210
- col: vSourceRange.startColumn
2211
- }, repeats = getAutoFillRepeatRange(vSourceRange, vTargetRange), redos = [], undos = [];
2212
- return repeats.forEach((repeat) => {
2213
- const targetStartCell = repeat.repeatStartCell, relativeRange = repeat.relativeRange, sourceRange2 = {
2214
- startRow: sourceStartCell.row,
2215
- startColumn: sourceStartCell.col,
2216
- endColumn: sourceStartCell.col,
2217
- endRow: sourceStartCell.row
2218
- }, targetRange2 = {
2219
- startRow: targetStartCell.row,
2220
- startColumn: targetStartCell.col,
2221
- endColumn: targetStartCell.col,
2222
- endRow: targetStartCell.row
2223
- };
2224
- Range.foreach(relativeRange, (row, col) => {
2225
- const sourcePositionRange = Rectangle.getPositionRange(
2226
- {
2227
- startRow: row,
2228
- startColumn: col,
2229
- endColumn: col,
2230
- endRow: row
2231
- },
2232
- sourceRange2
2233
- ), { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn), link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, sourceRow, sourceCol), targetPositionRange = Rectangle.getPositionRange(
2234
- {
2235
- startRow: row,
2236
- startColumn: col,
2237
- endColumn: col,
2238
- endRow: row
2239
- },
2240
- targetRange2
2241
- ), { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn), id = Tools.generateRandomId(), currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
2242
- currentLink && redos.push({
2243
- id: RemoveHyperLinkMutation.id,
2244
- params: {
2245
- unitId,
2246
- subUnitId,
2247
- id: currentLink.id
2248
- }
2249
- }), (APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) && link && (redos.push({
2250
- id: AddHyperLinkMutation.id,
2251
- params: {
2252
- unitId,
2253
- subUnitId,
2254
- link: {
2255
- ...link,
2256
- id,
2257
- row: targetRow,
2258
- column: targetCol
2037
+ _initSheetChange() {
2038
+ this.disposeWithMe(
2039
+ this._sheetInterceptorService.interceptCommand({
2040
+ getMutations: /* @__PURE__ */ __name((commandInfo) => {
2041
+ var _a15;
2042
+ if (commandInfo.id === RemoveSheetCommand.id) {
2043
+ const params = commandInfo.params, workbook = params.unitId ? this._univerInstanceService.getUnit(params.unitId) : this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
2044
+ if (!workbook)
2045
+ return { redos: [], undos: [] };
2046
+ const unitId = workbook.getUnitId(), subUnitId = params.subUnitId || ((_a15 = workbook.getActiveSheet()) == null ? void 0 : _a15.getSheetId());
2047
+ if (!subUnitId)
2048
+ return { redos: [], undos: [] };
2049
+ const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId), redos = links.map((link) => ({
2050
+ id: RemoveHyperLinkMutation.id,
2051
+ params: {
2052
+ unitId,
2053
+ subUnitId,
2054
+ id: link.id
2259
2055
  }
2260
- }
2261
- }), undos.push({
2262
- id: RemoveHyperLinkMutation.id,
2263
- params: {
2264
- unitId,
2265
- subUnitId,
2266
- id
2267
- }
2268
- })), currentLink && undos.push({
2269
- id: AddHyperLinkMutation.id,
2270
- params: {
2271
- unitId,
2272
- subUnitId,
2273
- link: currentLink
2274
- }
2275
- });
2276
- });
2277
- }), {
2278
- undos,
2279
- redos
2280
- };
2281
- }, "generalApplyFunc"), hook = {
2282
- id: SHEET_HYPER_LINK_UI_PLUGIN,
2283
- onFillData: /* @__PURE__ */ __name((location2, direction, applyType) => applyType === APPLY_TYPE.COPY || applyType === APPLY_TYPE.ONLY_FORMAT || applyType === APPLY_TYPE.SERIES ? generalApplyFunc(location2, applyType) : noopReturnFunc(), "onFillData")
2284
- };
2285
- this.disposeWithMe(this._autoFillService.addHook(hook));
2056
+ })), undos = links.map((link) => ({
2057
+ id: AddHyperLinkMutation.id,
2058
+ params: {
2059
+ unitId,
2060
+ subUnitId,
2061
+ link
2062
+ }
2063
+ }));
2064
+ return { redos, undos };
2065
+ }
2066
+ return { redos: [], undos: [] };
2067
+ }, "getMutations")
2068
+ })
2069
+ );
2286
2070
  }
2287
- }, __name(_a10, "SheetsHyperLinkAutoFillController"), _a10);
2288
- SheetsHyperLinkAutoFillController = __decorateClass$4([
2289
- OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkAutoFillController),
2290
- __decorateParam$4(0, IAutoFillService),
2291
- __decorateParam$4(1, Inject(HyperLinkModel))
2292
- ], SheetsHyperLinkAutoFillController);
2293
- var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2294
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2071
+ }, __name(_a7, "SheetsHyperLinkRemoveSheetController"), _a7);
2072
+ SheetsHyperLinkRemoveSheetController = __decorateClass$6([
2073
+ __decorateParam$6(0, Inject(SheetInterceptorService)),
2074
+ __decorateParam$6(1, IUniverInstanceService),
2075
+ __decorateParam$6(2, Inject(HyperLinkModel))
2076
+ ], SheetsHyperLinkRemoveSheetController);
2077
+ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2078
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2295
2079
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2296
- return kind && result && __defProp$3(target, key, result), result;
2297
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a11;
2298
- let SheetHyperLinkUrlController = (_a11 = class extends Disposable {
2299
- constructor(_resolverService) {
2300
- super(), this._resolverService = _resolverService, this._handleInitUrl();
2301
- }
2302
- _handleInitUrl() {
2303
- const hash = location.hash;
2304
- hash && this._resolverService.parseHyperLink(hash).handler();
2080
+ return kind && result && __defProp$5(target, key, result), result;
2081
+ }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a8;
2082
+ let SheetsHyperLinkRenderController = (_a8 = class extends Disposable {
2083
+ constructor(_context, _hyperLinkModel) {
2084
+ super(), this._context = _context, this._hyperLinkModel = _hyperLinkModel, this._initSkeletonChange();
2305
2085
  }
2306
- }, __name(_a11, "SheetHyperLinkUrlController"), _a11);
2307
- SheetHyperLinkUrlController = __decorateClass$3([
2308
- OnLifecycle(LifecycleStages.Rendered, SheetHyperLinkUrlController),
2309
- __decorateParam$3(0, Inject(SheetsHyperLinkResolverService))
2310
- ], SheetHyperLinkUrlController);
2311
- var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2312
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2313
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2314
- return kind && result && __defProp$2(target, key, result), result;
2315
- }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a12;
2316
- let SheetsHyperLinkPermissionController = (_a12 = class extends Disposable {
2317
- constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
2318
- super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
2086
+ _initSkeletonChange() {
2087
+ const markSkeletonDirty = /* @__PURE__ */ __name(() => {
2088
+ var _a15;
2089
+ (_a15 = this._context.mainComponent) == null || _a15.makeForceDirty();
2090
+ }, "markSkeletonDirty");
2091
+ this.disposeWithMe(this._hyperLinkModel.linkUpdate$.pipe(debounceTime(16)).subscribe(() => {
2092
+ markSkeletonDirty();
2093
+ }));
2319
2094
  }
2320
- _commandExecutedListener() {
2095
+ }, __name(_a8, "SheetsHyperLinkRenderController"), _a8);
2096
+ SheetsHyperLinkRenderController = __decorateClass$5([
2097
+ __decorateParam$5(1, Inject(HyperLinkModel))
2098
+ ], SheetsHyperLinkRenderController);
2099
+ var _a9;
2100
+ let SheetsHyperLinkRenderManagerController = (_a9 = class extends Disposable {
2101
+ constructor(_sheetInterceptorService, _hyperLinkModel) {
2102
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._initViewModelIntercept();
2103
+ }
2104
+ _initViewModelIntercept() {
2321
2105
  this.disposeWithMe(
2322
- this._commandService.beforeCommandExecuted((command) => {
2323
- command.id === InsertLinkShortcut.id && (this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
2324
- workbookTypes: [WorkbookEditablePermission],
2325
- rangeTypes: [RangeProtectionPermissionEditPoint],
2326
- worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission]
2327
- }) || this._sheetPermissionInterceptorBaseController.haveNotPermissionHandle(this._localeService.t("permission.dialog.hyperLinkErr")));
2328
- })
2106
+ this._sheetInterceptorService.intercept(
2107
+ INTERCEPTOR_POINT.CELL_CONTENT,
2108
+ {
2109
+ effect: InterceptorEffectEnum.Value,
2110
+ priority: 100,
2111
+ handler: /* @__PURE__ */ __name((cell, pos, next) => {
2112
+ const { row, col, unitId, subUnitId } = pos, link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
2113
+ return next(link ? {
2114
+ ...cell,
2115
+ linkUrl: link.payload,
2116
+ linkId: link.id
2117
+ } : cell);
2118
+ }, "handler")
2119
+ }
2120
+ )
2329
2121
  );
2330
2122
  }
2331
- }, __name(_a12, "SheetsHyperLinkPermissionController"), _a12);
2332
- SheetsHyperLinkPermissionController = __decorateClass$2([
2333
- OnLifecycle(LifecycleStages.Rendered, SheetsHyperLinkPermissionController),
2334
- __decorateParam$2(0, Inject(LocaleService)),
2335
- __decorateParam$2(1, ICommandService),
2336
- __decorateParam$2(2, Inject(SheetPermissionInterceptorBaseController))
2337
- ], SheetsHyperLinkPermissionController);
2338
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2339
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2123
+ }, __name(_a9, "SheetsHyperLinkRenderManagerController"), _a9);
2124
+ SheetsHyperLinkRenderManagerController = __decorateClass$5([
2125
+ __decorateParam$5(0, Inject(SheetInterceptorService)),
2126
+ __decorateParam$5(1, Inject(HyperLinkModel))
2127
+ ], SheetsHyperLinkRenderManagerController);
2128
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2129
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2340
2130
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2341
- return kind && result && __defProp$1(target, key, result), result;
2342
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a13;
2343
- let SheetsHyperLinkRichTextRefRangeController = (_a13 = class extends Disposable {
2131
+ return kind && result && __defProp$4(target, key, result), result;
2132
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a10;
2133
+ let SheetsHyperLinkRichTextRefRangeController = (_a10 = class extends Disposable {
2344
2134
  constructor(_commandService, _univerInstanceService, _refRangeService) {
2345
2135
  super();
2346
2136
  __publicField(this, "_refRangeMap", /* @__PURE__ */ new Map());
@@ -2485,21 +2275,256 @@ let SheetsHyperLinkRichTextRefRangeController = (_a13 = class extends Disposable
2485
2275
  })
2486
2276
  );
2487
2277
  }
2488
- }, __name(_a13, "SheetsHyperLinkRichTextRefRangeController"), _a13);
2489
- SheetsHyperLinkRichTextRefRangeController = __decorateClass$1([
2490
- OnLifecycle(LifecycleStages.Starting, SheetsHyperLinkRichTextRefRangeController),
2491
- __decorateParam$1(0, ICommandService),
2492
- __decorateParam$1(1, IUniverInstanceService),
2493
- __decorateParam$1(2, Inject(RefRangeService))
2278
+ }, __name(_a10, "SheetsHyperLinkRichTextRefRangeController"), _a10);
2279
+ SheetsHyperLinkRichTextRefRangeController = __decorateClass$4([
2280
+ __decorateParam$4(0, ICommandService),
2281
+ __decorateParam$4(1, IUniverInstanceService),
2282
+ __decorateParam$4(2, Inject(RefRangeService))
2494
2283
  ], SheetsHyperLinkRichTextRefRangeController);
2284
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2285
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2286
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2287
+ return kind && result && __defProp$3(target, key, result), result;
2288
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a11;
2289
+ let SheetHyperLinkSetRangeController = (_a11 = class extends Disposable {
2290
+ constructor(_sheetInterceptorService, _hyperLinkModel, _selectionManagerService, _univerInstanceService, _editorBridgeService, _renderManagerService) {
2291
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._hyperLinkModel = _hyperLinkModel, this._selectionManagerService = _selectionManagerService, this._univerInstanceService = _univerInstanceService, this._editorBridgeService = _editorBridgeService, this._renderManagerService = _renderManagerService, this._initCommandInterceptor(), this._initAfterEditor();
2292
+ }
2293
+ _initCommandInterceptor() {
2294
+ this._initSetRangeValuesCommandInterceptor(), this._initClearSelectionCommandInterceptor();
2295
+ }
2296
+ _initSetRangeValuesCommandInterceptor() {
2297
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
2298
+ getMutations: /* @__PURE__ */ __name((command) => {
2299
+ if (command.id === SetRangeValuesCommand.id) {
2300
+ const params = command.params, { unitId, subUnitId } = params, redos = [], undos = [];
2301
+ return params.cellValue && new ObjectMatrix(params.cellValue).forValue((row, col) => {
2302
+ const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
2303
+ link && (redos.push({
2304
+ id: RemoveHyperLinkMutation.id,
2305
+ params: {
2306
+ unitId,
2307
+ subUnitId,
2308
+ id: link.id
2309
+ }
2310
+ }), undos.push({
2311
+ id: AddHyperLinkMutation.id,
2312
+ params: {
2313
+ unitId,
2314
+ subUnitId,
2315
+ link
2316
+ }
2317
+ }));
2318
+ }), {
2319
+ undos,
2320
+ redos
2321
+ };
2322
+ }
2323
+ return {
2324
+ redos: [],
2325
+ undos: []
2326
+ };
2327
+ }, "getMutations")
2328
+ }));
2329
+ }
2330
+ _initClearSelectionCommandInterceptor() {
2331
+ this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
2332
+ getMutations: /* @__PURE__ */ __name((command) => {
2333
+ if (command.id === ClearSelectionContentCommand.id || command.id === ClearSelectionAllCommand.id || command.id === ClearSelectionFormatCommand.id) {
2334
+ const redos = [], undos = [], selection = this._selectionManagerService.getCurrentLastSelection(), target = getSheetCommandTarget(this._univerInstanceService);
2335
+ if (selection && target) {
2336
+ const { unitId, subUnitId } = target;
2337
+ Range.foreach(selection.range, (row, col) => {
2338
+ const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, col);
2339
+ link && (redos.push({
2340
+ id: RemoveHyperLinkMutation.id,
2341
+ params: {
2342
+ unitId,
2343
+ subUnitId,
2344
+ id: link.id
2345
+ }
2346
+ }), undos.push({
2347
+ id: AddHyperLinkMutation.id,
2348
+ params: {
2349
+ unitId,
2350
+ subUnitId,
2351
+ link
2352
+ }
2353
+ }));
2354
+ });
2355
+ }
2356
+ return {
2357
+ redos,
2358
+ undos
2359
+ };
2360
+ }
2361
+ return {
2362
+ redos: [],
2363
+ undos: []
2364
+ };
2365
+ }, "getMutations")
2366
+ }));
2367
+ }
2368
+ _initAfterEditor() {
2369
+ this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
2370
+ handler: /* @__PURE__ */ __name((cell, context, next) => {
2371
+ if (!cell || cell.p)
2372
+ return next(cell);
2373
+ if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
2374
+ const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
2375
+ if (!skeleton)
2376
+ return next(cell);
2377
+ const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
2378
+ if (!doc.documentModel)
2379
+ return next(cell);
2380
+ const textX = BuildTextUtils.selection.replace({
2381
+ selection: {
2382
+ startOffset: 0,
2383
+ endOffset: cell.v.length,
2384
+ collapsed: !1
2385
+ },
2386
+ body: {
2387
+ dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${cell.v}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
2388
+ customRanges: [{
2389
+ startIndex: 0,
2390
+ endIndex: cell.v.length + 1,
2391
+ rangeId: generateRandomId(),
2392
+ rangeType: CustomRangeType.HYPERLINK,
2393
+ properties: {
2394
+ url: cell.v
2395
+ }
2396
+ }]
2397
+ },
2398
+ doc: doc.documentModel
2399
+ });
2400
+ if (!textX)
2401
+ return next(cell);
2402
+ const body = doc.documentModel.getBody();
2403
+ return TextX.apply(body, textX.serialize()), next({
2404
+ ...cell,
2405
+ p: {
2406
+ id: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
2407
+ body,
2408
+ documentStyle: {
2409
+ pageSize: {
2410
+ width: 1 / 0,
2411
+ height: 1 / 0
2412
+ }
2413
+ }
2414
+ }
2415
+ });
2416
+ }
2417
+ return next(cell);
2418
+ }, "handler")
2419
+ }));
2420
+ }
2421
+ }, __name(_a11, "SheetHyperLinkSetRangeController"), _a11);
2422
+ SheetHyperLinkSetRangeController = __decorateClass$3([
2423
+ __decorateParam$3(0, Inject(SheetInterceptorService)),
2424
+ __decorateParam$3(1, Inject(HyperLinkModel)),
2425
+ __decorateParam$3(2, Inject(SheetsSelectionsService)),
2426
+ __decorateParam$3(3, IUniverInstanceService),
2427
+ __decorateParam$3(4, IEditorBridgeService),
2428
+ __decorateParam$3(5, IRenderManagerService)
2429
+ ], SheetHyperLinkSetRangeController);
2430
+ const menuSchema = {
2431
+ [RibbonStartGroup.OTHERS]: {
2432
+ [InsertHyperLinkToolbarOperation.id]: {
2433
+ order: 2,
2434
+ menuItemFactory: insertLinkMenuToolbarFactory
2435
+ },
2436
+ [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2437
+ order: 2,
2438
+ menuItemFactory: zenEditorInsertLinkMenuToolbarFactory
2439
+ }
2440
+ },
2441
+ [ContextMenuPosition.MAIN_AREA]: {
2442
+ [ContextMenuGroup.OTHERS]: {
2443
+ order: 1,
2444
+ [InsertHyperLinkToolbarOperation.id]: {
2445
+ order: 0,
2446
+ menuItemFactory: insertLinkMenuFactory
2447
+ },
2448
+ [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {
2449
+ order: 0,
2450
+ menuItemFactory: zenEditorInsertLinkMenuFactory
2451
+ }
2452
+ }
2453
+ }
2454
+ };
2455
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2456
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2457
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2458
+ return kind && result && __defProp$2(target, key, result), result;
2459
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a12;
2460
+ let SheetsHyperLinkUIController = (_a12 = class extends Disposable {
2461
+ constructor(_componentManager, _commandService, _menuManagerService, _injector, _shortcutService) {
2462
+ super(), this._componentManager = _componentManager, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._injector = _injector, this._shortcutService = _shortcutService, this._initComponents(), this._initCommands(), this._initMenus(), this._initShortCut();
2463
+ }
2464
+ _initComponents() {
2465
+ [
2466
+ [CellLinkPopup, CellLinkPopup.componentKey],
2467
+ [CellLinkEdit, CellLinkEdit.componentKey],
2468
+ [LinkSingle, "LinkSingle"]
2469
+ ].forEach(([comp, key]) => {
2470
+ this._componentManager.register(key, comp);
2471
+ });
2472
+ }
2473
+ _initCommands() {
2474
+ [
2475
+ OpenHyperLinkEditPanelOperation,
2476
+ CloseHyperLinkPopupOperation,
2477
+ InsertHyperLinkOperation,
2478
+ InsertHyperLinkToolbarOperation,
2479
+ AddHyperLinkCommand,
2480
+ UpdateHyperLinkCommand,
2481
+ CancelHyperLinkCommand,
2482
+ UpdateRichHyperLinkCommand,
2483
+ CancelRichHyperLinkCommand,
2484
+ AddRichHyperLinkCommand
2485
+ ].forEach((command) => {
2486
+ this._commandService.registerCommand(command);
2487
+ });
2488
+ }
2489
+ _initMenus() {
2490
+ this._menuManagerService.mergeMenu(menuSchema);
2491
+ }
2492
+ _initShortCut() {
2493
+ this._shortcutService.registerShortcut(InsertLinkShortcut);
2494
+ }
2495
+ }, __name(_a12, "SheetsHyperLinkUIController"), _a12);
2496
+ SheetsHyperLinkUIController = __decorateClass$2([
2497
+ __decorateParam$2(0, Inject(ComponentManager)),
2498
+ __decorateParam$2(1, ICommandService),
2499
+ __decorateParam$2(2, IMenuManagerService),
2500
+ __decorateParam$2(3, Inject(Injector)),
2501
+ __decorateParam$2(4, Inject(IShortcutService))
2502
+ ], SheetsHyperLinkUIController);
2503
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2504
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2505
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2506
+ return kind && result && __defProp$1(target, key, result), result;
2507
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a13;
2508
+ let SheetHyperLinkUrlController = (_a13 = class extends Disposable {
2509
+ constructor(_resolverService) {
2510
+ super(), this._resolverService = _resolverService, this._handleInitUrl();
2511
+ }
2512
+ _handleInitUrl() {
2513
+ const hash = location.hash;
2514
+ hash && this._resolverService.parseHyperLink(hash).handler();
2515
+ }
2516
+ }, __name(_a13, "SheetHyperLinkUrlController"), _a13);
2517
+ SheetHyperLinkUrlController = __decorateClass$1([
2518
+ __decorateParam$1(0, Inject(SheetsHyperLinkResolverService))
2519
+ ], SheetHyperLinkUrlController);
2495
2520
  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) => {
2496
2521
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2497
2522
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2498
2523
  return kind && result && __defProp2(target, key, result), result;
2499
2524
  }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a14;
2500
2525
  let UniverSheetsHyperLinkUIPlugin = (_a14 = class extends Plugin {
2501
- constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _configService) {
2502
- super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._configService = _configService;
2526
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
2527
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
2503
2528
  const { menu, ...rest } = this._config;
2504
2529
  menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
2505
2530
  }
@@ -2518,12 +2543,13 @@ let UniverSheetsHyperLinkUIPlugin = (_a14 = class extends Plugin {
2518
2543
  [SheetsHyperLinkPermissionController],
2519
2544
  [SheetHyperLinkUrlController],
2520
2545
  [SheetsHyperLinkRichTextRefRangeController]
2521
- ].forEach((dep) => this._injector.add(dep));
2546
+ ].forEach((dep) => this._injector.add(dep)), this._injector.get(SheetsHyperLinkRenderManagerController), this._injector.get(SheetsHyperLinkRichTextRefRangeController), this._injector.get(SheetHyperLinkSetRangeController);
2522
2547
  }
2523
2548
  onReady() {
2524
- [
2525
- [SheetsHyperLinkRenderController]
2526
- ].forEach((d) => this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, d));
2549
+ this._injector.get(IRenderManagerService).registerRenderModule(UniverInstanceType.UNIVER_SHEET, [SheetsHyperLinkRenderController]), this._injector.get(SheetsHyperLinkAutoFillController), this._injector.get(SheetsHyperLinkCopyPasteController), this._injector.get(SheetsHyperLinkRemoveSheetController), this._injector.get(SheetsHyperLinkUIController);
2550
+ }
2551
+ onRendered() {
2552
+ this._injector.get(SheetsHyperLinkPermissionController), this._injector.get(SheetHyperLinkUrlController), this._injector.get(SheetsHyperLinkPopupController);
2527
2553
  }
2528
2554
  }, __name(_a14, "UniverSheetsHyperLinkUIPlugin"), _a14);
2529
2555
  __publicField2(UniverSheetsHyperLinkUIPlugin, "pluginName", SHEET_HYPER_LINK_UI_PLUGIN);
@@ -2531,8 +2557,7 @@ __publicField2(UniverSheetsHyperLinkUIPlugin, "type", UniverInstanceType.UNIVER_
2531
2557
  UniverSheetsHyperLinkUIPlugin = __decorateClass([
2532
2558
  DependentOn(UniverSheetsHyperLinkPlugin, UniverDocsUIPlugin),
2533
2559
  __decorateParam(1, Inject(Injector)),
2534
- __decorateParam(2, IRenderManagerService),
2535
- __decorateParam(3, IConfigService)
2560
+ __decorateParam(2, IConfigService)
2536
2561
  ], UniverSheetsHyperLinkUIPlugin);
2537
2562
  export {
2538
2563
  AddHyperLinkCommand,