mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 08:53:14 +00:00
[onlyoffice file view] keep the 'shown/hidden' state of the header in localStorage (#6918)
This commit is contained in:
@@ -34,11 +34,12 @@ class FileView extends React.Component {
|
|||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
const storedIsHeaderShown = localStorage.getItem('sf_onlyoffile_file_view_header_shown');
|
||||||
this.state = {
|
this.state = {
|
||||||
isStarred: isStarred,
|
isStarred: isStarred,
|
||||||
isLocked: isLocked,
|
isLocked: isLocked,
|
||||||
lockedByMe: lockedByMe,
|
lockedByMe: lockedByMe,
|
||||||
isHeaderShown: true,
|
isHeaderShown: (storedIsHeaderShown === null) || (storedIsHeaderShown == 'true'),
|
||||||
isDetailsPanelOpen: false
|
isDetailsPanelOpen: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -101,6 +102,8 @@ class FileView extends React.Component {
|
|||||||
toggleHeader = () => {
|
toggleHeader = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isHeaderShown: !this.state.isHeaderShown
|
isHeaderShown: !this.state.isHeaderShown
|
||||||
|
}, () => {
|
||||||
|
localStorage.setItem('sf_onlyoffile_file_view_header_shown', String(this.state.isHeaderShown));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user