Starting the markdown editor.

This commit is contained in:
cahrens
2013-01-03 13:39:01 -05:00
parent e09a8e4a9b
commit b4312cbfef
3 changed files with 19 additions and 6 deletions

View File

@@ -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,

View File

@@ -1,6 +1,9 @@
<%include file="metadata-edit.html" />
<section class="problem-editor editor">
<div class="row">
<%
markdown = 'foo'
%>
%if markdown != '' or data == '':
<div class="editor-bar">
<ul class="format-buttons">

View File

@@ -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()