Comments (6)
Hello @eriktelepovsky @lopify @enjoy-software @mvaled @kfconsultant
Thank you for reporting this issue. We just realize that there is bit misconfiguration in this PR #201
Meanwhile we have resolved this issue in the latest version 1.6.38. Please update your package to fix it:
pip3 install martor --upgrade
from django-markdown-editor.
I think I got the same problem and I solved it.
If you configure like this on django version 4.2
urls.py
urlpatterns = [
...
path(
'api/uploader/', markdown_uploader, name='markdown_uploader_page'
),
path('martor/', include('martor.urls')),
]
settings.py
MARTOR_UPLOAD_URL = '/api/uploader/' # change to local uploader
Martor upload url will request domain.com/martor/api/uploader
.
So you have to modiy path
urls.py
urlpatterns = [
...
# Remember to set it above martor/, django will detect the first matching path.
path(
'martor/api/uploader/', markdown_uploader, name='markdown_uploader_page'
),
path('martor/', include('martor.urls')),
]
from django-markdown-editor.
I'm getting a 403 error because I don´t use IMGUR. And trying to upload an image results in
{"data":{"error":"Invalid client_id","request":"\/3\/upload.json","method":"POST"},"success":false,"status":403}
Maybe this not taking into account the URL is the actual cause.
from django-markdown-editor.
I am able to config and save the image in the local storage after downgrading to martor==1.6.26 and update the following files.
`# project urls.py
path('martor/', include('martor.urls')),
path('', include('markdowneditor.urls')), `
`# app urls.py
path('api/uploader/', markdown_uploader, name='markdown_uploader_page'),`
`# settings.py
MARTOR_ENABLE_CONFIGS = {
'emoji': 'true', # to enable/disable emoji icons.
'imgur': 'true', # to enable/disable imgur/custom uploader.
'mention': 'false', # to enable/disable mention
'jquery': 'true', # to include/revoke jquery (require for admin default django)
'living': 'false', # to enable/disable live updates in preview
'spellcheck': 'false', # to enable/disable spellcheck in form textareas
'hljs': 'true', # to enable/disable hljs highlighting in preview
'imgur': 'true', # to enable/disable imgur uploader/custom uploader.
'mention': 'true', # to enable/disable mention
'jquery': 'true', # to include/revoke jquery (require for admin default django)
}
MAX_IMAGE_UPLOAD_SIZE = 5242880 # 50MB
import time
MARTOR_UPLOAD_PATH = 'images/uploads/{}'.format(time.strftime("%Y/%m/%d/"))
MARTOR_UPLOAD_URL = '/api/uploader/' # change to local uploader
`
views.py
based on the wiki, we also need to change 2 lines. I am using Django 4.2.7
https://github.com/agusmakmun/django-markdown-editor
if request.method == 'POST' and request.headers.get('X-Requested-With') == 'XMLHttpRequest':`
...
if image.size > settings.MAX_IMAGE_UPLOAD_SIZE:`
from django-markdown-editor.
I have the same issue and I've found the bug. This line breaks it:
django-markdown-editor/martor/urls.py
Line 35 in af0c347
the view for custom URL is never used and the default markdown_imgur_uploader
is applied.
from django-markdown-editor.
Any update pls?
from django-markdown-editor.
Related Issues (20)
- incompatibility with Python versions below 3.9 HOT 7
- The editor does not work when setting a Content Security Policy HOT 1
- Loosen restriction on importlib-metadata HOT 4
- Emoji url is done HOT 1
- class tag doesn't render correctly HOT 2
- toolbar nav style issue HOT 1
- Error with markdownify HOT 1
- Adding a new instance in an admin inline results in Uncaught TypeError HOT 1
- Losing text when (semi)colons follow links. HOT 2
- preview is not displaying correctly for “ordered” and “unordered” list items. HOT 1
- 📣 Call for Contributors: Help Needed to Maintain and Enhance django-markdown-editor! HOT 4
- Enable specifying the size of an image HOT 1
- Django 5 & Python 3.12 support HOT 2
- Updating Editor Content with Javascript HOT 1
- Django 4.2.11 support HOT 2
- Copy/Paste clipboard images HOT 1
- Dynamic MARTOR_UPLOAD_URL HOT 1
- Improve documentation for using html HOT 2
- Stop tagging Django with a less than version. 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-markdown-editor.