Comments (21)
I've added this feature now to develop
but will need to do some testing before creating a release.
The original PR (2015?) from this thread was very useful but it made a lot of changes to the code, including removing the submodules and hard-coding the pagedown library. Furthermore it relied on an ajax file upload external library as well as jQuery UI.
I've taken this PR and stripped it back to add basic image upload functionality.
from django-pagedown.
A few comments on the handling of the file server-side, I would recommend delegating that job to a django ImageField as shown here:
https://docs.djangoproject.com/en/3.0/ref/forms/fields/#django.forms.ImageField
and here:
https://docs.djangoproject.com/en/3.0/topics/http/file-uploads/
this will add the pillow dependency though, but that is not a particular burden. It will detect file types and deals with many other potential security issues. That being said if the javascript part of the upload works with the current setup we can refactor the Python code and make a pull request as long as you would entertain that idea..
from django-pagedown.
+1
from django-pagedown.
@timmyomahony thanks a lot. Optional via setting would be fine too. Would be happy to make a small donation if it helps to free some of your time.
from django-pagedown.
Not at the moment unfortunately. It's something I want to add and there has been a pull request with an approach but I haven't had time to review it or implement it yet.
from django-pagedown.
django-pagedown is very useful for me . Now i need a way to upload image and insert it into my markdown . i have no idea to solved this problem.do you have any solution to solve it ? THX
from django-pagedown.
I gave a pull request for image upload functionality , see that..
from django-pagedown.
+1
from django-pagedown.
+1
from django-pagedown.
any way to speed up image upload functionality? Perhaps with a donation in order to buy time for this add-on ? it would be very useful.
from django-pagedown.
Hi @gurugeek I'm going to have a look at adding this. The reason I haven't added it to date is that it's not a part of the editor. I should be able to add it though without hugely affecting the default experience. Maybe it could be enabled as an optional feature via a setting
from django-pagedown.
@timmyomahony thanks a lot for working on this. I will test it too!
from django-pagedown.
Hi @ialbert, happy to use forms + imagefield + native validation if you have a PR. I don't think the JS would need to change? We'd just need a form that has a file = ImageField(...)
.
from django-pagedown.
@timmyomahony i am not sure if @ialbert will refactor the code with Python or we currently stick with your recent dev version?
from django-pagedown.
How do I install the develop branch version with pip? Is the pip command the same?
from django-pagedown.
any chance to add some easy instructions for pip install ?
from django-pagedown.
I did manage to install with pip3
ids-MacBook-Pro david_dev_django % pip3 install https://github.com/timmyomahony/django-pagedown/archive/develop.zip
Collecting https://github.com/timmyomahony/django-pagedown/archive/develop.zip
Using cached https://github.com/timmyomahony/django-pagedown/archive/develop.zip
Requirement already satisfied: Django>=2.1 in /usr/local/lib/python3.7/site-packages (from django-pagedown==2.0.3) (3.0.2)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/site-packages (from Django>=2.1->django-pagedown==2.0.3) (2018.9)
Requirement already satisfied: sqlparse>=0.2.2 in /usr/local/lib/python3.7/site-packages (from Django>=2.1->django-pagedown==2.0.3) (0.2.4)
Requirement already satisfied: asgiref~=3.2 in /usr/local/lib/python3.7/site-packages (from Django>=2.1->django-pagedown==2.0.3) (3.2.3)
Building wheels for collected packages: django-pagedown
Building wheel for django-pagedown (setup.py) ... done
Created wheel for django-pagedown: filename=django_pagedown-2.0.3-py3-none-any.whl size=10122 sha256=35f74d4ce8e2f7816c0f232b106ec71ef5de3acf1e72dcecf5c2894c53b5809f
Stored in directory: /private/var/folders/w4/tqwp2zcd3r7_p4nflvl0mkth0000gn/T/pip-ephem-wheel-cache-2cjuyq7g/wheels/1e/0f/ec/fa477da3e48a074a16da13e12ab59ff6cb4afdadbe9e8fcc79
Successfully built django-pagedown
Installing collected packages: django-pagedown
Successfully installed django-pagedown-2.0.3
gurugeek@Davids-MacBook-Pro david_dev_django % python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
but unfortunately it still shows no option for the image upload? :(
from django-pagedown.
It's in the "develop" branch, not the master.
I pip installed the develop branch version with this:
pip install -e git+https://github.com/timmyomahony/django-pagedown.git@develop#egg=django-pagedown
from django-pagedown.
Sorry, I haven't had a chance to sit down and review this before pulling it into master so it's still just a feature in develop
. I'm going to try get to this ASAP
from django-pagedown.
Hey @timmyomahony Thanks for the feature, much needed!
Is this feature implementation mature enough to be used? I mean I could pull it from the develop
branch but I not sure if I can use it in production?
from django-pagedown.
I've modified the image upload functionality to use ImageField
now and I've pulled the changes into version 2.1.1. Please try it out and let me know if there are any issues.
from django-pagedown.
Related Issues (20)
- 'default_app_config' is deprecated in Django 3.2.X HOT 2
- I get a: ModuleNotFoundError: No module named 'pagedown.urls' HOT 2
- Can you add a feature so LaTeX/MathJax renders in the preview? HOT 1
- Accidentally double-tapping the "save" button when adding an image
- Not compatible with dark mode introduced in Django 3.2
- Write some tests
- Needed JS? HOT 1
- Does this support Python 3? HOT 2
- pip install django-pagedown not working fine. HOT 4
- Widget doesn't work on forms that are part of formsets HOT 2
- Django admin page raise TypeError HOT 1
- content = forms.TextField(widget=PagedownWidget()) Doesn't work on Djnago 2.0 HOT 7
- Space before URL results in malformed URL in markdown HOT 4
- Django 2.2 requires jquery to be set as dependency HOT 1
- Add to Django Packages -> Markdown Category HOT 1
- Customise form site attributes doesn't seem to work HOT 2
- Where do you put the widget customization? HOT 1
- Collectstatic pulling in demo project css HOT 2
- Collect Static does not collect pagedown.css HOT 4
- Mobile display issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-pagedown.