mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 20:01:10 +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:
@@ -103,13 +103,9 @@ export const openFile = (repoID, record, _openImage = () => {}) => {
|
|||||||
export const openInNewTab = (repoID, record) => {
|
export const openInNewTab = (repoID, record) => {
|
||||||
if (!record) return;
|
if (!record) return;
|
||||||
const isDir = checkIsDir(record);
|
const isDir = checkIsDir(record);
|
||||||
const parentDir = getParentDirFromRecord(record);
|
|
||||||
const fileName = getFileNameFromRecord(record);
|
const fileName = getFileNameFromRecord(record);
|
||||||
const url = isDir
|
const parentDir = _getParentDir(record);
|
||||||
? window.location.origin + window.location.pathname + Utils.encodePath(Utils.joinPath(parentDir, fileName))
|
_openByNewWindow(repoID, fileName, parentDir, isDir ? FILE_TYPE.FOLDER : '');
|
||||||
: `${siteRoot}lib/${repoID}/file${Utils.encodePath(Utils.joinPath(parentDir, fileName))}`;
|
|
||||||
|
|
||||||
window.open(url, '_blank');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openParentFolder = (record) => {
|
export const openParentFolder = (record) => {
|
||||||
|
Reference in New Issue
Block a user