Skip to content

Commit

Permalink
Update settings for new Summernote
Browse files Browse the repository at this point in the history
  • Loading branch information
lqez committed Oct 14, 2021
1 parent f880428 commit a60af41
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
8 changes: 4 additions & 4 deletions django_summernote/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ def get_default_config(self):

# Media files for CodeMirror
'codemirror_css': (
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.0/codemirror.min.css',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.3/codemirror.min.css',
),
'codemirror_js': (
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.0/codemirror.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.0/mode/xml/xml.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.0/mode/htmlmixed/htmlmixed.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.3/codemirror.min.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.3/mode/xml/xml.min.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.3/mode/htmlmixed/htmlmixed.min.js',
),

# Media files for all Summernote widgets
Expand Down
41 changes: 36 additions & 5 deletions django_summernote/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
from django.utils.translation import get_language
from importlib import import_module

# A conversion table from language to locale
# Conversion table from language to locale
LANG_TO_LOCALE = {
'ar': 'ar-AR',
'az': 'az-AZ',
'bg': 'bg-BG',
'bn': 'bn-BD',
'ca': 'ca-ES',
'cs': 'cs-CZ',
'da': 'da-DK',
Expand Down Expand Up @@ -50,6 +52,15 @@
'zh': 'zh-CN',
}

# Use this for customizing the above table
LANG_TO_LOCALE_ALTERNATIVES = {
'pt': 'pt-PT',
'es': 'es-EU',
'lt': 'lt-LV',
'de': 'de-CH',
'zh': 'zh-TW',
}

# Theme files dictionary
SUMMERNOTE_THEME_FILES = {
'bs3': {
Expand All @@ -61,7 +72,7 @@
'//stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js',
),
'default_css': (
'summernote/summernote.css',
'summernote/summernote.min.css',
'summernote/django_summernote.css',
),
'default_js': (
Expand All @@ -77,11 +88,11 @@
'//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css',
),
'base_js': (
'//code.jquery.com/jquery-3.3.1.min.js',
'//code.jquery.com/jquery-3.5.1.min.js',
'//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js',
),
'default_css': (
'summernote/summernote-bs4.css',
'summernote/summernote-bs4.min.css',
'summernote/django_summernote.css',
),
'default_js': (
Expand All @@ -92,10 +103,30 @@
'summernote/ResizeSensor.js',
),
},
'bs5': {
'base_css': (
'//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css',
),
'base_js': (
'//code.jquery.com/jquery-3.6.0.min.js',
'//cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js',
),
'default_css': (
'summernote/summernote-bs5.min.css',
'summernote/django_summernote.css',
),
'default_js': (
'summernote/jquery.ui.widget.js',
'summernote/jquery.iframe-transport.js',
'summernote/jquery.fileupload.js',
'summernote/summernote-bs5.min.js',
'summernote/ResizeSensor.js',
),
},
'lite': {
'base_css': (),
'base_js': (
'//code.jquery.com/jquery-3.3.1.min.js',
'//code.jquery.com/jquery-3.6.0.min.js',
),
'default_css': (
'summernote/summernote-lite.css',
Expand Down

0 comments on commit a60af41

Please sign in to comment.