Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(hyper-link): bugfix for hyper-link remove-sheet (#2444)

zhangw039a59d96b67
diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo.ts b/examples/src/data/sheets/demo/default-workbook-data-demo.ts
index 33dfd5226f..7a2ddd397a 100644
--- a/examples/src/data/sheets/demo/default-workbook-data-demo.ts
+++ b/examples/src/data/sheets/demo/default-workbook-data-demo.ts
@@ -23664,7 +23664,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
ref: 'C6',
personId: 'mockId',
unitId: 'workbook-01',
- subUnitId: 'sheet-0011',
+ subUnitId: 'dv-test',
},
{
text: {
@@ -23679,7 +23679,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
ref: 'B6',
personId: 'mockId',
unitId: 'workbook-01',
- subUnitId: 'sheet-0011',
+ subUnitId: 'dv-test',
},
{
text: {
@@ -23694,7 +23694,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
ref: 'B7',
personId: 'mockId',
unitId: 'workbook-01',
- subUnitId: 'sheet-0011',
+ subUnitId: 'dv-test',
},
{
text: {
@@ -23709,7 +23709,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
ref: 'B8',
personId: 'mockId',
unitId: 'workbook-01',
- subUnitId: 'sheet-0011',
+ subUnitId: 'dv-test',
},
{
text: {
@@ -23724,7 +23724,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
ref: 'B9',
personId: 'mockId',
unitId: 'workbook-01',
- subUnitId: 'sheet-0011',
+ subUnitId: 'dv-test',
},
],
}),
diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.ts
index 182a03ce98..16e2c90140 100644
--- a/examples/src/sheets/main.ts
+++ b/examples/src/sheets/main.ts
@@ -140,6 +140,7 @@ univer.registerPlugin(UniverDebuggerPlugin);
const injector = univer.__getInjector();
const userManagerService = injector.get(UserManagerService);
userManagerService.currentUser = mockUser;
+userManagerService.addUser(mockUser);
declare global {
// eslint-disable-next-line ts/naming-convention
diff --git a/packages/sheets-hyper-link-ui/src/controllers/remove-sheet.controller.ts b/packages/sheets-hyper-link-ui/src/controllers/remove-sheet.controller.ts
index b37b0cce90..99d46fcc94 100644
--- a/packages/sheets-hyper-link-ui/src/controllers/remove-sheet.controller.ts
+++ b/packages/sheets-hyper-link-ui/src/controllers/remove-sheet.controller.ts
@@ -19,7 +19,7 @@ import { Disposable, IUniverInstanceService, LifecycleStages, OnLifecycle, Unive
import type { IRemoveSheetCommandParams } from '@univerjs/sheets';
import { RemoveSheetCommand, SheetInterceptorService } from '@univerjs/sheets';
import { Inject } from '@wendellhu/redi';
-import { AddHyperLinkCommand, HyperLinkModel, RemoveHyperLinkCommand } from '@univerjs/sheets-hyper-link';
+import { AddHyperLinkMutation, HyperLinkModel, RemoveHyperLinkMutation } from '@univerjs/sheets-hyper-link';
@OnLifecycle(LifecycleStages.Ready, SheetsHyperLinkRemoveSheetController)
export class SheetsHyperLinkRemoveSheetController extends Disposable {
@@ -47,7 +47,7 @@ export class SheetsHyperLinkRemoveSheetController extends Disposable {
const links = this._hyperLinkModel.getSubUnit(unitId, subUnitId);
const redos = links.map((link) => ({
- id: RemoveHyperLinkCommand.id,
+ id: RemoveHyperLinkMutation.id,
params: {
unitId,
subUnitId,
@@ -56,14 +56,13 @@ export class SheetsHyperLinkRemoveSheetController extends Disposable {
}));
const undos = links.map((link) => ({
- id: AddHyperLinkCommand.id,
+ id: AddHyperLinkMutation.id,
params: {
unitId,
subUnitId,
link,
},
}));
-
return { redos, undos };
}
return { redos: [], undos: [] };