diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index 371ae20e92..0a964aeaf3 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -1290,3 +1290,15 @@ function initScoreboardSubmissions() { }); }); } + +// Force a recompute of the monaco editor height when the display size changes. +if ('ResizeObserver' in window) { + $(() => { + var monacoObserver = new ResizeObserver(() => { + document.querySelectorAll('.monaco-editor').forEach(e => { + e.style.height = "0"; + }); + }); + monacoObserver.observe(document.body); + }); +} diff --git a/webapp/public/style_domjudge.css b/webapp/public/style_domjudge.css index 18eb31ef24..6d2e1e8921 100644 --- a/webapp/public/style_domjudge.css +++ b/webapp/public/style_domjudge.css @@ -29,6 +29,25 @@ body.static { padding-top: 1rem; } +/* Some browsers have a rounding error in flex, so waste 1px to prevent scrollbars. */ +.fill-height { + box-sizing: border-box; + display: flex; + min-height: calc(100vh - 1px); +} + +.flex-pass, +.flex-pass > form { + display: flex; + flex-direction: column; + flex: 1; +} + +/* Override the bootstrap active tab to be flex instead of block by a more specific selector. */ +.fill-height .flex-pass.tab-pane.active { + display: flex; +} + /* menu */ #menuDefault ul li.nav-item { white-space: nowrap; @@ -753,7 +772,9 @@ blockquote { } .editor { - width: 100%; - height: 80vh; border: 1px solid grey; + flex: 1; + height: 0; + min-height: 100px; /* Prefer a double scrollbar over not displaying code at all */ + width: 100%; } diff --git a/webapp/src/Controller/Jury/ExecutableController.php b/webapp/src/Controller/Jury/ExecutableController.php index e08e1b4afa..b2c0a4e098 100644 --- a/webapp/src/Controller/Jury/ExecutableController.php +++ b/webapp/src/Controller/Jury/ExecutableController.php @@ -371,6 +371,7 @@ public function viewAction( 'default_compare' => (string)$this->config->get('default_compare'), 'default_run' => (string)$this->config->get('default_run'), 'default_full_debug' => (string)$this->config->get('default_full_debug'), + 'fill_height' => true, ])); } diff --git a/webapp/src/Controller/Jury/SubmissionController.php b/webapp/src/Controller/Jury/SubmissionController.php index d6acdea938..90a0acb110 100644 --- a/webapp/src/Controller/Jury/SubmissionController.php +++ b/webapp/src/Controller/Jury/SubmissionController.php @@ -924,6 +924,7 @@ public function sourceAction( 'originalFiles' => $originalFiles, 'originalFileStats' => $originalFileStats, 'allowEdit' => $this->allowEdit(), + 'fill_height' => true, ]); } @@ -1043,6 +1044,7 @@ public function editSourceAction(Request $request, Submission $submission, #[Map 'files' => $files, 'form' => $form, 'selected' => $rank, + 'fill_height' => true, ]; if ($request->isXmlHttpRequest()) { return $this->render('jury/submission_edit_source_modal.html.twig', $twigData); diff --git a/webapp/templates/base.html.twig b/webapp/templates/base.html.twig index e953356b67..3bd84efe64 100644 --- a/webapp/templates/base.html.twig +++ b/webapp/templates/base.html.twig @@ -27,12 +27,12 @@ {% endfor %} - + {% block menu %}{% endblock %} {% block body %} -
-