File tree Expand file tree Collapse file tree
acr/src/modules/merge-request Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,26 +44,7 @@ export class MergeRequestContribution
4444 }
4545
4646 onDidStart ( ) {
47- // 重新载入会导致组件未注册 临时修复
48- const tabbarService = this . layoutService . getTabbarService ( SlotLocation . left ) ;
49- const componentRegistry =
50- this . componentRegistry . getComponentRegistryInfo ( MergeRequestExplorerId ) ;
51- if ( componentRegistry ) {
52- tabbarService . registerContainer ( MergeRequestExplorerId , componentRegistry ) ;
53- const state = this . layoutState . getState ( LAYOUT_STATE . MAIN , { } ) ;
54- let currentId : string ,
55- size : number = 0 ,
56- show = true ;
57- for ( const key in state ) {
58- if ( key === SlotLocation . left ) {
59- currentId = state [ key ] ?. currentId ;
60- size = state [ key ] ?. size || 0 ;
61- show = currentId ? true : false ;
62- }
63- }
64- this . layoutService . toggleSlot ( SlotLocation . left , show , size ) ;
65- }
66- // 重新载入 titleMenu有缓存 需将其重置
47+ // TODO 重新载入 titleMenu有缓存 需将其重置
6748 disposableCollection . push ( ( injector ) => {
6849 const accordionService : AccordionService = injector
6950 . get ( IMainLayoutService )
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import { EditorEmptyContribution } from './editor-empty/editor-empty.contributio
3030import { WelcomeContribution } from './welcome/welcome.contributon' ;
3131import { FileSchemeContribution } from './file-scheme/index.contribution' ;
3232import { PreferenceSettingContribution } from './preference/preference.setting.contribution' ;
33+ import { LayoutRestoreContributation } from './layout/index.contribution' ;
3334
3435import {
3536 MonacoCodeService ,
@@ -71,6 +72,7 @@ export class ClientModule extends BrowserModule {
7172 FileSchemeContribution ,
7273 SearchContribution ,
7374 PreferenceSettingContribution ,
75+ LayoutRestoreContributation ,
7476 {
7577 token : MonacoCodeService ,
7678 useValue : codeServiceEditor ,
Original file line number Diff line number Diff line change 1+ import { Autowired } from '@opensumi/di' ;
2+ import {
3+ CommandRegistry ,
4+ SlotLocation ,
5+ ClientAppContribution ,
6+ AppConfig ,
7+ ComponentRegistry ,
8+ } from '@opensumi/ide-core-browser' ;
9+ import { Domain } from '@opensumi/ide-core-common' ;
10+ import { IMainLayoutService } from '@opensumi/ide-main-layout' ;
11+
12+ @Domain ( ClientAppContribution )
13+ //TODO 组件卸载重新渲染 渲染时注册container 会有时序问题 临时修复
14+ export class LayoutRestoreContributation implements ClientAppContribution {
15+ @Autowired ( AppConfig )
16+ private appConfig : AppConfig ;
17+ @Autowired ( IMainLayoutService )
18+ layoutService : IMainLayoutService ;
19+ @Autowired ( ComponentRegistry )
20+ componentRegistry : ComponentRegistry ;
21+ async onDidStart ( ) {
22+ const layoutConfig = this . appConfig . layoutConfig ;
23+ const layoutDirection = [ SlotLocation . left , SlotLocation . bottom , SlotLocation . right ] ;
24+ layoutDirection . forEach ( ( direction ) => {
25+ const tabbarService = this . layoutService . getTabbarService ( direction ) ;
26+ layoutConfig [ direction ] ?. modules . forEach ( ( module ) => {
27+ const componentRegistry = this . componentRegistry . getComponentRegistryInfo ( module ) ;
28+ if ( componentRegistry ) {
29+ tabbarService . registerContainer (
30+ componentRegistry . options ! . containerId ,
31+ componentRegistry
32+ ) ;
33+ }
34+ } ) ;
35+ // @ts -ignore
36+ this . layoutService . restoreTabbarService ( tabbarService ) ;
37+ } ) ;
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments