1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-11 11:51:27 +00:00

fix: open in new tab (#7200)

* fix: open in new tab

* feat: optimize code

---------

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-12-16 18:00:12 +08:00
committed by GitHub
parent 34cf5beb0d
commit d19d22c69d

View File

@@ -103,13 +103,9 @@ export const openFile = (repoID, record, _openImage = () => {}) => {
export const openInNewTab = (repoID, record) => {
if (!record) return;
const isDir = checkIsDir(record);
const parentDir = getParentDirFromRecord(record);
const fileName = getFileNameFromRecord(record);
const url = isDir
? window.location.origin + window.location.pathname + Utils.encodePath(Utils.joinPath(parentDir, fileName))
: `${siteRoot}lib/${repoID}/file${Utils.encodePath(Utils.joinPath(parentDir, fileName))}`;
window.open(url, '_blank');
const parentDir = _getParentDir(record);
_openByNewWindow(repoID, fileName, parentDir, isDir ? FILE_TYPE.FOLDER : '');
};
export const openParentFolder = (record) => {