Fixes: Image uploads not working
This commit is contained in:
@@ -19,6 +19,7 @@ class DropToImport extends Component {
|
||||
activeClassName?: string,
|
||||
rejectClassName?: string,
|
||||
documents: DocumentsStore,
|
||||
disabled: boolean,
|
||||
history: Object,
|
||||
};
|
||||
state = {
|
||||
@@ -83,9 +84,12 @@ class DropToImport extends Component {
|
||||
'history',
|
||||
'documentId',
|
||||
'collectionId',
|
||||
'documents'
|
||||
'documents',
|
||||
'disabled'
|
||||
);
|
||||
|
||||
if (this.props.disabled) return this.props.children;
|
||||
|
||||
return (
|
||||
<Dropzone
|
||||
accept="text/markdown, text/plain"
|
||||
|
||||
@@ -26,8 +26,8 @@ const createPlugins = ({ onImageUploadStart, onImageUploadStop }: Options) => {
|
||||
DropOrPasteImages({
|
||||
extensions: ['png', 'jpg', 'gif'],
|
||||
applyTransform: async (transform, file) => {
|
||||
onImageUploadStart();
|
||||
try {
|
||||
onImageUploadStart();
|
||||
const asset = await uploadFile(file);
|
||||
const alt = file.name;
|
||||
const src = asset.url;
|
||||
@@ -39,6 +39,7 @@ const createPlugins = ({ onImageUploadStart, onImageUploadStop }: Options) => {
|
||||
});
|
||||
} catch (err) {
|
||||
// TODO: Show a failure alert
|
||||
console.error(err);
|
||||
} finally {
|
||||
onImageUploadStop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user