@@ -547,7 +547,7 @@ class LibContentView extends React.Component {
547
547
window . history . pushState ( { url : url , path : '' } , '' , url ) ;
548
548
} ;
549
549
550
- hideFileMetadata = ( ) => {
550
+ hideMetadataView = ( ) => {
551
551
this . setState ( {
552
552
currentMode : LIST_MODE ,
553
553
path : '' ,
@@ -1084,7 +1084,7 @@ class LibContentView extends React.Component {
1084
1084
1085
1085
onMainNavBarClick = ( nodePath ) => {
1086
1086
// just for dir
1087
- this . resetSelected ( ) ;
1087
+ this . resetSelected ( nodePath ) ;
1088
1088
if ( this . state . isTreePanelShown ) {
1089
1089
let tree = this . state . treeData . clone ( ) ;
1090
1090
let node = tree . getNodeByPath ( nodePath ) ;
@@ -1485,7 +1485,7 @@ class LibContentView extends React.Component {
1485
1485
} ;
1486
1486
1487
1487
onItemClick = ( dirent ) => {
1488
- this . resetSelected ( ) ;
1488
+ this . resetSelected ( dirent ) ;
1489
1489
let repoID = this . props . repoID ;
1490
1490
let direntPath = Utils . joinPath ( this . state . path , dirent . name ) ;
1491
1491
if ( dirent . isDir ( ) ) { // is dir
@@ -1829,7 +1829,7 @@ class LibContentView extends React.Component {
1829
1829
} ;
1830
1830
1831
1831
onTreeNodeClick = ( node ) => {
1832
- this . resetSelected ( ) ;
1832
+ this . resetSelected ( node ) ;
1833
1833
let repoID = this . props . repoID ;
1834
1834
1835
1835
if ( ! this . state . pathExist ) {
@@ -2013,14 +2013,16 @@ class LibContentView extends React.Component {
2013
2013
return this . state . selectedDirentList . map ( selectedDirent => selectedDirent . name ) ;
2014
2014
} ;
2015
2015
2016
- resetSelected = ( ) => {
2016
+ resetSelected = ( node ) => {
2017
2017
this . setState ( {
2018
2018
isDirentSelected : false ,
2019
2019
isAllDirentSelected : false ,
2020
2020
} ) ;
2021
2021
if ( this . state . currentMode === METADATA_MODE ) {
2022
+ const path = node . path || '' ;
2023
+ const isMetadataView = path . startsWith ( '/' + PRIVATE_FILE_TYPE . FILE_EXTENDED_PROPERTIES ) ;
2022
2024
this . setState ( {
2023
- currentMode : cookie . load ( 'seafile_view_mode' ) || LIST_MODE ,
2025
+ currentMode : cookie . load ( 'seafile_view_mode' ) || ( isMetadataView ? METADATA_MODE : LIST_MODE ) ,
2024
2026
} ) ;
2025
2027
this . markdownFileName = '' ;
2026
2028
this . markdownFileParentDir = '' ;
@@ -2179,12 +2181,17 @@ class LibContentView extends React.Component {
2179
2181
} ;
2180
2182
2181
2183
render ( ) {
2182
- let { currentRepoInfo, userPerm, isCopyMoveProgressDialogShow, isDeleteFolderDialogOpen,
2183
- path, usedRepoTags } = this . state ;
2184
+ const { repoID } = this . props ;
2185
+ let { currentRepoInfo, userPerm, isCopyMoveProgressDialogShow, isDeleteFolderDialogOpen, errorMsg,
2186
+ path, usedRepoTags, isDirentSelected } = this . state ;
2187
+
2184
2188
if ( this . state . libNeedDecrypt ) {
2185
2189
return (
2186
2190
< ModalPortal >
2187
- < LibDecryptDialog repoID = { this . props . repoID } onLibDecryptDialog = { this . onLibDecryptDialog } />
2191
+ < LibDecryptDialog
2192
+ repoID = { repoID }
2193
+ onLibDecryptDialog = { this . onLibDecryptDialog }
2194
+ />
2188
2195
</ ModalPortal >
2189
2196
) ;
2190
2197
}
@@ -2198,15 +2205,15 @@ class LibContentView extends React.Component {
2198
2205
</ ModalPortal >
2199
2206
) ;
2200
2207
}
2201
- if ( this . state . errorMsg ) {
2208
+ if ( errorMsg ) {
2202
2209
return (
2203
2210
< >
2204
- < p className = "error mt-6 text-center" > { this . state . errorMsg } </ p >
2211
+ < p className = "error mt-6 text-center" > { errorMsg } </ p >
2205
2212
< button type = "submit" className = "btn btn-primary submit" onClick = { this . handleSubmit } > { gettext ( 'Leave Share' ) } </ button >
2206
2213
</ >
2207
2214
) ;
2208
2215
}
2209
- if ( ! this . state . currentRepoInfo ) {
2216
+ if ( ! currentRepoInfo ) {
2210
2217
return '' ;
2211
2218
}
2212
2219
@@ -2239,12 +2246,12 @@ class LibContentView extends React.Component {
2239
2246
2240
2247
return (
2241
2248
< MetadataProvider
2242
- repoID = { this . props . repoID }
2249
+ repoID = { repoID }
2243
2250
currentRepoInfo = { currentRepoInfo }
2244
2251
selectMetadataView = { this . onTreeNodeClick }
2245
- hideMetadataView = { this . hideFileMetadata }
2252
+ hideMetadataView = { this . hideMetadataView }
2246
2253
>
2247
- < CollaboratorsProvider repoID = { this . props . repoID } >
2254
+ < CollaboratorsProvider repoID = { repoID } >
2248
2255
< div className = "main-panel-center flex-row" >
2249
2256
< div className = "cur-view-container" >
2250
2257
{ this . state . currentRepoInfo . status === 'read-only' &&
@@ -2256,9 +2263,9 @@ class LibContentView extends React.Component {
2256
2263
< div className = { classnames (
2257
2264
'cur-view-path-left' , {
2258
2265
'w-100' : ! isDesktop ,
2259
- 'animation-children' : this . state . isDirentSelected
2266
+ 'animation-children' : isDirentSelected
2260
2267
} ) } >
2261
- { this . state . isDirentSelected ?
2268
+ { isDirentSelected ?
2262
2269
< SelectedDirentsToolbar
2263
2270
repoID = { this . props . repoID }
2264
2271
path = { this . state . path }
0 commit comments