fix: submit when uploading img cause img failure (#529)

* fix: submit when uploading img cause img failure

* Revert "fix: submit when uploading img cause img failure"

This reverts commit b951f79153.

* fix: submit when uploading img cause img failure

* fix

* fix

* format
This commit is contained in:
Ryao 2022-08-03 01:24:50 +08:00 committed by GitHub
parent f62f30e8dc
commit 1b92c06349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 7 deletions

View File

@ -358,3 +358,7 @@ export function getThemeBtnUrl() {
return getStatic(`/img/toggle-${themeMode}.png`);
}
export function isFileUploading(value) {
return value !== undefined && value.includes("![Uploading file...]()");
}

View File

@ -182,7 +182,7 @@ class AdminFrontConf extends React.Component {
justifyContent: "space-between",
}}
>
<button onClick={this.updateConf.bind(this)} type="submit" className="super normal button">
<button onClick={this.updateConf.bind(this)} type="submit" disabled={Setting.isFileUploading(this.state.content)} className="super normal button">
<li className={this.state.publishClicked ? "fa fa-circle-o-notch fa-spin" : "fa fa-paper-plane"} />
&nbsp;{this.state.publishClicked ? i18next.t("new:Publishing...") : i18next.t("frontConf:Save")}
</button>

View File

@ -824,7 +824,7 @@ class AdminNode extends React.Component {
<tr>
<td width="120" align="right"></td>
<td width="auto" align="left">
{!newNode ? <input type="submit" className="super normal button" value={i18next.t("node:Save")} onClick={() => this.updateNodeInfo()} /> : null}
{!newNode ? <input type="submit" disabled={Setting.isFileUploading(this.state.form.desc)} className="super normal button" value={i18next.t("node:Save")} onClick={() => this.updateNodeInfo()} /> : null}
</td>
</tr>
{newNode ? (

View File

@ -281,7 +281,7 @@ class EditBox extends React.Component {
<tr>
<td style={{display: "flex", justifyContent: "space-between"}}>
<div>
<input type="submit" value={i18next.t("edit:Save")} className="super normal button" onClick={() => this.editContent()} />
<input type="submit" value={i18next.t("edit:Save")} disabled={Setting.isFileUploading(this.state.form.content)} className="super normal button" onClick={() => this.editContent()} />
</div>
{this.renderEditorSelect()}
</td>
@ -334,7 +334,7 @@ class EditBox extends React.Component {
/>
<td style={{display: "flex", justifyContent: "space-between"}}>
<div>
<input type="submit" value={i18next.t("edit:Save")} className="super normal button" onClick={() => this.editContent()} />
<input type="submit" value={i18next.t("edit:Save")} disabled={Setting.isFileUploading(this.state.form.content)} className="super normal button" onClick={() => this.editContent()} />
</div>
{this.renderEditorSelect()}
</td>

View File

@ -395,7 +395,7 @@ class NewBox extends React.Component {
<div className="cell">
<div className="fr">
<span id="error_message" /> &nbsp;
<button type="button" className="super normal button" onClick={this.publishTopic.bind(this)}>
<button type="button" disabled={Setting.isFileUploading(this.state.form.body)} className="super normal button" onClick={this.publishTopic.bind(this)}>
<li className={this.state.publishClicked ? "fa fa-circle-o-notch fa-spin" : "fa fa-paper-plane"} />
&nbsp;{this.state.publishClicked ? i18next.t("new:Publishing...") : i18next.t("new:Publish")}
</button>

View File

@ -465,7 +465,7 @@ class NewNodeTopicBox extends React.Component {
{i18next.t("newNodeTopic:Preview")}{" "}
</button>{" "}
&nbsp;
<button type="submit" className="super normal button" onClick={this.publishTopic.bind(this)}>
<button type="submit" disabled={Setting.isFileUploading(this.state.form.body)} className="super normal button" onClick={this.publishTopic.bind(this)}>
<li className="fa fa-paper-plane"></li>
&nbsp;
{i18next.t("newNodeTopic:Publish")}{" "}

View File

@ -427,7 +427,7 @@ class NewReplyBox extends React.Component {
justifyContent: "space-between",
}}
>
<button style={blurStyle} onClick={this.publishReply.bind(this)} type="submit" className="super normal button">
<button style={blurStyle} onClick={this.publishReply.bind(this)} type="submit" disabled={Setting.isFileUploading(this.state.form.content)} className="super normal button">
<li className={this.state.publishClicked ? "fa fa-circle-o-notch fa-spin" : "fa fa-paper-plane"} />
&nbsp;{this.state.publishClicked ? i18next.t("new:Publishing...") : i18next.t("reply:Reply")}
</button>