mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 19:29:56 +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) => {
|
||||
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) => {
|
||||
|
Reference in New Issue
Block a user