Skip to content
Snippets Groups Projects
Commit 182a85a4 authored by chris's avatar chris
Browse files

fix image upload

parent 3abdacb9
No related branches found
No related tags found
No related merge requests found
...@@ -67,19 +67,13 @@ const ImageUpload = ({ item, fileUpload, view }) => { ...@@ -67,19 +67,13 @@ const ImageUpload = ({ item, fileUpload, view }) => {
const isDisabled = const isDisabled =
context.options.uploading || !item.select(activeView) || !isEditable; context.options.uploading || !item.select(activeView) || !isEditable;
useEffect(() => {}, []);
const ImageUploadComponent = useMemo( const ImageUploadComponent = useMemo(
() => ( () => (
<Wrapper> <Wrapper>
<label htmlFor="file-upload"> <label htmlFor="file-upload">
<MenuButton <MenuButton
active={false} active={false}
disabled={ disabled={isDisabled}
context.options.uploading ||
!item.select(activeView) ||
!isEditable
}
iconName={item.icon} iconName={item.icon}
onMouseDown={e => { onMouseDown={e => {
e.preventDefault(); e.preventDefault();
......
...@@ -38,6 +38,7 @@ export default (view, fileUpload, placeholderPlugin, context) => file => { ...@@ -38,6 +38,7 @@ export default (view, fileUpload, placeholderPlugin, context) => file => {
} }
// Otherwise, insert it at the placeholder's position, and remove // Otherwise, insert it at the placeholder's position, and remove
// the placeholder // the placeholder
context.setOption({ uploading: false });
context.pmViews.main.dispatch( context.pmViews.main.dispatch(
context.pmViews.main.state.tr context.pmViews.main.state.tr
.replaceWith( .replaceWith(
...@@ -51,7 +52,6 @@ export default (view, fileUpload, placeholderPlugin, context) => file => { ...@@ -51,7 +52,6 @@ export default (view, fileUpload, placeholderPlugin, context) => file => {
) )
.setMeta(placeholderPlugin, { remove: { id } }), .setMeta(placeholderPlugin, { remove: { id } }),
); );
context.setOption({ uploading: false });
}, },
() => { () => {
// On failure, just clean up the placeholder // On failure, just clean up the placeholder
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment