1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-08 18:30:53 +00:00

rewrote 'text file view' & tidied 'file view' code (#2996)

This commit is contained in:
llj
2019-02-25 18:09:17 +08:00
committed by Daniel Pan
parent 9e38f38fd8
commit 4438708040
12 changed files with 321 additions and 485 deletions

View File

@@ -3,18 +3,17 @@ import PropTypes from 'prop-types';
import moment from 'moment';
import { processor } from '@seafile/seafile-editor/dist/utils/seafile-markdown2html';
import { Button, Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
import { gettext } from '../utils/constants';
import { seafileAPI } from '../utils/seafile-api';
import '../css/comments-list.css';
import { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import '../../css/comments-list.css';
const { repoID, filePath } = window.app.pageOptions;
const { username } = window.app.userInfo;
const { username, repoID, filePath } = window.app.pageOptions;
const CommentsListPropTypes = {
toggleCommentsList: PropTypes.func.isRequired
const CommentPanelPropTypes = {
toggleCommentPanel: PropTypes.func.isRequired
};
class CommentsList extends React.Component {
class CommentPanel extends React.Component {
constructor(props) {
super(props);
@@ -74,7 +73,7 @@ class CommentsList extends React.Component {
return (
<div className="seafile-comment">
<div className="seafile-comment-title">
<div onClick={this.props.toggleCommentsList} className={'seafile-comment-title-close'}>
<div onClick={this.props.toggleCommentPanel} className={'seafile-comment-title-close'}>
<i className={'fa fa-times-circle'}/>
</div>
<div className={'seafile-comment-title-text'}>{gettext('Comments')}</div>
@@ -126,7 +125,7 @@ class CommentsList extends React.Component {
}
}
CommentsList.propTypes = CommentsListPropTypes;
CommentPanel.propTypes = CommentPanelPropTypes;
const commentItemPropTypes = {
@@ -212,4 +211,4 @@ class CommentItem extends React.Component {
CommentItem.propTypes = commentItemPropTypes;
export default CommentsList;
export default CommentPanel;

View File

@@ -16,7 +16,7 @@ const {
canLockUnlockFile,
repoID, repoName, parentDir, filePerm, filePath,
canEditFile, err,
encoding, // for 'edit', not undefined only for some kinds of files
fileEnc, // for 'edit', not undefined only for some kinds of files (e.g. text file)
canDownloadFile, enableComment
} = window.app.pageOptions;
@@ -70,7 +70,7 @@ class FileToolbar extends React.Component {
icon="fa fa-edit"
text={gettext('Edit')}
tag="a"
href={`${siteRoot}repo/${repoID}/file/edit/?p=${encodeURIComponent(filePath)}&file_enc=${encodeURIComponent(encoding)}`}
href={`${siteRoot}repo/${repoID}/file/edit/?p=${encodeURIComponent(filePath)}&file_enc=${encodeURIComponent(fileEnc)}`}
/>
)}
{canDownloadFile && (