Commit b4312cbf by cahrens

Starting the markdown editor.

parent e09a8e4a
...@@ -21,6 +21,7 @@ function initProblemEditors($editor, $prev) { ...@@ -21,6 +21,7 @@ function initProblemEditors($editor, $prev) {
$currentEditor = $editor; $currentEditor = $editor;
simpleEditor = CodeMirror.fromTextArea($editor.find('.edit-box')[0], { simpleEditor = CodeMirror.fromTextArea($editor.find('.edit-box')[0], {
lineWrapping: true, lineWrapping: true,
// TODO: I left out the extra keys for now.
extraKeys: { extraKeys: {
'Ctrl-N': newUnit, 'Ctrl-N': newUnit,
'Ctrl-H': makeHeader, 'Ctrl-H': makeHeader,
......
<%include file="metadata-edit.html" /> <%include file="metadata-edit.html" />
<section class="problem-editor editor"> <section class="problem-editor editor">
<div class="row"> <div class="row">
<%
markdown = 'foo'
%>
%if markdown != '' or data == '': %if markdown != '' or data == '':
<div class="editor-bar"> <div class="editor-bar">
<ul class="format-buttons"> <ul class="format-buttons">
......
class @MarkdownEditingDescriptor extends XModule.Descriptor class @MarkdownEditingDescriptor extends XModule.Descriptor
constructor: (@element) -> constructor: (@element) ->
@edit_box = CodeMirror.fromTextArea($(".xml-box", @element)[0], { @xml_editor = CodeMirror.fromTextArea($(".xml-box", @element)[0], {
mode: "xml" mode: "xml"
lineNumbers: true lineNumbers: true
lineWrapping: true lineWrapping: true
}) })
@markdown_editor = CodeMirror.fromTextArea($(".edit-box", @element)[0], {
lineWrapping: true
mode: null
onChange: @onMarkdownEditorUpdate
})
onMarkdownEditorUpdate: ->
console.log('update')
save: -> save: ->
data: @edit_box.getValue() data: @xml_editor.getValue()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment