@univerjs/sheets-hyper-link-ui 0.4.1-nightly.202410291304 → 0.4.2
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/LICENSE +176 -0
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +443 -37
- package/lib/types/commands/commands/add-hyper-link.command.d.ts +19 -0
- package/lib/types/commands/commands/remove-hyper-link.command.d.ts +19 -0
- package/lib/types/commands/commands/update-hyper-link.command.d.ts +17 -0
- package/lib/types/controllers/url.controller.d.ts +1 -3
- package/lib/types/index.d.ts +4 -0
- package/lib/types/services/resolver.service.d.ts +8 -4
- package/lib/types/types/interfaces/i-sheet-hyper-link-info.d.ts +10 -0
- package/lib/types/{facade/index.d.ts → types/interfaces/i-sheet-url-params.d.ts} +6 -0
- package/lib/types/types/interfaces/index.d.ts +17 -0
- package/lib/umd/index.js +2 -2
- package/package.json +13 -13
- package/lib/types/facade/f-workbook.d.ts +0 -13
package/lib/es/index.js
CHANGED
|
@@ -2,14 +2,14 @@ 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,
|
|
6
|
-
import { SheetHyperLinkType, ERROR_RANGE, HyperLinkModel, RemoveHyperLinkMutation, AddHyperLinkMutation,
|
|
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
|
|
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, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DisposableCollection, FOCUSING_SHEET, sequenceExecute, useObservable as useObservable$1, DataValidationType, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IPermissionService, 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";
|
|
8
8
|
import { MessageType, FormLayout, Input, Select, Button, Tooltip } from "@univerjs/design";
|
|
9
|
-
import { deserializeRangeWithSheet,
|
|
10
|
-
import { SetSelectionsOperation, SetWorksheetActiveOperation, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetInsertHyperlinkPermission, RangeProtectionPermissionEditPoint, WorkbookViewPermission, WorksheetViewPermission, RangeProtectionPermissionViewPoint, WorkbookCopyPermission, WorksheetCopyPermission, ClearSelectionContentCommand, ClearSelectionAllCommand, ClearSelectionFormatCommand, SheetInterceptorService, RemoveSheetCommand, INTERCEPTOR_POINT, RefRangeService,
|
|
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, 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
|
-
import { DocSelectionRenderService, DocBackScrollRenderController, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
|
|
12
|
+
import { addCustomRangeBySelectionFactory, replaceSelectionFactory, DocSelectionRenderService, DocBackScrollRenderController, deleteCustomRangeFactory, DocCanvasPopManagerService, IEditorService, IRangeSelectorService, DocEventManagerService, UniverDocsUIPlugin } from "@univerjs/docs-ui";
|
|
13
13
|
import { IRenderManagerService } from "@univerjs/engine-render";
|
|
14
14
|
import { Subject, BehaviorSubject, of, map, filter, switchMap, distinctUntilChanged, debounceTime, Observable } from "rxjs";
|
|
15
15
|
import { DocSelectionManagerService } from "@univerjs/docs";
|
|
@@ -62,16 +62,40 @@ 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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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;
|
|
81
|
+
}
|
|
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;
|
|
72
95
|
}
|
|
96
|
+
return invalidLink;
|
|
73
97
|
}
|
|
74
|
-
|
|
98
|
+
navigateTo(params) {
|
|
75
99
|
const { gid, range, rangeid } = params, workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
76
100
|
if (!workbook)
|
|
77
101
|
return;
|
|
@@ -106,6 +130,38 @@ let SheetsHyperLinkResolverService = (_a = class {
|
|
|
106
130
|
this.navigateToSheetById(unitId, gid);
|
|
107
131
|
}
|
|
108
132
|
}
|
|
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
|
+
}
|
|
109
165
|
async navigateToRange(unitId, subUnitId, range) {
|
|
110
166
|
const worksheet = await this.navigateToSheetById(unitId, subUnitId);
|
|
111
167
|
if (worksheet) {
|
|
@@ -124,6 +180,27 @@ let SheetsHyperLinkResolverService = (_a = class {
|
|
|
124
180
|
});
|
|
125
181
|
}
|
|
126
182
|
}
|
|
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
|
+
}
|
|
127
204
|
async navigateToSheetById(unitId, subUnitId) {
|
|
128
205
|
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
129
206
|
if (!workbook)
|
|
@@ -142,8 +219,8 @@ let SheetsHyperLinkResolverService = (_a = class {
|
|
|
142
219
|
type: MessageType.Error
|
|
143
220
|
}), !1);
|
|
144
221
|
}
|
|
145
|
-
async navigateToDefineName(unitId,
|
|
146
|
-
return this._definedNamesService.focusRange(unitId,
|
|
222
|
+
async navigateToDefineName(unitId, rangeid) {
|
|
223
|
+
return this._definedNamesService.focusRange(unitId, rangeid), !0;
|
|
147
224
|
}
|
|
148
225
|
async navigateToOtherWebsite(url) {
|
|
149
226
|
var _a15;
|
|
@@ -337,7 +414,243 @@ reactJsxRuntime_production_min.jsx = q;
|
|
|
337
414
|
reactJsxRuntime_production_min.jsxs = q;
|
|
338
415
|
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
339
416
|
var jsxRuntimeExports = jsxRuntime.exports;
|
|
340
|
-
const
|
|
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), newId = generateRandomId(), { payload } = link, replaceSelection = addCustomRangeBySelectionFactory(accessor, {
|
|
514
|
+
unitId: documentId,
|
|
515
|
+
rangeId: newId,
|
|
516
|
+
rangeType: CustomRangeType.HYPERLINK,
|
|
517
|
+
properties: {
|
|
518
|
+
url: payload,
|
|
519
|
+
refId: newId
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
return replaceSelection ? commandService.syncExecuteCommand(replaceSelection.id, replaceSelection.params) : !1;
|
|
523
|
+
}, "handler")
|
|
524
|
+
}, UpdateHyperLinkCommand = {
|
|
525
|
+
type: CommandType.COMMAND,
|
|
526
|
+
id: "sheets.command.update-hyper-link",
|
|
527
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
528
|
+
async handler(accessor, params) {
|
|
529
|
+
var _a15, _b, _c, _d;
|
|
530
|
+
if (!params)
|
|
531
|
+
return !1;
|
|
532
|
+
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);
|
|
533
|
+
if (!currentRender || !workbook)
|
|
534
|
+
return !1;
|
|
535
|
+
const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
|
|
536
|
+
if (!worksheet || !skeleton)
|
|
537
|
+
return !1;
|
|
538
|
+
const { payload, display = "" } = link, cellData = worksheet.getCell(row, column);
|
|
539
|
+
if (!cellData)
|
|
540
|
+
return !1;
|
|
541
|
+
const doc = skeleton.getCellDocumentModelWithFormula(cellData);
|
|
542
|
+
if (!(doc != null && doc.documentModel))
|
|
543
|
+
return !1;
|
|
544
|
+
const snapshot = doc.documentModel.getSnapshot(), range = (_c = (_b = snapshot.body) == null ? void 0 : _b.customRanges) == null ? void 0 : _c.find((range2) => range2.rangeId === id);
|
|
545
|
+
if (!range)
|
|
546
|
+
return !1;
|
|
547
|
+
const newId = generateRandomId(), textRun = (_d = getBodySlice(doc.documentModel.getBody(), range.startIndex, range.endIndex + 1).textRuns) == null ? void 0 : _d[0];
|
|
548
|
+
textRun && (textRun.ed = display.length + 1);
|
|
549
|
+
const replaceSelection = replaceSelectionFactory(accessor, {
|
|
550
|
+
unitId,
|
|
551
|
+
body: {
|
|
552
|
+
dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
|
|
553
|
+
customRanges: [{
|
|
554
|
+
rangeId: newId,
|
|
555
|
+
rangeType: CustomRangeType.HYPERLINK,
|
|
556
|
+
startIndex: 0,
|
|
557
|
+
endIndex: display.length + 1,
|
|
558
|
+
properties: {
|
|
559
|
+
url: payload
|
|
560
|
+
}
|
|
561
|
+
}],
|
|
562
|
+
textRuns: textRun ? [textRun] : void 0
|
|
563
|
+
},
|
|
564
|
+
selection: {
|
|
565
|
+
startOffset: range.startIndex,
|
|
566
|
+
endOffset: range.endIndex + 1,
|
|
567
|
+
collapsed: !1
|
|
568
|
+
},
|
|
569
|
+
doc: doc.documentModel
|
|
570
|
+
});
|
|
571
|
+
if (!replaceSelection)
|
|
572
|
+
return !1;
|
|
573
|
+
const newBody = TextX.apply(Tools.deepClone(snapshot.body), replaceSelection.textX.serialize()), newCellData = {
|
|
574
|
+
p: {
|
|
575
|
+
...snapshot,
|
|
576
|
+
body: newBody
|
|
577
|
+
},
|
|
578
|
+
t: CellValueType.STRING
|
|
579
|
+
}, finalCellData = await editorBridgeService.beforeSetRangeValue(workbook, worksheet, row, column, newCellData), redo = {
|
|
580
|
+
id: SetRangeValuesMutation.id,
|
|
581
|
+
params: {
|
|
582
|
+
unitId,
|
|
583
|
+
subUnitId,
|
|
584
|
+
cellValue: {
|
|
585
|
+
[row]: {
|
|
586
|
+
[column]: finalCellData
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}, undoParams = SetRangeValuesUndoMutationFactory(accessor, redo.params), undo = {
|
|
591
|
+
id: SetRangeValuesMutation.id,
|
|
592
|
+
params: undoParams
|
|
593
|
+
}, redos = [redo], undos = [undo], modelLink = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
|
|
594
|
+
return modelLink && (redos.push({
|
|
595
|
+
id: RemoveHyperLinkMutation.id,
|
|
596
|
+
params: {
|
|
597
|
+
unitId,
|
|
598
|
+
subUnitId,
|
|
599
|
+
id: modelLink.id
|
|
600
|
+
}
|
|
601
|
+
}), undos.push({
|
|
602
|
+
id: AddHyperLinkMutation.id,
|
|
603
|
+
params: {
|
|
604
|
+
unitId,
|
|
605
|
+
subUnitId,
|
|
606
|
+
link: modelLink
|
|
607
|
+
}
|
|
608
|
+
})), await sequenceExecuteAsync(redos, commandService) ? (undoRedoService.pushUndoRedo({
|
|
609
|
+
redoMutations: redos,
|
|
610
|
+
undoMutations: undos,
|
|
611
|
+
unitID: unitId
|
|
612
|
+
}), !0) : !1;
|
|
613
|
+
}
|
|
614
|
+
}, UpdateRichHyperLinkCommand = {
|
|
615
|
+
type: CommandType.COMMAND,
|
|
616
|
+
id: "sheets.command.update-rich-hyper-link",
|
|
617
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
618
|
+
var _a15, _b, _c, _d;
|
|
619
|
+
if (!params)
|
|
620
|
+
return !1;
|
|
621
|
+
const { documentId: unitId, payload, id: rangeId } = params, univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), doc = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
622
|
+
if (!doc)
|
|
623
|
+
return !1;
|
|
624
|
+
const range = (_b = (_a15 = doc.getBody()) == null ? void 0 : _a15.customRanges) == null ? void 0 : _b.find((range2) => range2.rangeId === rangeId);
|
|
625
|
+
if (!range)
|
|
626
|
+
return !1;
|
|
627
|
+
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];
|
|
628
|
+
textRun && (textRun.ed = display.length + 1);
|
|
629
|
+
const replaceSelection = replaceSelectionFactory(accessor, {
|
|
630
|
+
unitId,
|
|
631
|
+
body: {
|
|
632
|
+
dataStream: `${DataStreamTreeTokenType.CUSTOM_RANGE_START}${display}${DataStreamTreeTokenType.CUSTOM_RANGE_END}`,
|
|
633
|
+
customRanges: [{
|
|
634
|
+
rangeId: newId,
|
|
635
|
+
rangeType: CustomRangeType.HYPERLINK,
|
|
636
|
+
startIndex: 0,
|
|
637
|
+
endIndex: display.length + 1,
|
|
638
|
+
properties: {
|
|
639
|
+
url: payload.payload
|
|
640
|
+
}
|
|
641
|
+
}],
|
|
642
|
+
textRuns: textRun ? [textRun] : void 0
|
|
643
|
+
},
|
|
644
|
+
selection: {
|
|
645
|
+
startOffset: range.startIndex,
|
|
646
|
+
endOffset: range.endIndex + 1,
|
|
647
|
+
collapsed: !1
|
|
648
|
+
},
|
|
649
|
+
doc
|
|
650
|
+
});
|
|
651
|
+
return replaceSelection ? commandService.syncExecuteCommand(replaceSelection.id, replaceSelection.params) : !1;
|
|
652
|
+
}, "handler")
|
|
653
|
+
}, _SheetsHyperLinkSidePanelService = class _SheetsHyperLinkSidePanelService extends Disposable {
|
|
341
654
|
constructor() {
|
|
342
655
|
super(...arguments);
|
|
343
656
|
__publicField(this, "_customHyperLinks", /* @__PURE__ */ new Map());
|
|
@@ -372,7 +685,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
|
|
|
372
685
|
cellLinkEditButtons
|
|
373
686
|
}, CellLinkEdit = /* @__PURE__ */ __name(() => {
|
|
374
687
|
var _a15;
|
|
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$),
|
|
688
|
+
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(() => {
|
|
376
689
|
if (!sidePanelService.isBuiltInLinkType(type))
|
|
377
690
|
return sidePanelService.getCustomHyperLink(type);
|
|
378
691
|
}, [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()) || "";
|
|
@@ -421,7 +734,7 @@ const cellLinkEdit = "univer-cell-link-edit", cellLinkEditButtons = "univer-cell
|
|
|
421
734
|
return;
|
|
422
735
|
}
|
|
423
736
|
setDisplay(link.display);
|
|
424
|
-
const linkInfo =
|
|
737
|
+
const linkInfo = resolverService.parseHyperLink(link.payload);
|
|
425
738
|
switch (setType(linkInfo.type === SheetHyperLinkType.INVALID ? SheetHyperLinkType.RANGE : linkInfo.type), linkInfo.type) {
|
|
426
739
|
case SheetHyperLinkType.URL: {
|
|
427
740
|
setPayload(linkInfo.url), linkInfo.url === link.display && (setByPayload.current = !0);
|
|
@@ -852,7 +1165,95 @@ function clsx() {
|
|
|
852
1165
|
return n2;
|
|
853
1166
|
}
|
|
854
1167
|
__name(clsx, "clsx");
|
|
855
|
-
const
|
|
1168
|
+
const CancelHyperLinkCommand = {
|
|
1169
|
+
type: CommandType.COMMAND,
|
|
1170
|
+
id: "sheets.command.cancel-hyper-link",
|
|
1171
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1172
|
+
handler(accessor, params) {
|
|
1173
|
+
var _a15, _b, _c;
|
|
1174
|
+
if (!params)
|
|
1175
|
+
return !1;
|
|
1176
|
+
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);
|
|
1177
|
+
if (!currentRender || !workbook)
|
|
1178
|
+
return !1;
|
|
1179
|
+
const worksheet = workbook == null ? void 0 : workbook.getSheetBySheetId(subUnitId), skeleton = (_a15 = currentRender.with(SheetSkeletonManagerService).getCurrent()) == null ? void 0 : _a15.skeleton;
|
|
1180
|
+
if (!worksheet || !skeleton)
|
|
1181
|
+
return !1;
|
|
1182
|
+
const cellData = worksheet.getCell(row, column);
|
|
1183
|
+
if (!cellData)
|
|
1184
|
+
return !1;
|
|
1185
|
+
const doc = skeleton.getCellDocumentModelWithFormula(cellData);
|
|
1186
|
+
if (!(doc != null && doc.documentModel))
|
|
1187
|
+
return !1;
|
|
1188
|
+
const snapshot = Tools.deepClone(doc.documentModel.getSnapshot());
|
|
1189
|
+
if (!((_c = (_b = snapshot.body) == null ? void 0 : _b.customRanges) == null ? void 0 : _c.find((range2) => range2.rangeId === id)))
|
|
1190
|
+
return !1;
|
|
1191
|
+
const textX = BuildTextUtils.customRange.delete(accessor, { documentDataModel: doc.documentModel, rangeId: id });
|
|
1192
|
+
if (!textX)
|
|
1193
|
+
return !1;
|
|
1194
|
+
const newBody = TextX.apply(snapshot.body, textX.serialize()), redos = [], undos = [], setRangeParams = {
|
|
1195
|
+
unitId,
|
|
1196
|
+
subUnitId,
|
|
1197
|
+
cellValue: {
|
|
1198
|
+
[row]: {
|
|
1199
|
+
[column]: {
|
|
1200
|
+
p: {
|
|
1201
|
+
...snapshot,
|
|
1202
|
+
body: newBody
|
|
1203
|
+
},
|
|
1204
|
+
t: CellValueType.STRING
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
redos.push({
|
|
1210
|
+
id: SetRangeValuesMutation.id,
|
|
1211
|
+
params: setRangeParams
|
|
1212
|
+
});
|
|
1213
|
+
const undoParams = SetRangeValuesUndoMutationFactory(accessor, setRangeParams);
|
|
1214
|
+
undos.push({
|
|
1215
|
+
id: SetRangeValuesMutation.id,
|
|
1216
|
+
params: undoParams
|
|
1217
|
+
});
|
|
1218
|
+
const link = hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, row, column);
|
|
1219
|
+
return link && (redos.push({
|
|
1220
|
+
id: RemoveHyperLinkMutation.id,
|
|
1221
|
+
params: {
|
|
1222
|
+
unitId,
|
|
1223
|
+
subUnitId,
|
|
1224
|
+
id
|
|
1225
|
+
}
|
|
1226
|
+
}), undos.push({
|
|
1227
|
+
id: AddHyperLinkMutation.id,
|
|
1228
|
+
params: {
|
|
1229
|
+
unitId,
|
|
1230
|
+
subUnitId,
|
|
1231
|
+
link: {
|
|
1232
|
+
...link
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
})), sequenceExecute(redos, commandService).result ? (undoRedoService.pushUndoRedo({
|
|
1236
|
+
redoMutations: redos,
|
|
1237
|
+
undoMutations: undos,
|
|
1238
|
+
unitID: unitId
|
|
1239
|
+
}), !0) : !1;
|
|
1240
|
+
}
|
|
1241
|
+
}, CancelRichHyperLinkCommand = {
|
|
1242
|
+
type: CommandType.COMMAND,
|
|
1243
|
+
id: "sheets.command.cancel-rich-hyper-link",
|
|
1244
|
+
handler(accessor, params) {
|
|
1245
|
+
var _a15, _b;
|
|
1246
|
+
if (!params)
|
|
1247
|
+
return !1;
|
|
1248
|
+
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);
|
|
1249
|
+
let insert = null;
|
|
1250
|
+
link && link.endIndex === doc.getBody().dataStream.length - 3 && (insert = {
|
|
1251
|
+
dataStream: " "
|
|
1252
|
+
});
|
|
1253
|
+
const doMutation = deleteCustomRangeFactory(accessor, { unitId: documentId, rangeId: linkId, insert });
|
|
1254
|
+
return doMutation ? commandService.syncExecuteCommand(doMutation.id, doMutation.params) : !1;
|
|
1255
|
+
}
|
|
1256
|
+
}, 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 = {
|
|
856
1257
|
cellLink,
|
|
857
1258
|
cellLinkType,
|
|
858
1259
|
cellLinkContent,
|
|
@@ -869,7 +1270,7 @@ const cellLink = "univer-cell-link", cellLinkType = "univer-cell-link-type", cel
|
|
|
869
1270
|
[SheetHyperLinkType.INVALID]: /* @__PURE__ */ jsxRuntimeExports.jsx(AllBorderSingle, {})
|
|
870
1271
|
}, CellLinkPopup = /* @__PURE__ */ __name(() => {
|
|
871
1272
|
var _a15, _b;
|
|
872
|
-
const popupService = useDependency(SheetsHyperLinkPopupService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), localeService = useDependency(LocaleService), [currentPopup, setCurrentPopup] = useState(null), resolverService = useDependency(SheetsHyperLinkResolverService), editorBridgeService = useDependency(IEditorBridgeService),
|
|
1273
|
+
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);
|
|
873
1274
|
if (useObservable$1(zenZoneService.visible$), useEffect(() => {
|
|
874
1275
|
setCurrentPopup(popupService.currentPopup);
|
|
875
1276
|
const ob = popupService.currentPopup$.subscribe((popup) => {
|
|
@@ -883,14 +1284,14 @@ const cellLink = "univer-cell-link", cellLinkType = "univer-cell-link-type", cel
|
|
|
883
1284
|
const { unitId, subUnitId, customRange, row, col } = currentPopup;
|
|
884
1285
|
if (!((_a15 = customRange == null ? void 0 : customRange.properties) != null && _a15.url))
|
|
885
1286
|
return null;
|
|
886
|
-
const linkObj =
|
|
1287
|
+
const linkObj = resolverService.parseHyperLink((_b = customRange.properties.url) != null ? _b : ""), isError = linkObj.type === SheetHyperLinkType.INVALID;
|
|
887
1288
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.cellLink, onClick: /* @__PURE__ */ __name(() => popupService.hideCurrentPopup(), "onClick"), children: [
|
|
888
1289
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
889
1290
|
"div",
|
|
890
1291
|
{
|
|
891
1292
|
className: clsx(styles.cellLinkContent, { [styles.cellLinkContentError]: isError }),
|
|
892
1293
|
onClick: /* @__PURE__ */ __name(() => {
|
|
893
|
-
zenZoneService.visible ||
|
|
1294
|
+
zenZoneService.visible || linkObj.handler();
|
|
894
1295
|
}, "onClick"),
|
|
895
1296
|
children: [
|
|
896
1297
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.cellLinkType, children: iconsMap[linkObj.type] }),
|
|
@@ -1957,15 +2358,15 @@ let SheetHyperLinkSetRangeController = (_a11 = class extends Disposable {
|
|
|
1957
2358
|
}));
|
|
1958
2359
|
}
|
|
1959
2360
|
_initAfterEditor() {
|
|
1960
|
-
this.disposeWithMe(this.
|
|
2361
|
+
this.disposeWithMe(this._editorBridgeService.interceptor.intercept(this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT, {
|
|
1961
2362
|
handler: /* @__PURE__ */ __name((cell, context, next) => {
|
|
1962
2363
|
if (!cell || cell.p)
|
|
1963
2364
|
return next(cell);
|
|
1964
2365
|
if (typeof cell.v == "string" && Tools.isLegalUrl(cell.v) && cell.v[cell.v.length - 1] !== " ") {
|
|
1965
|
-
const { unitId, subUnitId } = context,
|
|
1966
|
-
if (!
|
|
2366
|
+
const { unitId, subUnitId } = context, renderer = this._renderManagerService.getRenderById(unitId), skeleton = renderer == null ? void 0 : renderer.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId);
|
|
2367
|
+
if (!skeleton)
|
|
1967
2368
|
return next(cell);
|
|
1968
|
-
const doc =
|
|
2369
|
+
const doc = skeleton.skeleton.getBlankCellDocumentModel(cell);
|
|
1969
2370
|
if (!doc.documentModel)
|
|
1970
2371
|
return next(cell);
|
|
1971
2372
|
const textX = BuildTextUtils.selection.replace({
|
|
@@ -2066,7 +2467,13 @@ let SheetsHyperLinkUIController = (_a12 = class extends Disposable {
|
|
|
2066
2467
|
OpenHyperLinkEditPanelOperation,
|
|
2067
2468
|
CloseHyperLinkPopupOperation,
|
|
2068
2469
|
InsertHyperLinkOperation,
|
|
2069
|
-
InsertHyperLinkToolbarOperation
|
|
2470
|
+
InsertHyperLinkToolbarOperation,
|
|
2471
|
+
AddHyperLinkCommand,
|
|
2472
|
+
UpdateHyperLinkCommand,
|
|
2473
|
+
CancelHyperLinkCommand,
|
|
2474
|
+
UpdateRichHyperLinkCommand,
|
|
2475
|
+
CancelRichHyperLinkCommand,
|
|
2476
|
+
AddRichHyperLinkCommand
|
|
2070
2477
|
].forEach((command) => {
|
|
2071
2478
|
this._commandService.registerCommand(command);
|
|
2072
2479
|
});
|
|
@@ -2091,20 +2498,16 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
2091
2498
|
return kind && result && __defProp$1(target, key, result), result;
|
|
2092
2499
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a13;
|
|
2093
2500
|
let SheetHyperLinkUrlController = (_a13 = class extends Disposable {
|
|
2094
|
-
constructor(
|
|
2095
|
-
super(), this.
|
|
2501
|
+
constructor(_resolverService) {
|
|
2502
|
+
super(), this._resolverService = _resolverService, this._handleInitUrl();
|
|
2096
2503
|
}
|
|
2097
2504
|
_handleInitUrl() {
|
|
2098
2505
|
const hash = location.hash;
|
|
2099
|
-
|
|
2100
|
-
const linkInfo = this._parserService.parseHyperLink(hash);
|
|
2101
|
-
this._resolverService.navigate(linkInfo);
|
|
2102
|
-
}
|
|
2506
|
+
hash && this._resolverService.parseHyperLink(hash).handler();
|
|
2103
2507
|
}
|
|
2104
2508
|
}, __name(_a13, "SheetHyperLinkUrlController"), _a13);
|
|
2105
2509
|
SheetHyperLinkUrlController = __decorateClass$1([
|
|
2106
|
-
__decorateParam$1(0, Inject(
|
|
2107
|
-
__decorateParam$1(1, Inject(SheetsHyperLinkResolverService))
|
|
2510
|
+
__decorateParam$1(0, Inject(SheetsHyperLinkResolverService))
|
|
2108
2511
|
], SheetHyperLinkUrlController);
|
|
2109
2512
|
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) => {
|
|
2110
2513
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -2149,6 +2552,8 @@ UniverSheetsHyperLinkUIPlugin = __decorateClass([
|
|
|
2149
2552
|
__decorateParam(2, IConfigService)
|
|
2150
2553
|
], UniverSheetsHyperLinkUIPlugin);
|
|
2151
2554
|
export {
|
|
2555
|
+
AddHyperLinkCommand,
|
|
2556
|
+
CancelHyperLinkCommand,
|
|
2152
2557
|
CloseHyperLinkPopupOperation,
|
|
2153
2558
|
InsertHyperLinkOperation,
|
|
2154
2559
|
InsertLinkShortcut,
|
|
@@ -2157,5 +2562,6 @@ export {
|
|
|
2157
2562
|
SheetsHyperLinkPopupService,
|
|
2158
2563
|
SheetsHyperLinkResolverService,
|
|
2159
2564
|
SheetsHyperLinkSidePanelService,
|
|
2160
|
-
UniverSheetsHyperLinkUIPlugin
|
|
2565
|
+
UniverSheetsHyperLinkUIPlugin,
|
|
2566
|
+
UpdateHyperLinkCommand
|
|
2161
2567
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
import { ICellHyperLink } from '@univerjs/sheets-hyper-link';
|
|
3
|
+
export interface IAddHyperLinkCommandParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
subUnitId: string;
|
|
6
|
+
link: ICellHyperLink;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Command for add hyperlink
|
|
10
|
+
*/
|
|
11
|
+
export declare const AddHyperLinkCommand: ICommand<IAddHyperLinkCommandParams>;
|
|
12
|
+
export interface IAddRichHyperLinkCommandParams {
|
|
13
|
+
/**
|
|
14
|
+
* url of link
|
|
15
|
+
*/
|
|
16
|
+
documentId: string;
|
|
17
|
+
link: ICellHyperLink;
|
|
18
|
+
}
|
|
19
|
+
export declare const AddRichHyperLinkCommand: ICommand<IAddRichHyperLinkCommandParams>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
export interface ICancelHyperLinkCommandParams {
|
|
3
|
+
unitId: string;
|
|
4
|
+
subUnitId: string;
|
|
5
|
+
/**
|
|
6
|
+
* id of link
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
row: number;
|
|
10
|
+
column: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const CancelHyperLinkCommand: ICommand<ICancelHyperLinkCommandParams>;
|
|
13
|
+
export interface ICancelRichHyperLinkCommandParams extends ICancelHyperLinkCommandParams {
|
|
14
|
+
/**
|
|
15
|
+
* document id
|
|
16
|
+
*/
|
|
17
|
+
documentId: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const CancelRichHyperLinkCommand: ICommand<ICancelRichHyperLinkCommandParams>;
|