mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
optimize code detail
This commit is contained in:
@@ -10,9 +10,9 @@ import ShareDialog from '../dialog/share-dialog';
|
||||
const propTypes = {
|
||||
isLocked: PropTypes.bool.isRequired,
|
||||
lockedByMe: PropTypes.bool.isRequired,
|
||||
onSaveChangedContent: PropTypes.func,
|
||||
onSave: PropTypes.func,
|
||||
isSaving: PropTypes.bool,
|
||||
isContentChangedButNotSaved: PropTypes.bool,
|
||||
needSave: PropTypes.bool,
|
||||
toggleLockFile: PropTypes.func.isRequired,
|
||||
toggleCommentPanel: PropTypes.func.isRequired
|
||||
};
|
||||
@@ -108,7 +108,7 @@ class FileToolbar extends React.Component {
|
||||
<button type={'button'} className={'btn btn-icon btn-secondary btn-active'}>
|
||||
<i className={'fa fa-spin fa-spinner'}/></button> :
|
||||
(
|
||||
this.props.isContentChangedButNotSaved ?
|
||||
this.props.needSave ?
|
||||
<IconButton
|
||||
text={gettext('Save')}
|
||||
id={'saveButton'}
|
||||
@@ -116,7 +116,7 @@ class FileToolbar extends React.Component {
|
||||
// button imported in this file does not have functionalities of
|
||||
// isActive as button imported in markdowneditor has
|
||||
//isActive={!isContentChanged}
|
||||
onClick={this.props.onSaveChangedContent}
|
||||
onClick={this.props.onSave}
|
||||
/> :
|
||||
<button type={'button'} className={'btn btn-icon btn-secondary btn-active'} disabled>
|
||||
<i className={'fa fa-save'}/></button>
|
||||
@@ -148,7 +148,7 @@ class FileToolbar extends React.Component {
|
||||
<button type={'button'} className={'btn btn-icon btn-secondary btn-active'}>
|
||||
<i className={'fa fa-spin fa-spinner'}/></button> :
|
||||
(
|
||||
this.props.isContentChangedButNotSaved ?
|
||||
this.props.needSave ?
|
||||
<IconButton
|
||||
text={gettext('Save')}
|
||||
id={'saveButton'}
|
||||
@@ -156,7 +156,7 @@ class FileToolbar extends React.Component {
|
||||
// button imported in this file does not have functionalities of
|
||||
// isActive as button imported in markdowneditor has
|
||||
//isActive={!isContentChanged}
|
||||
onClick={this.props.onSaveChangedContent}
|
||||
onClick={this.props.onSave}
|
||||
/> :
|
||||
<button type={'button'} className={'btn btn-icon btn-secondary btn-active'} disabled>
|
||||
<i className={'fa fa-save'}/></button>
|
||||
|
@@ -10,10 +10,10 @@ import CommentPanel from './comment-panel';
|
||||
import '../../css/file-view.css';
|
||||
|
||||
const propTypes = {
|
||||
onSaveChangedContent: PropTypes.func,
|
||||
onSave: PropTypes.func,
|
||||
content: PropTypes.object.isRequired,
|
||||
isSaving: PropTypes.bool,
|
||||
isContentChangedButNotSaved: PropTypes.bool,
|
||||
needSave: PropTypes.bool,
|
||||
};
|
||||
|
||||
const { isStarred, isLocked, lockedByMe,
|
||||
@@ -85,9 +85,9 @@ class FileView extends React.Component {
|
||||
<FileToolbar
|
||||
isLocked={this.state.isLocked}
|
||||
lockedByMe={this.state.lockedByMe}
|
||||
onSaveChangedContent={this.props.onSaveChangedContent}
|
||||
onSave={this.props.onSave}
|
||||
isSaving={this.props.isSaving}
|
||||
isContentChangedButNotSaved={this.props.isContentChangedButNotSaved}
|
||||
needSave={this.props.needSave}
|
||||
toggleLockFile={this.toggleLockFile}
|
||||
toggleCommentPanel={this.toggleCommentPanel}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user