From 182a85a40db35386ece7bc9c0a8e3a62f65aaa7f Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Mon, 4 Sep 2023 18:18:27 +0300 Subject: [PATCH] fix image upload --- .../src/ImageService/components/ImageUpload.js | 8 +------- wax-prosemirror-services/src/ImageService/fileUpload.js | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/wax-prosemirror-services/src/ImageService/components/ImageUpload.js b/wax-prosemirror-services/src/ImageService/components/ImageUpload.js index 1be9b56fb..26a59f7e9 100644 --- a/wax-prosemirror-services/src/ImageService/components/ImageUpload.js +++ b/wax-prosemirror-services/src/ImageService/components/ImageUpload.js @@ -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(); diff --git a/wax-prosemirror-services/src/ImageService/fileUpload.js b/wax-prosemirror-services/src/ImageService/fileUpload.js index 3275e45bd..901abff91 100644 --- a/wax-prosemirror-services/src/ImageService/fileUpload.js +++ b/wax-prosemirror-services/src/ImageService/fileUpload.js @@ -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 -- GitLab