Skip to content

Commit e286eda

Browse files
committed
remove insert placeholder event handler after upload success
1 parent d885025 commit e286eda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

web_src/js/features/comp/EditorUpload.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ async function handleUploadFiles(editor, dropzoneEl, files, e) {
101101

102102
// Placeholders should be inserted on uploading the thumnail.
103103
// If not, the check upload process may fail
104-
dropzoneEl.dropzone.on('thumbnail', () => {
105-
editor.insertPlaceholder(placeholder);
106-
});
104+
const handleInsertPlaceholder = () => editor.insertPlaceholder(placeholder);
105+
dropzoneEl.dropzone.on('thumbnail', handleInsertPlaceholder);
107106
await uploadFile(dropzoneEl, file); // the "file" will get its "uuid" during the upload
107+
dropzoneEl.dropzone.off('thumbnail', handleInsertPlaceholder);
108108
editor.replacePlaceholder(placeholder, generateMarkdownLinkForAttachment(file, {width, dppx}));
109109
}
110110
}

0 commit comments

Comments
 (0)