1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

[onlyoffice file view] keep the 'shown/hidden' state of the header in localStorage (#6918)

This commit is contained in:
llj
2024-10-17 16:35:48 +08:00
committed by GitHub
parent 69a154fd55
commit 675e2572da

View File

@@ -34,11 +34,12 @@ class FileView extends React.Component {
constructor(props) {
super(props);
const storedIsHeaderShown = localStorage.getItem('sf_onlyoffile_file_view_header_shown');
this.state = {
isStarred: isStarred,
isLocked: isLocked,
lockedByMe: lockedByMe,
isHeaderShown: true,
isHeaderShown: (storedIsHeaderShown === null) || (storedIsHeaderShown == 'true'),
isDetailsPanelOpen: false
};
}
@@ -101,6 +102,8 @@ class FileView extends React.Component {
toggleHeader = () => {
this.setState({
isHeaderShown: !this.state.isHeaderShown
}, () => {
localStorage.setItem('sf_onlyoffile_file_view_header_shown', String(this.state.isHeaderShown));
});
};