1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-16 00:06:11 +00:00

fix auto save draft (#3279)

This commit is contained in:
Michael An 2019-04-15 12:09:58 +08:00 committed by Daniel Pan
parent 01c509f724
commit 2ec5c855e1
2 changed files with 10 additions and 6 deletions

View File

@ -26,6 +26,7 @@ const propTypes = {
readOnly: PropTypes.bool.isRequired,
contentChanged: PropTypes.bool.isRequired,
saving: PropTypes.bool.isRequired,
showDraftSaved: PropTypes.bool.isRequired,
};
const MoreMenuPropTypes = {
@ -92,8 +93,12 @@ class MarkdownViewerToolbar extends React.Component {
return (
<div className="sf-md-viewer-topbar">
<div className="sf-md-viewer-topbar-first d-flex justify-content-between">
<FileInfo toggleStar={this.props.toggleStar} editorUtilities={this.props.editorUtilities}
fileInfo={this.props.fileInfo}/>
<FileInfo
toggleStar={this.props.toggleStar}
editorUtilities={this.props.editorUtilities}
fileInfo={this.props.fileInfo}
showDraftSaved={this.props.showDraftSaved}
/>
{(this.props.hasDraft && !this.props.isDraft) &&
<div className='seafile-btn-view-review'>
<div className='tag tag-green'>{gettext('This file is in draft stage.')}

View File

@ -430,10 +430,9 @@ class MarkdownEditor extends React.Component {
localDraftDialog: false,
loading: false,
});
} else {
let draftKey = editorUtilities.getDraftKey();
localStorage.removeItem(draftKey);
}
let draftKey = editorUtilities.getDraftKey();
localStorage.removeItem(draftKey);
}
closeDraftDialog = () => {
@ -714,6 +713,7 @@ class MarkdownEditor extends React.Component {
editorMode={this.state.editorMode}
contentChanged={this.state.contentChanged}
saving={this.state.saving}
showDraftSaved={this.state.showDraftSaved}
/>
<SeafileEditor
fileInfo={this.state.fileInfo}
@ -737,7 +737,6 @@ class MarkdownEditor extends React.Component {
clearTimer={this.clearTimer}
openDialogs={this.openDialogs}
deleteDraft={this.deleteDraft}
showDraftSaved={this.state.showDraftSaved}
readOnly={this.state.readOnly}
onContentChanged={this.onContentChanged}
onSaving={this.onSaving}