mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
optimize save button's status
This commit is contained in:
@@ -11,6 +11,8 @@ const propTypes = {
|
||||
isLocked: PropTypes.bool.isRequired,
|
||||
lockedByMe: PropTypes.bool.isRequired,
|
||||
onSaveChangedContent: PropTypes.func.isRequired,
|
||||
isSaving: PropTypes.bool.isRequired,
|
||||
isContentChangedButNotSaved: PropTypes.bool.isRequired,
|
||||
toggleLockFile: PropTypes.func.isRequired,
|
||||
toggleCommentPanel: PropTypes.func.isRequired
|
||||
};
|
||||
@@ -95,17 +97,24 @@ class FileToolbar extends React.Component {
|
||||
/>
|
||||
)}
|
||||
{(canEditFile && !err) &&
|
||||
(<IconButton
|
||||
text={gettext('Save')}
|
||||
id={'saveButton'}
|
||||
icon={'fa fa-save'}
|
||||
// button imported in this file does not have functionalities of
|
||||
// disabled, isActive as button imported in markdowneditor has
|
||||
//disabled={isContentChanged}
|
||||
//isActive={!isContentChanged}
|
||||
onClick={this.props.onSaveChangedContent}
|
||||
/>
|
||||
)}
|
||||
( this.props.isSaving ?
|
||||
<button type={'button'} className={'btn btn-icon btn-secondary btn-active'}>
|
||||
<i className={'fa fa-spin fa-spinner'}/></button> :
|
||||
(
|
||||
this.props.isContentChangedButNotSaved ?
|
||||
<IconButton
|
||||
text={gettext('Save')}
|
||||
id={'saveButton'}
|
||||
icon={'fa fa-save'}
|
||||
// button imported in this file does not have functionalities of
|
||||
// isActive as button imported in markdowneditor has
|
||||
//isActive={!isContentChanged}
|
||||
onClick={this.props.onSaveChangedContent}
|
||||
/> :
|
||||
<button type={'button'} className={'btn btn-icon btn-secondary btn-active'} disabled>
|
||||
<i className={'fa fa-save'}/></button>
|
||||
)
|
||||
)}
|
||||
{canDownloadFile && (
|
||||
<IconButton
|
||||
id="download-file"
|
||||
|
@@ -11,7 +11,9 @@ import '../../css/file-view.css';
|
||||
|
||||
const propTypes = {
|
||||
onSaveChangedContent: PropTypes.func.isRequired,
|
||||
content: PropTypes.object.isRequired
|
||||
content: PropTypes.object.isRequired,
|
||||
isSaving: PropTypes.bool.isRequired,
|
||||
isContentChangedButNotSaved: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
const { isStarred, isLocked, lockedByMe,
|
||||
@@ -84,6 +86,8 @@ class FileView extends React.Component {
|
||||
isLocked={this.state.isLocked}
|
||||
lockedByMe={this.state.lockedByMe}
|
||||
onSaveChangedContent={this.props.onSaveChangedContent}
|
||||
isSaving={this.props.isSaving}
|
||||
isContentChangedButNotSaved={this.props.isContentChangedButNotSaved}
|
||||
toggleLockFile={this.toggleLockFile}
|
||||
toggleCommentPanel={this.toggleCommentPanel}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user