mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-05-02 18:44:42 +00:00
Fixes issue #12: Ability to change the url of imageupload in settings
This commit is contained in:
parent
e6f5064889
commit
4ae027b634
4 changed files with 5 additions and 1 deletions
|
|
@ -167,6 +167,7 @@ Place settings in your `settings.py` to override default values:
|
|||
MARKDOWNX_MARKDOWN_EXTENSIONS = []
|
||||
MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS = {}
|
||||
MARKDOWNX_URLS_PATH = '/markdownx/markdownify/' # Urls path that returns compiled markdown text. Change this path to your custom app url. That could i.e. enable do some additional work with compiled markdown text.
|
||||
MARKDOWNX_UPLOAD_URLS_PATH = '/markdownx/upload/' # Urls path for uploading image on text-editor. Will return markdown notation of the image. Change this path to your custom app url.
|
||||
MARKDOWNX_MEDIA_PATH = 'markdownx/' # subdirectory, where images will be stored in MEDIA_ROOT folder
|
||||
MARKDOWNX_UPLOAD_MAX_SIZE = 52428800 # 50MB
|
||||
MARKDOWNX_UPLOAD_CONTENT_TYPES = ['image/jpeg', 'image/png']
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS = getattr(settings, 'MARKDOWNX_MARKDOWN_EXT
|
|||
|
||||
# Markdown url
|
||||
MARKDOWNX_URLS_PATH = getattr(settings, 'MARKDOWNX_URLS_PATH', '/markdownx/markdownify/')
|
||||
MARKDOWNX_UPLOAD_URLS_PATH = getattr(settings, 'MARKDOWNX_UPLOAD_URLS_PATH', '/markdownx/upload/')
|
||||
|
||||
# Media path
|
||||
MARKDOWNX_MEDIA_PATH = getattr(settings, 'MARKDOWNX_MEDIA_PATH', 'markdownx/')
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/markdownx/upload/',
|
||||
url: markdownxEditor.data("markdownxUploadUrlsPath"),
|
||||
data: form,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from django.contrib.admin import widgets
|
|||
from .settings import (
|
||||
MARKDOWNX_EDITOR_RESIZABLE,
|
||||
MARKDOWNX_URLS_PATH,
|
||||
MARKDOWNX_UPLOAD_URLS_PATH,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ class MarkdownxWidget(forms.Textarea):
|
|||
|
||||
attrs['data-markdownx-editor-resizable'] = MARKDOWNX_EDITOR_RESIZABLE
|
||||
attrs['data-markdownx-urls-path'] = MARKDOWNX_URLS_PATH
|
||||
attrs['data-markdownx-upload-urls-path'] = MARKDOWNX_UPLOAD_URLS_PATH
|
||||
|
||||
widget = super(MarkdownxWidget, self).render(name, value, attrs)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue