From 05d9d139b5e234c896a30482b5ad93eab3e3417f Mon Sep 17 00:00:00 2001 From: Waheed Ahmed Date: Wed, 24 Dec 2014 13:11:32 +0500 Subject: [PATCH] Fixed CodeMirror editor view height in studio. TNL-920 --- cms/static/sass/elements/_modal-window.scss | 4 ++++ .../xmodule/xmodule/js/src/combinedopenended/edit.coffee | 6 ++++-- common/lib/xmodule/xmodule/js/src/problem/edit.coffee | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cms/static/sass/elements/_modal-window.scss b/cms/static/sass/elements/_modal-window.scss index 8e9449ba9e..978b5e1437 100644 --- a/cms/static/sass/elements/_modal-window.scss +++ b/cms/static/sass/elements/_modal-window.scss @@ -222,6 +222,10 @@ height: 365px; } + .CodeMirror-advanced { + height: 435px; + } + .wrapper-comp-settings { .list-input { diff --git a/common/lib/xmodule/xmodule/js/src/combinedopenended/edit.coffee b/common/lib/xmodule/xmodule/js/src/combinedopenended/edit.coffee index 9fa40cb999..9bd023ca5e 100644 --- a/common/lib/xmodule/xmodule/js/src/combinedopenended/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/combinedopenended/edit.coffee @@ -80,6 +80,9 @@ Write a persuasive essay to a newspaper reflecting your views on censorship in l if text @xml_editor.setValue(text) @setCurrentEditor(@xml_editor) + $(@xml_editor.getWrapperElement()).toggleClass("CodeMirror-advanced"); + # Need to refresh to get line numbers to display properly. + @xml_editor.refresh() ### User has clicked to show the XML editor. Before XML editor is swapped in, @@ -92,9 +95,8 @@ Write a persuasive essay to a newspaper reflecting your views on censorship in l @toggleCheatsheetVisibility() if @confirmConversionToXml() @createXMLEditor(OpenEndedMarkdownEditingDescriptor.markdownToXml(@markdown_editor.getValue())) - # Need to refresh to get line numbers to display properly (and put cursor position to 0) + # Put cursor position to 0. @xml_editor.setCursor(0) - @xml_editor.refresh() # Hide markdown-specific toolbar buttons $(@element.find('.editor-bar')).hide() diff --git a/common/lib/xmodule/xmodule/js/src/problem/edit.coffee b/common/lib/xmodule/xmodule/js/src/problem/edit.coffee index 1885e7515a..0ec8b3978a 100644 --- a/common/lib/xmodule/xmodule/js/src/problem/edit.coffee +++ b/common/lib/xmodule/xmodule/js/src/problem/edit.coffee @@ -41,6 +41,9 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor if text @xml_editor.setValue(text) @setCurrentEditor(@xml_editor) + $(@xml_editor.getWrapperElement()).toggleClass("CodeMirror-advanced"); + # Need to refresh to get line numbers to display properly. + @xml_editor.refresh() ### User has clicked to show the XML editor. Before XML editor is swapped in, @@ -53,9 +56,8 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor @toggleCheatsheetVisibility() if @confirmConversionToXml() @createXMLEditor(MarkdownEditingDescriptor.markdownToXml(@markdown_editor.getValue())) - # Need to refresh to get line numbers to display properly (and put cursor position to 0) + # Put cursor position to 0. @xml_editor.setCursor(0) - @xml_editor.refresh() # Hide markdown-specific toolbar buttons $(@element.find('.editor-bar')).hide()