Skip to content

Commit

Permalink
fix(hyper-link): bugfix for hyper-link remove-sheet (#2444)
Browse files Browse the repository at this point in the history
* feat: snapshot

* fix: comment demo & remove-sheet
  • Loading branch information
weird94 committed Jun 7, 2024
1 parent 23775c8 commit 039a59d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions examples/src/data/sheets/demo/default-workbook-data-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand All @@ -23724,7 +23724,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {
ref: 'B9',
personId: 'mockId',
unitId: 'workbook-01',
subUnitId: 'sheet-0011',
subUnitId: 'dv-test',
},
],
}),
Expand Down
1 change: 1 addition & 0 deletions examples/src/sheets/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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: [] };
Expand Down

0 comments on commit 039a59d

Please sign in to comment.