I visited http://summernote.org/examples/#codemirror-as-codeview, but I still can't get codemirror to work. I'm getting 200 responses from all the codemirror css and javascript, but I still get blank when I press code view. Here's my SUMMER_NOTE config.
SUMMERNOTE_CONFIG = {
'toolbar': [
['cmds', ['undo', 'redo', 'clear']],
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'strikethrough']],
['font2', ['superscript', 'subscript']],
['color', ['color']],
['para', ['ul','ol']],
['layout', ['hr', 'table']],
['insert', ['link', 'picture']],
['misc', ['codeview']],
],
'width': '100%',
'css': (
'//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.css',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.css',
),
'js': (
'//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.js',
'//cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.js',
),
'codemirror': {
'theme': 'monokai',
}
}
Is this the right way to configure?
I found out that
js
loads afterdefault_js
, so you have to load all the codemirror scripts beforesummernote.min.js
. Here's the<head>
tags inside the<iframe>
loading those files both ways, I added the comments.So I was able to make it work by structuring my
SUMMERNOTE_CONFIG
as so:P.S.
static_url
is defined locally.