Placeholders for markdown editor js and reference to pull it in from

CapaDescriptor. Overrode XMLEditorDescription
This commit is contained in:
Don Mitchell
2013-01-03 11:15:06 -05:00
parent 702636c00c
commit 4e9d5c8a6a
2 changed files with 12 additions and 0 deletions

View File

@@ -651,6 +651,8 @@ class CapaDescriptor(RawDescriptor):
has_score = True
template_dir_name = 'problem'
mako_template = "widgets/problem-edit.html"
js = {'coffee': [resource_string(__name__, 'js/src/problem/markdown.coffee')]}
js_module_name = "MarkdownEditingDescriptor"
# Capa modules have some additional metadata:
# TODO (vshnayder): do problems have any other metadata? Do they

View File

@@ -0,0 +1,10 @@
class @MarkdownEditingDescriptor extends XModule.Descriptor
constructor: (@element) ->
@edit_box = CodeMirror.fromTextArea($(".edit-box", @element)[0], {
mode: "xml"
lineNumbers: true
lineWrapping: true
})
save: ->
data: @edit_box.getValue()