-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
drag and drop images doesn't work #337
Comments
I have the same problem, please solve it |
@mr-nazari feel free to provide a patch I will make the release. |
Can anyone help me with how to insert a local image? |
You need to write the JS uploader and then the Django view to handle the upload yourself. Here's what I did to achieve this where I use Django Storages as the backend but I use default_storage to write the file to the backend so everything should work for you with the exception of the full URL to the uploaded file. Step 1.
The first is the path to which you would like the javascript to make the POST. The 2nd is the name of the javascript function to handle the upload Step 2 Add the below into your settings.py to tell it yo include two additional JS file. I'm using the jsdelivr CDN hosted version for the above package
The second file is holds the custom JS file upload handler I will post below. Step 3.
Step 4 The key part is to return a JSONResponse with the location of the image you just uploaded. In my case I am using Django Storages to store files on S3 but I serve them from AWS Cloudfront using a custom domain that I have set within settings.py so I append that to the start
Now I can upload images using the TinvMCE plugin ensuring that CSRF checks are made |
Thanks for your package :)
Drag and Drop images using the paste plugin doesn't seem to work:
returns "dropped file top not supported".
It works fine in the plain JS version so I was wondering if this is disabled on Django ?
I would appreciate any assistance on how to use drag and drop images OR add images easily. Thanks!
The text was updated successfully, but these errors were encountered: