Skip to content

Commit

Permalink
fix: fix mr editor loading plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
laojun committed Jun 28, 2024
1 parent e97603f commit 24a2f82
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions shell/app/common/components/markdown-editor/upload-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import { getCSRFToken } from 'core/config';
import i18n from 'i18n';
import './upload-plugin.scss';

let isLoading = false;
let hideLoading: any;
const UploadPlugin = (props: any) => {
let hideLoading: any;
// let hideLoading: any;
const getUploadProps = (isImage?: boolean) => ({
action: '/api/files',
showUploadList: false,
Expand All @@ -38,7 +40,8 @@ const UploadPlugin = (props: any) => {
},
onChange: ({ file }: any) => {
const { status, response } = file;
if (status === 'uploading' && !hideLoading) {
if (status === 'uploading' && !hideLoading && !isLoading) {
isLoading = true;
hideLoading = message.loading(`${i18n.t('uploading')}...`, 0);
}
if (!response) {
Expand All @@ -47,6 +50,7 @@ const UploadPlugin = (props: any) => {
hideLoading && hideLoading();
hideLoading = undefined;
const { success, err, data } = response;
isLoading = false;
if (!success) {
message.error(err.msg);
} else {
Expand Down

0 comments on commit 24a2f82

Please sign in to comment.