1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

add smart link

This commit is contained in:
ilearnit
2018-12-14 04:19:24 +00:00
parent 0f5d811c33
commit 99b68ae7c6
5 changed files with 105 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Link } from '@reach/router';
import { siteRoot, gettext } from '../../utils/constants';
import InternalLinkDialog from '../dialog/internal-link-dialog';
const propTypes = {
repoName: PropTypes.string.isRequired,
@@ -9,6 +10,8 @@ const propTypes = {
onPathClick: PropTypes.func.isRequired,
onTabNavClick: PropTypes.func,
pathPrefix: PropTypes.array,
repoID: PropTypes.string.isRequired,
isViewFile: PropTypes.bool.isRequired,
};
class DirPath extends React.Component {
@@ -78,6 +81,11 @@ class DirPath extends React.Component {
<a className="path-link" data-path="/" onClick={this.onPathClick}>{repoName}</a>
}
{pathElem}
{ this.props.isViewFile &&
<InternalLinkDialog repoID={this.props.repoID}
path={this.props.currentPath}
/>
}
</div>
);
}