1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00
Files
seahub/frontend/src/components/operations/internal-link-operation.js

50 lines
1.3 KiB
JavaScript
Raw Normal View History

import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import InternalLinkDialog from '../dialog/internal-link-dialog';
import './internal-link-operation.css';
const propTypes = {
repoID: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
};
class InternalLinkOperation extends React.Component {
constructor(props) {
super(props);
this.state = {
isShowInternalLinkDialog: false
};
}
onInternalLinkDialogToggle = () => {
2024-07-18 11:58:42 +08:00
this.setState({ isShowInternalLinkDialog: !this.state.isShowInternalLinkDialog });
};
render() {
const { repoID, path } = this.props;
const { isShowInternalLinkDialog } = this.state;
const title = gettext('Internal Link');
return (
<Fragment>
<span className='dialog-operation'>
<i className="file-internal-link sf3-font sf3-font-link" title={title} aria-label={title} onClick={this.onInternalLinkDialogToggle}/>
</span>
{isShowInternalLinkDialog && (
<InternalLinkDialog
repoID={repoID}
path={path}
onInternalLinkDialogToggle={this.onInternalLinkDialogToggle}
/>
)}
</Fragment>
);
}
}
InternalLinkOperation.propTypes = propTypes;
export default InternalLinkOperation;