even more wiki fullscreen optimisation

This commit is contained in:
Mario Vavti 2016-12-10 17:17:11 +01:00
parent bde32eb7df
commit 368ad332a0
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#ace-editor { #ace-editor {
position: relative; position: relative;
width: 100%; width: 100%;
height: 500px;
border: 1px solid #ccc; border: 1px solid #ccc;
border-top: 0px; border-top: 0px;
} }

View File

@ -175,6 +175,9 @@
if($('main').hasClass('.fullscreen')) { if($('main').hasClass('.fullscreen')) {
adjustFullscreenEditorHeight(); adjustFullscreenEditorHeight();
} }
else {
adjustInlineEditorHeight();
}
}, 500); // Return the focus to the editor allowing immediate text entry }, 500); // Return the focus to the editor allowing immediate text entry
$('#page-tools').show(); $('#page-tools').show();
@ -336,21 +339,22 @@
$('#editor, #ace-editor').height($(window).height() - $('#id_commitMsg_wrapper').outerHeight(true) - $('.section-title-wrapper').outerHeight(true) - $('#wiki-nav-tabs').outerHeight(true) - 17); $('#editor, #ace-editor').height($(window).height() - $('#id_commitMsg_wrapper').outerHeight(true) - $('.section-title-wrapper').outerHeight(true) - $('#wiki-nav-tabs').outerHeight(true) - 17);
{{if !$mimeType || $mimeType == 'text/markdown'}} {{if !$mimeType || $mimeType == 'text/markdown'}}
editor.setOptions({ editor.setOptions({
maxLines: '', maxLines: null,
minLines: '' minLines: null
}); });
editor.resize(); editor.resize();
{{/if}} {{/if}}
} }
function adjustInlineEditorHeight() { function adjustInlineEditorHeight() {
$('#editor').height(500);
{{if !$mimeType || $mimeType == 'text/markdown'}} {{if !$mimeType || $mimeType == 'text/markdown'}}
editor.setOptions({ editor.setOptions({
maxLines: Infinity, maxLines: Infinity,
minLines: 30 minLines: 30
}); });
editor.resize();
{{else}}
editor.height(editor[0].scrollHeight);
{{/if}} {{/if}}
} }