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 }) => {
const isDisabled =
context.options.uploading || !item.select(activeView) || !isEditable;
useEffect(() => {}, []);
const ImageUploadComponent = useMemo(
() => (
<Wrapper>
<label htmlFor="file-upload">
<MenuButton
active={false}
disabled={
context.options.uploading ||
!item.select(activeView) ||
!isEditable
}
disabled={isDisabled}
iconName={item.icon}
onMouseDown={e => {
e.preventDefault();
......
......@@ -38,6 +38,7 @@ export default (view, fileUpload, placeholderPlugin, context) => file => {
}
// Otherwise, insert it at the placeholder's position, and remove
// the placeholder
context.setOption({ uploading: false });
context.pmViews.main.dispatch(
context.pmViews.main.state.tr
.replaceWith(
......@@ -51,7 +52,6 @@ export default (view, fileUpload, placeholderPlugin, context) => file => {
)
.setMeta(placeholderPlugin, { remove: { id } }),
);
context.setOption({ uploading: false });
},
() => {
// 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