From 1534d1e737ac72890c50ea804577f4e2ebbe0fbd Mon Sep 17 00:00:00 2001 From: ilearnit Date: Thu, 11 Apr 2019 18:04:23 +0800 Subject: [PATCH] modify pushlished draft jump (#3240) --- frontend/src/draft.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/draft.js b/frontend/src/draft.js index 6feaf52800..a7e854fc56 100644 --- a/frontend/src/draft.js +++ b/frontend/src/draft.js @@ -55,6 +55,7 @@ class Draft extends React.Component { reviewers: [], inResizing: false, rightPartWidth: 30, + freezePublish: false }; this.quote = ''; this.newIndex = null; @@ -414,8 +415,9 @@ class Draft extends React.Component { onPublishDraft = () => { seafileAPI.publishDraft(draftID).then(res => { - const OriginFileLink = siteRoot + 'lib/' + draftRepoID + '/file' + Utils.encodePath(res.data.published_file_path); - window.location.href = OriginFileLink; + this.setState({ + freezePublish: !this.state.freezePublish + }) }); } @@ -760,6 +762,8 @@ class Draft extends React.Component { render() { const onResizeMove = this.state.inResizing ? this.onResizeMouseMove : null; const draftLink = siteRoot + 'lib/' + draftRepoID + '/file' + draftFilePath + '?mode=edit'; + const freezePublish = (this.state.freezePublish || draftStatus === 'published') ? true : false; + const canPublish = !this.state.freezePublish && draftFileExists; return(
{this.renderDiffButton()} - {draftFileExists && + {canPublish &&