Skip to content

Commit

Permalink
[dir view] store the open/closed state of the tree panel into localSt…
Browse files Browse the repository at this point in the history
…orage (#6095)
  • Loading branch information
llj authored May 17, 2024
1 parent 0e38b74 commit 96b01de
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
});
};

Expand Down

0 comments on commit 96b01de

Please sign in to comment.