Skip to content

Commit 2311774

Browse files
author
彦熹
committed
fix: 编辑数据持久化到 indexedDB
1 parent c3b87ba commit 2311774

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

packages/acr/src/modules/merge-request/web-scm/web-scm.contribution.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const ACR_CHANGE_FILE_EDITABLE = new RawContextKey<boolean>('acr.changeFileEdita
4040
@Domain(CommandContribution, MenuContribution, ClientAppContribution)
4141
export class WebSCMContribution
4242
extends WithEventBus
43-
implements CommandContribution, MenuContribution, ClientAppContribution {
43+
implements CommandContribution, MenuContribution, ClientAppContribution
44+
{
4445
@Autowired(CommandService)
4546
private readonly commandService: CommandService;
4647

@@ -316,8 +317,8 @@ export class WebSCMContribution
316317
const gitUri = new URI(resource.sourceUri);
317318
const { ref, path } = fromGitUri(gitUri);
318319

319-
const [root] = await this.workspaceService.roots;
320-
const targetFileUri = URI.file(paths.resolve(new URI(root.uri).codeUri.fsPath, path));
320+
// const [root] = await this.workspaceService.roots;
321+
// const targetFileUri = URI.file(paths.resolve(new URI(root.uri).codeUri.fsPath, path));
321322

322323
// 操作行为数据上报
323324
reportEditOperation('scm-resource-inline-open-file', path.toString(), {
@@ -326,7 +327,7 @@ export class WebSCMContribution
326327
commitId: ref,
327328
});
328329

329-
await this.workbenchEditorService.open(targetFileUri);
330+
await this.workbenchEditorService.open(gitUri);
330331
},
331332
});
332333

packages/acr/src/render-app.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ export async function renderApp(opts: IClientAppOpts, injector: Injector, custom
4040
const runtimeConfig: RuntimeConfig = {
4141
biz: 'acr',
4242
startupEditor: 'none',
43+
workspace: {
44+
// indexedDB 持久化缓存编辑文件
45+
filesystem: {
46+
fs: 'IndexedDB',
47+
options: {
48+
storeName: 'ALEX_ACR',
49+
},
50+
},
51+
},
4352
};
4453

4554
const app = createApp({

0 commit comments

Comments
 (0)