-
Notifications
You must be signed in to change notification settings - Fork 52
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
Can't upload images in editor. #142
Comments
Thank you!! This is your first issue on this repo |
I came here to report this issue, but I see it has been happening already for a longer period of time. Does anybody know a solution? Seems to be an Event handler issue, when adding an OnClick to the button to activate the input that's inside the button tag, I can upload an image and it gets selected. |
I noticed a CORS error; Does this mean that the answer is simply, "nope, can't do anything about that". Or do I need to have an unlayer account to resolve this issue? Or are the templates stored somewhere within the codebase, so I could replace them in the code? |
have you tried to edit the |
@creazy231, personally I have copy-pasted the configuration settings from the readme page and replaced my existing "strapi::security" string in config/middleware.ts as followed:
ps. I don't see how the local configuration would affect the server configuration of unlayer. |
It's not about unlayer, it's about strapi backend require same origin if not enabled in so you could try to add the following: {
name: "strapi::security",
config: {
contentSecurityPolicy: {
directives: {
"script-src": ["'self'", "editor.unlayer.com"],
"frame-src": ["'self'", "editor.unlayer.com"],
"img-src": [
"'self'",
"data:",
"cdn.jsdelivr.net",
"strapi.io",
"s3.amazonaws.com",
"api.tools.unlayer.com",
],
},
},
},
}, |
Hi @creazy231, Thank you for the quick reply; I have added the strapi.io value to the img-src array, which made no difference. I have also tried to add localhost:1337 (since this is where I run the Stapi app from) but that did not work neither. Perhaps unrelated (perhaps not). But I do get another CORS error. This one shows up (twice) when I just refresh the template editing page (/admin/plugins/email-designer/core/user-address-confirmation). Most likely this should be reported as its own issue, but I thought I would share it nonetheless, since it might provide some valuable additional context.
|
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
directives: {
"script-src": ["'self'", "'unsafe-eval'", "editor.unlayer.com"],
"frame-src": ["'self'", "editor.unlayer.com"],
"img-src": [
"'self'",
"data:",
"cdn.jsdelivr.net",
"strapi.io",
"s3.amazonaws.com",
],
},
},
},
}, should fix your last error, but can you tell what api.tools.unlayer.com tries to load? An image or js or something? |
Both of your solutions seem to have helped. The CORS error I was getting, was caused by modifying the image. That is now gone. I have also tried to generate an AI image, which also works. So 2 out of 3 are working now, which is great. But which is not what the original issue is about. The original issue is about the upload image button not working. Just like the original author of this issue, nothing happens when I click on the upload image button. No error message, nothing. This occurs to me on a fresh installation of Strapi 4, and following the steps as described in the Readme Screen recording: In order to replicate, please follow the following stepsInstall strapi + strapi-plugin-email-designer
Update config/middleware.js
Run |
Bug report
Describe the bug
'Upload Image' button within Image content block is not working. Browser devtools show event listener as an empty function.
Steps to reproduce the behavior
Expected behavior
The button should open a file browser or drag & drop file input.
Screenshots
Button event listener:
editor.js in sources panel showing Qr():
Code snippets
Strapi security middleware configured as per docs. Also set 'unsafe-inline' and CORS origin to '*' for troubleshooting purposes:
System
The text was updated successfully, but these errors were encountered: