fixed layouting issues

This commit is contained in:
azivner 2018-05-26 19:58:08 -04:00
parent 40a32e6826
commit 7ad9f7b129
2 changed files with 19 additions and 3 deletions

View File

@ -13,18 +13,27 @@ let codeEditorInitialized;
async function show() { async function show() {
codeEditorInitialized = false; codeEditorInitialized = false;
// if the note is empty, it doesn't make sense to do render-only since nothing will be rendered
if (!noteDetailService.getCurrentNote().content.trim()) {
toggleEdit();
}
$noteDetailRender.show(); $noteDetailRender.show();
await render(); await render();
} }
$toggleEditButton.click(() => { async function toggleEdit() {
if ($noteDetailCode.is(":visible")) { if ($noteDetailCode.is(":visible")) {
$noteDetailCode.hide(); $noteDetailCode.hide();
} }
else { else {
if (!codeEditorInitialized) { if (!codeEditorInitialized) {
noteDetailCodeService.show(); await noteDetailCodeService.show();
// because we can't properly scroll only the editor without scrolling the rendering
// we limit its height
$noteDetailCode.find('.CodeMirror').css('height', '300');
codeEditorInitialized = true; codeEditorInitialized = true;
} }
@ -32,7 +41,9 @@ $toggleEditButton.click(() => {
$noteDetailCode.show(); $noteDetailCode.show();
} }
} }
}); }
$toggleEditButton.click(toggleEdit);
$renderButton.click(render); $renderButton.click(render);

View File

@ -277,6 +277,7 @@ div.ui-tooltip {
#note-detail-code { #note-detail-code {
min-height: 200px; min-height: 200px;
overflow: auto;
} }
#note-detail-render { #note-detail-render {
@ -288,6 +289,10 @@ div.ui-tooltip {
height: auto; height: auto;
} }
.CodeMirror-scroll {
min-height: 200px;
}
#note-id-display { #note-id-display {
position: absolute; position: absolute;
right: 10px; right: 10px;