Unify handling of CodeMirror

Load codemirror as a script tag

Load codemirror synchronously

More cleanup of codemirror handling

Make the config more succinct

Reinstate mode/meta
This commit is contained in:
Steven Silvester 2016-06-15 06:15:53 -05:00
parent 3ea9c96bbc
commit 6205ba9a21
2 changed files with 17 additions and 2 deletions

View File

@ -21,6 +21,8 @@
<script src="{{static_url("components/bootstrap/js/bootstrap.min.js") }}" type="text/javascript" charset="utf-8"></script> <!-- extends window.$ -->
<script src="{{static_url("components/bootstrap-tour/build/js/bootstrap-tour.min.js") }}" type="text/javascript" charset="utf-8"></script> <!-- window.Tour -->
<script src="{{static_url("components/jquery-typeahead/dist/jquery.typeahead.min.js") }}" type="text/javascript" charset="utf-8"></script> <!-- extends window.$ -->
<script src="{{static_url("components/codemirror/lib/codemirror.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("components/codemirror/mode/meta.js") }}" type="text/javascript" charset="utf-8"></script>
<script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
<script>
window['staticURL'] = "{{static_url("", include_version=False)}}";
@ -178,6 +180,19 @@
define("jquery-ui", function () {
return window.$;
});
define("codemirror/lib/codemirror", function () {
return window.CodeMirror;
});
define("codemirror/mode/meta", function () {
return window.CodeMirror;
});
define("CodeMirror", function () {
return window.CodeMirror;
});
</script>
{% block meta %}

View File

@ -39,8 +39,8 @@ var commonConfig = {
bootstraptour: 'Tour',
'jquery-ui': '$',
typeahead: '$.typeahead',
'codemirror/lib/codemirror': 'commonjs codemirror/lib/codemirror',
'codemirror/mode/meta': 'commonjs codemirror/mode/meta',
'codemirror/lib/codemirror': 'CodeMirror',
'codemirror/mode/meta': 'CodeMirror',
}
};