mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-08 16:08:41 +00:00
feat: use UOJForm::addMarkdownEditor()
This commit is contained in:
parent
fad01eef66
commit
242ca4a65b
@ -64,10 +64,9 @@ if ($cur_tab == 'profile') {
|
||||
'option_div_class' => 'form-check d-inline-block ms-2',
|
||||
'default_value' => UOJGroup::info('is_hidden'),
|
||||
]);
|
||||
$update_profile_form->addTextArea('announcement', [
|
||||
$update_profile_form->addMarkdownEditor('announcement', [
|
||||
'div_class' => 'mt-3',
|
||||
'label' => '公告',
|
||||
'input_class' => 'form-control font-monospace',
|
||||
'default_value' => UOJGroup::info('announcement'),
|
||||
'help' => '公告支持 Markdown 语法。',
|
||||
'validator_php' => function ($announcement, &$vdata) {
|
||||
@ -287,11 +286,11 @@ if ($cur_tab == 'profile') {
|
||||
<div class="card mt-3 mt-md-0">
|
||||
<div class="card-body">
|
||||
<div id="result-alert" class="alert" role="alert" style="display: none"></div>
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
<div class="col">
|
||||
<?= $update_profile_form->printHTML() ?>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<?php $update_profile_form->printHTML() ?>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-md-4">
|
||||
<h5>注意事项</h5>
|
||||
<ul class="mb-0">
|
||||
<li>隐藏的小组无法被普通用户查看,即使该用户属于本小组。</li>
|
||||
|
@ -25,6 +25,7 @@ if (!isset($tabs_info[$cur_tab])) {
|
||||
if ($cur_tab == 'profile') {
|
||||
$update_profile_form = new UOJForm('update_profile');
|
||||
$update_profile_form->addInput('name', [
|
||||
'div_class' => 'mb-3',
|
||||
'label' => '标题',
|
||||
'default_value' => HTML::unescape(UOJList::info('title')),
|
||||
'validator_php' => function ($title, &$vdata) {
|
||||
@ -47,7 +48,7 @@ if ($cur_tab == 'profile') {
|
||||
},
|
||||
]);
|
||||
$update_profile_form->addCheckboxes('is_hidden', [
|
||||
'div_class' => 'mt-3',
|
||||
'div_class' => 'mb-3',
|
||||
'label' => '可见性',
|
||||
'label_class' => 'me-3',
|
||||
'select_class' => 'd-inline-block',
|
||||
@ -59,6 +60,7 @@ if ($cur_tab == 'profile') {
|
||||
],
|
||||
]);
|
||||
$update_profile_form->addInput('tags', [
|
||||
'div_class' => 'mb-3',
|
||||
'label' => '标签',
|
||||
'default_value' => implode(', ', UOJList::cur()->queryTags()),
|
||||
'validator_php' => function ($tags_str, &$vdata) {
|
||||
@ -93,7 +95,7 @@ if ($cur_tab == 'profile') {
|
||||
},
|
||||
'help' => '多个标签请使用逗号隔开。'
|
||||
]);
|
||||
$update_profile_form->addTextArea('content_md', [
|
||||
$update_profile_form->addMarkdownEditor('content_md', [
|
||||
'label' => '描述',
|
||||
'default_value' => UOJList::cur()->queryContent()['content_md'],
|
||||
'validator_php' => function ($content_md, &$vdata) {
|
||||
@ -237,11 +239,11 @@ if ($cur_tab == 'profile') {
|
||||
<div class="card mt-3 mt-md-0">
|
||||
<div class="card-body">
|
||||
<div id="result-alert" class="alert" role="alert" style="display: none"></div>
|
||||
<div class="row row-cols-1 row-cols-md-2">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<?= $update_profile_form->printHTML() ?>
|
||||
</div>
|
||||
<div class="col mt-3 mt-md-0">
|
||||
<div class="col-md-4">
|
||||
<h5>注意事项</h5>
|
||||
<ul class="mb-0">
|
||||
<li>隐藏的题单无法被普通用户查看。</li>
|
||||
|
@ -46,7 +46,7 @@ function getCommentContentToDisplay($comment) {
|
||||
}
|
||||
|
||||
$comment_form = new UOJForm('comment');
|
||||
$comment_form->addTextArea('comment', [
|
||||
$comment_form->addMarkdownEditor('comment', [
|
||||
'label' => '内容',
|
||||
'help' => '评论支持 Markdown 语法。可以用 <code>@mike</code> 来提到 <code>mike</code> 这个用户,<code>mike</code> 会被高亮显示。如果你真的想打 <code>@</code> 这个字符,请用 <code>@@</code>。',
|
||||
'validator_php' => function ($comment) {
|
||||
@ -62,6 +62,7 @@ $comment_form->addTextArea('comment', [
|
||||
return '';
|
||||
},
|
||||
]);
|
||||
$comment_form->config['ctrl_enter_submit'] = true;
|
||||
$comment_form->handle = function () {
|
||||
global $blog, $comment_form;
|
||||
$comment = $_POST['comment'];
|
||||
@ -122,7 +123,7 @@ $reply_form->addHidden(
|
||||
},
|
||||
null
|
||||
);
|
||||
$reply_form->addTextArea('reply_comment', [
|
||||
$reply_form->addMarkdownEditor('reply_comment', [
|
||||
'label' => '内容',
|
||||
'validator_php' => function ($comment) {
|
||||
if (!Auth::check()) {
|
||||
|
Loading…
Reference in New Issue
Block a user