mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2025-01-03 20:01:51 +00:00
feat: add diff online tool
This commit is contained in:
parent
d4d98f6d55
commit
9880357433
49
web/app/controllers/apps/diff_online.php
Normal file
49
web/app/controllers/apps/diff_online.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
requireLib('bootstrap5');
|
||||
?>
|
||||
|
||||
<?php echoUOJPageHeader(UOJLocale::get('diff online')) ?>
|
||||
|
||||
<h1>
|
||||
<?= UOJLocale::get('diff online') ?>
|
||||
</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div style="height: 700px" id="diff-editor-container">
|
||||
<div class="border d-flex justify-content-center align-items-center w-100 h-100">
|
||||
<div class="spinner-border text-muted" style="width: 3rem; height: 3rem;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer bg-transparent text-end">
|
||||
<a href="https://s2oj.github.io/#/user/apps/diff_online" target="_blank">使用教程</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var div_editor = $('#diff-editor-container');
|
||||
|
||||
require_monaco({}, function() {
|
||||
$(div_editor).html('');
|
||||
|
||||
var originalModel = monaco.editor.createModel("", "text/plain");
|
||||
var modifiedModel = monaco.editor.createModel("", "text/plain");
|
||||
|
||||
var diffEditor = monaco.editor.createDiffEditor(div_editor[0], {
|
||||
originalEditable: true, // for left pane
|
||||
readOnly: false, // for right pane
|
||||
fontSize: "16px",
|
||||
automaticLayout: true,
|
||||
});
|
||||
|
||||
diffEditor.setModel({
|
||||
original: originalModel,
|
||||
modified: modifiedModel,
|
||||
});
|
||||
|
||||
$(div_editor).addClass('border overflow-hidden');
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php echoUOJPageFooter() ?>
|
@ -102,4 +102,5 @@ return [
|
||||
'apps' => 'Apps',
|
||||
'image hosting' => 'Image Hosting',
|
||||
'html to markdown' => 'HTML to Markdown',
|
||||
'diff online' => 'Diff Online',
|
||||
];
|
||||
|
@ -102,4 +102,5 @@ return [
|
||||
'apps' => '应用',
|
||||
'image hosting' => '图床',
|
||||
'html to markdown' => 'HTML 转 Markdown',
|
||||
'diff online' => '在线比较',
|
||||
];
|
||||
|
@ -96,6 +96,7 @@ Route::group(
|
||||
// Apps
|
||||
Route::any('/apps/image_hosting', '/apps/image_hosting.php');
|
||||
Route::any('/apps/html2markdown', '/apps/html2markdown.php');
|
||||
Route::any('/apps/diff_online', '/apps/diff_online.php');
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -125,6 +125,12 @@ mb-4
|
||||
<?= UOJLocale::get('html to markdown') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" href="<?= HTML::url('/apps/diff_online') ?>">
|
||||
<i class="bi bi-file-earmark-diff"></i>
|
||||
<?= UOJLocale::get('diff online') ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
Loading…
Reference in New Issue
Block a user