Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Upload images to Page Editor from File Manager Successfully #1165

Conversation

TommyJackson85
Copy link
Contributor

@TommyJackson85 TommyJackson85 commented Jul 27, 2020

Related Issue

Closes #1113

Your solution

UPDATE: issues relating to uploading images to file manager and modal have been fixed and so have been removed from this PR draft.

Replacing pb-editor-page-element-images-list-component with correct Plugin type pb-page-element-images-list-component. Images now load to editor after saving the selected images. See the screenshots below for more details.

How Has This Been Tested?

Console log and manual testing so far.

Screenshots (if relevant):

When dragging an image gallary in it first displays "No images to display" in the element you're trying to create a gallary in.
Screenshot 2020-08-06 at 21 00 04

After saving selected images in the modal, the images appear.
Screenshot 2020-08-06 at 21 00 32

@TommyJackson85
Copy link
Contributor Author

Can someone please tell me how to turn an Open PR into a Draft instead after already making it Open?

@Pavel910
Copy link
Collaborator

Pavel910 commented Jul 27, 2020

@TommyJackson85 When creating a PR, this is how you create a Draft PR:

image

If you want to convert an existing PR to Draft PR, it's in the top right corner of the PR:

image

@TommyJackson85 TommyJackson85 marked this pull request as draft July 28, 2020 16:43
@TommyJackson85 TommyJackson85 changed the title Fix: Upload images to File Manager and Page Editor Successfully Fix: Upload images to Page Editor from File Manager Successfully Aug 4, 2020
@TommyJackson85
Copy link
Contributor Author

TommyJackson85 commented Aug 4, 2020

@Pavel910 you can delete that comment about changing a PR into a draft if you wish :) then I will delete mine as its not relevant anymore to this PR.

I've narrowed this PR down to the issue of the error "Selected image gallery component not found!" appearing in the editor, as issues of uploading images to the file manager have already been fixed. If you have any advice on files to look at let me know. :)

@TommyJackson85
Copy link
Contributor Author

@Pavel910 does the ImageList rendering in the index.js file have anything to do with why the "Selected image gallery component not found!" error is added to editor straight away after initially dropping an Image Gallary button component? (its added at the same time the intial modal pop up happens)

I think if we first prevent this from happening, and by only adding an Image Gallery element (error or not) to be dropped once a user saves the Added Images (in the initial modal popup), we can narrow this error down at least. I feel nothing should happen to the editor until a user clicks save.

Furthermore testing: after dropping the Image Gallery button to the editor and clicking cancel on the modal popup, the newly added image gallary / error message remains there.

I want to find the files in "app-page-builder" that call the image drop functions. So far I found this list in editor/components but I don't know if this is the correct folder:
Screenshot 2020-08-05 at 15 58 47

@Pavel910
Copy link
Collaborator

Pavel910 commented Aug 6, 2020

@TommyJackson85 the fix for all of this is very simple because it's all caused by a mismatch in plugin type. So at this here reference: packages/app-page-builder/src/editor/plugins/elements/imagesList/ImagesList.tsx:10 simply update the type of the plugin being fetched to pb-page-element-images-list-component. You'll find that the wrong type prefix creeped in (pb-editor-) and that's the only thing that is causing that message to render at packages/app-page-builder/src/editor/plugins/elements/imagesList/ImagesList.tsx:15.

@TommyJackson85
Copy link
Contributor Author

@Pavel910 thanks again! I guess it was rendering the error as the other plugin didn't have a componentName key.
I make the changes and its working well! It now loads a "No Images To Display" message when first dropping in an ImageList button, but once you select images and save them it adds the images.

Screenshot 2020-08-06 at 21 00 04

Screenshot 2020-08-06 at 21 00 32

@TommyJackson85 TommyJackson85 marked this pull request as ready for review August 6, 2020 20:28
@TommyJackson85
Copy link
Contributor Author

@Pavel910 take a look and let me know if there are other changes needed. Merge this PR if you feel it is ready.

@Pavel910
Copy link
Collaborator

Pavel910 commented Aug 7, 2020

@TommyJackson85 that's it, thanks! It was rendering an error because there were no plugins registered with that type at all. We messed up the plugin type during one of our updates (I guess it was a bad find/replace).

Merging this! 🚀

@Pavel910 Pavel910 merged commit b5bf3f2 into webiny:master Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"image gallery component not found" when using the image gallery page element
2 participants