From 38a4c20209c0a36edfbf11def726d8f396c2b4cc Mon Sep 17 00:00:00 2001 From: zhouwenxuan Date: Tue, 14 Jan 2025 22:04:32 +0800 Subject: [PATCH] optimize --- .../src/components/dialog/image-dialog/index.js | 3 +-- .../dirent-detail/embedded-file-details/index.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/dialog/image-dialog/index.js b/frontend/src/components/dialog/image-dialog/index.js index 67b94c6dbcf..f00b5ad7656 100644 --- a/frontend/src/components/dialog/image-dialog/index.js +++ b/frontend/src/components/dialog/image-dialog/index.js @@ -61,9 +61,8 @@ const ImageDialog = ({ repoID, repoInfo, enableRotate: oldEnableRotate, imageIte className="lightbox-side-panel" style={{ width: expanded ? `${SIDE_PANEL_EXPANDED_WIDTH}px` : `${SIDE_PANEL_COLLAPSED_WIDTH}px` }} aria-expanded={expanded} - onClick={onToggleSidePanel} > -
+
{expanded && ( diff --git a/frontend/src/components/dirent-detail/embedded-file-details/index.js b/frontend/src/components/dirent-detail/embedded-file-details/index.js index d1307a4303b..600ae02ce8c 100644 --- a/frontend/src/components/dirent-detail/embedded-file-details/index.js +++ b/frontend/src/components/dirent-detail/embedded-file-details/index.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { seafileAPI } from '../../../utils/seafile-api'; @@ -16,6 +16,16 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = const { headerComponent } = component; const [direntDetail, setDirentDetail] = useState(''); + const isView = useMemo(() => { + const urlParams = new URLSearchParams(window.location.search); + return urlParams.has('view'); + }, []); + + const isTag = useMemo(() => { + const urlParams = new URLSearchParams(window.location.search); + return urlParams.has('tag'); + }, []); + useEffect(() => { seafileAPI.getFileInfo(repoID, path).then(res => { setDirentDetail(res.data); @@ -26,7 +36,7 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = }, [repoID, path]); useEffect(() => { - if (withinImageDialog) return; + if (isView || isTag) return; // init context const context = new MetadataContext(); window.sfMetadataContext = context;