mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 06:34:40 +00:00
[dir view] store the open/closed state of the tree panel into localStorage (#6095)
This commit is contained in:
@@ -33,9 +33,15 @@ class LibContentView extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
let isTreePanelShown = true;
|
||||
const storedTreePanelState = localStorage.getItem('sf_dir_view_tree_panel_open');
|
||||
if (storedTreePanelState != undefined) {
|
||||
isTreePanelShown = storedTreePanelState == 'true';
|
||||
}
|
||||
this.state = {
|
||||
currentMode: cookie.load('seafile_view_mode') || 'list',
|
||||
isTreePanelShown: true, // display the 'dirent tree' side panel
|
||||
isTreePanelShown: isTreePanelShown, // display the 'dirent tree' side panel
|
||||
path: '',
|
||||
pathExist: true,
|
||||
isViewFile: false,
|
||||
@@ -1948,6 +1954,11 @@ class LibContentView extends React.Component {
|
||||
toggleTreePanel = () => {
|
||||
this.setState({
|
||||
isTreePanelShown: !this.state.isTreePanelShown
|
||||
}, () => {
|
||||
if (this.state.isTreePanelShown) {
|
||||
this.loadSidePanel(this.state.path);
|
||||
}
|
||||
localStorage.setItem('sf_dir_view_tree_panel_open', String(this.state.isTreePanelShown));
|
||||
});
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user