Added code to remove css on closing cheatsheet.
This commit is contained in:
@@ -135,6 +135,12 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
|
||||
var parent = $(event.target.parentElement),
|
||||
mode = parent.data('mode');
|
||||
event.preventDefault();
|
||||
var $cheatsheet = $('.simple-editor-cheatsheet');
|
||||
if ($cheatsheet.hasClass("shown")) {
|
||||
$(".CodeMirror").removeAttr("style");
|
||||
$(".modal-content").removeAttr("style");
|
||||
$cheatsheet.removeClass('shown');
|
||||
}
|
||||
this.selectMode(mode);
|
||||
},
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
|
||||
###
|
||||
onShowXMLButton: (e) =>
|
||||
e.preventDefault();
|
||||
@addRemoveCheatsheetCSS()
|
||||
if @confirmConversionToXml()
|
||||
@createXMLEditor(MarkdownEditingDescriptor.markdownToXml(@markdown_editor.getValue()))
|
||||
# Need to refresh to get line numbers to display properly (and put cursor position to 0)
|
||||
@@ -94,11 +95,22 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
|
||||
@cheatsheet = $($('#simple-editor-cheatsheet').html())
|
||||
$(@markdown_editor.getWrapperElement()).append(@cheatsheet)
|
||||
|
||||
$(".CodeMirror").css({"overflow": "visible"})
|
||||
$(".modal-content").css({"overflow-y": "visible", "overflow-x": "visible"})
|
||||
@addRemoveCheatsheetCSS()
|
||||
|
||||
setTimeout (=> @cheatsheet.toggleClass('shown')), 10
|
||||
|
||||
|
||||
###
|
||||
Function to add/remove CSS for cheatsheet.
|
||||
###
|
||||
addRemoveCheatsheetCSS: () =>
|
||||
if !@cheatsheet.hasClass("shown")
|
||||
$(".CodeMirror").css({"overflow": "visible"})
|
||||
$(".modal-content").css({"overflow-y": "visible", "overflow-x": "visible"})
|
||||
else
|
||||
$(".CodeMirror").removeAttr("style")
|
||||
$(".modal-content").removeAttr("style")
|
||||
|
||||
###
|
||||
Stores the current editor and hides the one that is not displayed.
|
||||
###
|
||||
|
||||
Reference in New Issue
Block a user