Commit e017363a by cahrens

Tabs now showing.

parent 5493fd58
class @MarkdownEditingDescriptor extends XModule.Descriptor class @MarkdownEditingDescriptor extends XModule.Descriptor
constructor: (element) -> constructor: (element) ->
# $body.on('click', '.editor-tabs .tab', @changeEditor) $body.on('click', '.editor-tabs .tab', @changeEditor)
$('.editor-tabs .tab').bind 'click', (event) => @changeEditor(event)
@xml_editor = CodeMirror.fromTextArea($(".xml-box", element)[0], { @xml_editor = CodeMirror.fromTextArea($(".xml-box", element)[0], {
mode: "xml" mode: "xml"
lineNumbers: true lineNumbers: true
...@@ -20,10 +20,10 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor ...@@ -20,10 +20,10 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
onMarkdownEditorUpdate: -> onMarkdownEditorUpdate: ->
console.log('update') console.log('update')
changeEditor: (e) -> changeEditor: (e) =>
e.preventDefault(); e.preventDefault();
$('.editor-tabs .current').removeClass('current') $('.editor-tabs .current').removeClass('current')
$(this).addClass('current'); $(e.currentTarget).addClass('current')
if (@current_editor == @xml_editor) if (@current_editor == @xml_editor)
@setCurrentEditor(@markdown_editor) @setCurrentEditor(@markdown_editor)
else else
...@@ -53,6 +53,5 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor ...@@ -53,6 +53,5 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
$(@current_editor).focus(); $(@current_editor).focus();
save: -> save: ->
# TODO: make sure this gets unregistered correctly (changed how registration works)
$body.off('click', '.editor-tabs .tab', @changeEditor) $body.off('click', '.editor-tabs .tab', @changeEditor)
data: @xml_editor.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