Starting the markdown editor.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user