Fix CodeMirror initialization problem.

This commit is contained in:
cahrens
2013-05-16 12:34:39 -04:00
parent 235ecff28b
commit 01ff8396e3
2 changed files with 12 additions and 8 deletions

View File

@@ -113,14 +113,16 @@ class CMS.Views.ModuleEdit extends Backbone.View
settingsModeButton = @$el.find('#settings-mode').find("a")
if mode == @editorMode
dataEditor.addClass('is-active')
settingsEditor.removeClass('is-active')
# Because of CodeMirror editor, cannot hide the data editor when it is first loaded. Therefore
# we have to use a class of is-inactive instead of is-active.
dataEditor.removeClass('is-inactive')
editorModeButton.addClass('is-set')
settingsEditor.removeClass('is-active')
settingsModeButton.removeClass('is-set')
else
dataEditor.removeClass('is-active')
settingsEditor.addClass('is-active')
dataEditor.addClass('is-inactive')
editorModeButton.removeClass('is-set')
settingsEditor.addClass('is-active')
settingsModeButton.addClass('is-set')
hideDataEditor: =>

View File

@@ -535,12 +535,14 @@ body.course.unit {
// Editor Wrapper
.wrapper-comp-editor {
display: none;
display: block;
&.is-active {
display: block;
// Because the editor may be a CodeMirror editor (which must be visible at the time it is created
// in order for it to properly initialize), we must toggle "is-inactive" instead of the more common "is-active".
&.is-inactive {
display: none;
}
}
}
// Settings Wrapper
.wrapper-comp-settings {