diff --git a/cms/static/js/speed-editor.js b/cms/static/js/speed-editor.js index f310e86cac..4c3df85f13 100644 --- a/cms/static/js/speed-editor.js +++ b/cms/static/js/speed-editor.js @@ -21,7 +21,8 @@ function initProblemEditors($editor, $prev) { $currentEditor = $editor; simpleEditor = CodeMirror.fromTextArea($editor.find('.edit-box')[0], { lineWrapping: true, - extraKeys: { +// TODO: I left out the extra keys for now. + extraKeys: { 'Ctrl-N': newUnit, 'Ctrl-H': makeHeader, 'Ctrl-V': makeVideo, diff --git a/cms/templates/widgets/problem-edit.html b/cms/templates/widgets/problem-edit.html index 99442c0179..d37d605971 100644 --- a/cms/templates/widgets/problem-edit.html +++ b/cms/templates/widgets/problem-edit.html @@ -1,6 +1,9 @@ <%include file="metadata-edit.html" />
+ <% + markdown = 'foo' + %> %if markdown != '' or data == '':
    diff --git a/common/lib/xmodule/xmodule/js/src/problem/markdown.coffee b/common/lib/xmodule/xmodule/js/src/problem/markdown.coffee index 6b87449d83..d938cb0bd3 100644 --- a/common/lib/xmodule/xmodule/js/src/problem/markdown.coffee +++ b/common/lib/xmodule/xmodule/js/src/problem/markdown.coffee @@ -1,10 +1,19 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor constructor: (@element) -> - @edit_box = CodeMirror.fromTextArea($(".xml-box", @element)[0], { - mode: "xml" - lineNumbers: true - lineWrapping: true + @xml_editor = CodeMirror.fromTextArea($(".xml-box", @element)[0], { + mode: "xml" + lineNumbers: true + lineWrapping: true }) + @markdown_editor = CodeMirror.fromTextArea($(".edit-box", @element)[0], { + lineWrapping: true + mode: null + onChange: @onMarkdownEditorUpdate + }) + + onMarkdownEditorUpdate: -> + console.log('update') + save: -> - data: @edit_box.getValue() + data: @xml_editor.getValue()