@@ -13,7 +13,6 @@ import { CloseIcon, LockIcon, WarnIcon } from './icon';
1313import { intl } from './locale' ;
1414
1515function CustomTabItem ( props : {
16- key : string ;
1716 pluginContext : IPublicModelPluginContext ;
1817 options : IOptions ;
1918 resource : IPublicModelResource ;
@@ -114,7 +113,7 @@ interface ITabItem {
114113 windowId : string ;
115114}
116115
117- function Content ( props : {
116+ function TabsContent ( props : {
118117 pluginContext : IPublicModelPluginContext ;
119118 options : IOptions ;
120119} ) {
@@ -236,62 +235,69 @@ function Content(props: {
236235 }
237236 } , [ resourceListMap ] ) ;
238237
239- const ContextMenu = pluginContext ?. commonUI ?. ContextMenu || React . Fragment ;
240238 return (
241- < ContextMenu menus = { props . options . contextMenuActions ?.( props . pluginContext ) || [ ] } >
242- < div >
243- < Tab
244- size = "small"
245- activeKey = { activeTitle }
246- shape = { shape || 'wrapped' }
247- animation = { false }
248- className = { `${ tabClassName } resource-tabs` }
249- excessMode = "slide"
250- disableKeyboard = { true }
251- contentStyle = { {
252- height : 0 ,
253- } }
254- tabRender = { (
255- key ,
256- props : {
257- resource : IPublicModelResource ;
258- key : string ;
259- }
260- ) => (
261- < CustomTabItem
262- key = { key }
263- resource = { props . resource }
264- pluginContext = { pluginContext }
265- options = { options }
266- />
267- ) }
268- onChange = { ( name ) => {
269- setActiveTitle ( name ) ;
270- const item = tabs . filter ( ( d ) => String ( d . id ) === String ( name ) ) ?. [ 0 ] ;
271- const resource = resourceListMap [ item . id ] ;
272- workspace . openEditorWindow ( resource ) ;
273- } }
274- >
275- { tabs . map ( ( item ) => {
276- const resource = resourceListMap [ item . id ] ;
277- if ( ! resource ) {
278- return null ;
279- }
239+ < Tab
240+ size = "small"
241+ activeKey = { activeTitle }
242+ shape = { shape || 'wrapped' }
243+ animation = { false }
244+ className = { `${ tabClassName } resource-tabs` }
245+ excessMode = "slide"
246+ disableKeyboard = { true }
247+ contentStyle = { {
248+ height : 0 ,
249+ } }
250+ tabRender = { (
251+ key ,
252+ props : {
253+ resource : IPublicModelResource ;
254+ key : string ;
255+ }
256+ ) => (
257+ < CustomTabItem
258+ key = { key }
259+ resource = { props . resource }
260+ pluginContext = { pluginContext }
261+ options = { options }
262+ />
263+ ) }
264+ onChange = { ( name ) => {
265+ setActiveTitle ( name ) ;
266+ const item = tabs . filter ( ( d ) => String ( d . id ) === String ( name ) ) ?. [ 0 ] ;
267+ const resource = resourceListMap [ item . id ] ;
268+ workspace . openEditorWindow ( resource ) ;
269+ } }
270+ >
271+ { tabs . map ( ( item ) => {
272+ const resource = resourceListMap [ item . id ] ;
273+ if ( ! resource ) {
274+ return null ;
275+ }
280276
281- return (
282- < Tab . Item
283- key = { resource . id || resource . options . id }
284- // @ts -ignore
285- resource = { resource }
286- />
287- ) ;
288- } ) }
289- </ Tab >
290- </ div >
291- </ ContextMenu >
277+ return (
278+ < Tab . Item
279+ key = { resource . id || resource . options . id }
280+ // @ts -ignore
281+ resource = { resource }
282+ />
283+ ) ;
284+ } ) }
285+ </ Tab >
292286 ) ;
293287}
294288
289+ function Content ( props : {
290+ pluginContext : IPublicModelPluginContext ;
291+ options : IOptions ;
292+ } ) {
293+ const ContextMenu = props . pluginContext ?. commonUI ?. ContextMenu || React . Fragment ;
294+ return (
295+ < ContextMenu menus = { props . options . contextMenuActions ?.( props . pluginContext ) || [ ] } >
296+ < TabsContent { ...props } />
297+ </ ContextMenu >
298+ )
299+ }
300+
295301interface IOptions {
296302 appKey ?: string ;
297303 onSort ?: ( windows : IPublicModelWindow [ ] ) => IPublicModelWindow [ ] ;
0 commit comments