diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index d500dcbac6..371ae20e92 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -124,18 +124,18 @@ function applyEditorTheme(theme = undefined, isExternal = false) }); } -function isDiffSideBySide() +function getDiffMode() { - let sideBySide = localStorage.getItem('domjudge_editor_side_by_side'); - if (sideBySide === undefined) { - return true; + let diffMode = localStorage.getItem('domjudge_editor_diff_mode'); + if (diffMode === undefined) { + return 'side-by-side'; } - return sideBySide == 'true'; + return diffMode; } -function setDiffSideBySide(value) +function setDiffMode(value) { - localStorage.setItem('domjudge_editor_side_by_side', value); + localStorage.setItem('domjudge_editor_diff_mode', value); } // Send a notification if notifications have been enabled. diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index aed9adf2ae..a985c20d9b 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -172,6 +172,11 @@ public function getGlobals(): array 'hc-light' => ['name' => 'High contrast (light)'], 'hc-black' => ['name' => 'High contrast (dark)'], ], + 'diff_modes' => [ + 'no-diff' => ["name" => "No diff"], + 'side-by-side' => ["name" => "Side-by-side"], + 'inline' => ["name" => "Inline"], + ], ]; } @@ -940,10 +945,6 @@ protected function parseSourceDiff(string $difftext): string public function showDiff(string $id, SubmissionFile $newFile, SubmissionFile $oldFile): string { $editor = << - - -
diff --git a/webapp/templates/jury/partials/submission_diff.html.twig b/webapp/templates/jury/partials/submission_diff.html.twig index baaabc96e4..c991494b33 100644 --- a/webapp/templates/jury/partials/submission_diff.html.twig +++ b/webapp/templates/jury/partials/submission_diff.html.twig @@ -43,6 +43,7 @@ {%- for filePair in oldFileStats.changedfiles %}