Skip to content

Commit

Permalink
修复键盘任务中的图片上传逻辑,添加只读状态以防止重复上传
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Oct 30, 2024
1 parent 9944090 commit f2f31a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/MarkdownEditor/editor/utils/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,15 @@ export class KeyboardTask {
);
};
input.onchange = async (e: any) => {
if (input.dataset.readonly) {
return;
}
input.dataset.readonly = 'true';
const hideLoading = message.loading('Uploading...');
try {
const url =
(await this.props?.image?.upload?.(
Array.from(e.target.files) || [],
(Array.from(e.target.files) as File[]) || [],
)) || [];
[url].flat().forEach((u: string) => {
insertMedia(u);
Expand Down

1 comment on commit f2f31a7

@vercel
Copy link

@vercel vercel bot commented on f2f31a7 Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.