mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 09:51:26 +00:00
fix: gallery info toggle (#6945)
Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect, useMemo } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import LibDetail from './lib-details';
|
import LibDetail from './lib-details';
|
||||||
import DirentDetail from './dirent-details';
|
import DirentDetail from './dirent-details';
|
||||||
@@ -8,9 +8,10 @@ import { MetadataContext } from '../../metadata';
|
|||||||
import { PRIVATE_FILE_TYPE } from '../../constants';
|
import { PRIVATE_FILE_TYPE } from '../../constants';
|
||||||
|
|
||||||
const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, repoTags, fileTags, onClose, onFileTagChanged }) => {
|
const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, repoTags, fileTags, onClose, onFileTagChanged }) => {
|
||||||
|
const isView = useMemo(() => path.startsWith('/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES), [path]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (path.startsWith('/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES)) return;
|
if (isView) return;
|
||||||
|
|
||||||
// init context
|
// init context
|
||||||
const context = new MetadataContext();
|
const context = new MetadataContext();
|
||||||
@@ -22,12 +23,11 @@ const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, rep
|
|||||||
delete window['sfMetadataContext'];
|
delete window['sfMetadataContext'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [repoID, currentRepoInfo, path]);
|
}, [repoID, currentRepoInfo, isView]);
|
||||||
|
|
||||||
if (path.startsWith('/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES)) {
|
if (isView) {
|
||||||
const viewId = path.split('/').pop();
|
const viewId = path.split('/').pop();
|
||||||
if (!dirent) return (<ViewDetails viewId={viewId} onClose={onClose} />);
|
if (!dirent) return (<ViewDetails viewId={viewId} onClose={onClose} />);
|
||||||
path = dirent.path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path === '/' && !dirent) {
|
if (path === '/' && !dirent) {
|
||||||
@@ -41,7 +41,7 @@ const DetailContainer = React.memo(({ repoID, path, dirent, currentRepoInfo, rep
|
|||||||
return (
|
return (
|
||||||
<DirentDetail
|
<DirentDetail
|
||||||
repoID={repoID}
|
repoID={repoID}
|
||||||
path={path}
|
path={isView ? dirent.path : path}
|
||||||
dirent={dirent}
|
dirent={dirent}
|
||||||
currentRepoInfo={currentRepoInfo}
|
currentRepoInfo={currentRepoInfo}
|
||||||
repoTags={repoTags}
|
repoTags={repoTags}
|
||||||
|
@@ -34,6 +34,8 @@ class PopupEditorContainer extends React.Component {
|
|||||||
...additionalStyles
|
...additionalStyles
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
this.isClosed = false;
|
||||||
|
this.changeCanceled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeCommitted = false;
|
changeCommitted = false;
|
||||||
@@ -197,10 +199,11 @@ class PopupEditorContainer extends React.Component {
|
|||||||
closeEditor = (isEscapeKeydown) => {
|
closeEditor = (isEscapeKeydown) => {
|
||||||
const { column } = this.props;
|
const { column } = this.props;
|
||||||
if (column.type === CellType.DATE && !isEscapeKeydown) return null;
|
if (column.type === CellType.DATE && !isEscapeKeydown) return null;
|
||||||
this.onClickOutside(isEscapeKeydown);
|
!this.isClosed && this.onClickOutside(isEscapeKeydown);
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickOutside = (isEscapeKeydown) => {
|
onClickOutside = (isEscapeKeydown) => {
|
||||||
|
this.isClosed = true;
|
||||||
this.commit();
|
this.commit();
|
||||||
this.props.onCommitCancel();
|
this.props.onCommitCancel();
|
||||||
!isEscapeKeydown && window.sfMetadataContext.eventBus.dispatch(EVENT_BUS_TYPE.SELECT_NONE);
|
!isEscapeKeydown && window.sfMetadataContext.eventBus.dispatch(EVENT_BUS_TYPE.SELECT_NONE);
|
||||||
|
@@ -48,6 +48,9 @@ class Location extends React.Component {
|
|||||||
this.googleMarker = null;
|
this.googleMarker = null;
|
||||||
}
|
}
|
||||||
this.map = null;
|
this.map = null;
|
||||||
|
this.setState = (state, callback) => {
|
||||||
|
return;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
initMap = (position) => {
|
initMap = (position) => {
|
||||||
|
Reference in New Issue
Block a user