ui: only render extra content on richmedia class (#743)

This commit is contained in:
panda authored and GitHub committed 2024-03-08 17:17:36 +08:00
1 parent 1b8f209429
commit 48e8c7b3fd
16 files changed
+21 -21

No files matched your search

@@ -12,7 +12,7 @@ async function historyDialog(payload, time, uid) {
const rawHtml = await fetch(`${payload}?time=${ts}&render=1`).then((res) => res.text());
new InfoDialog({
$body: tpl`
<div class="typo">
<div class="typo richmedia">
<p><div data-user>${uid}</div> ${i18n('Edited at')} <span class="time relative" data-timestamp="${ts / 1000}">${time}</span></p>
${{ templateRaw: true, html: rawHtml }}
</div>`,
@@ -17,7 +17,7 @@ const highlighterPage = new AutoloadPage('highlighterPage', () => {
$container.find('pre code').get().forEach((code) => {
const $code = $(code);
const $root = $code.parent().parent();
const $typo = $code.closest('.typo');
const $typo = $code.closest('.richmedia');
const language = ($(code).attr('class') || '').trim();
const m = language.match(/language-input([0-9]+)/);
if (m?.[1]) {
@@ -18,8 +18,8 @@ const katexPage = new AutoloadPage('katexPage', () => {
],
}));
}
runKatex($('.typo'));
$(document).on('vjContentNew', (e) => runKatex($(e.target).find('.typo').addBack('.typo')));
runKatex($('.richmedia'));
$(document).on('vjContentNew', (e) => runKatex($(e.target).find('.richmedia').addBack('.richmedia')));
});
});
+1 -1
View File
@@ -6,7 +6,7 @@
<div class="section__header">
<h1 class="section__title" id="{{ section.id }}" data-heading>{{ section.title }}</h1>
</div>
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ section.content|markdown|safe }}
</div>
</div>
@@ -110,7 +110,7 @@
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-drid="{{ doc.docId }}" data-raw-url="{{ url('discussion_reply_raw', did=doc.parentId, drid=doc._id) }}">
<div class="typo richmedia" data-emoji-enabled data-drid="{{ doc.docId }}" data-raw-url="{{ url('discussion_reply_raw', did=doc.parentId, drid=doc._id) }}">
{{ doc['content']|markdown|safe }}
<div class="reactions list" data-type="drid" data-drid="{{ doc._id }}">
{% for e in Object.entries(doc.react or {})|sort(true, false, 1)|selectattr(1) %}
@@ -148,7 +148,7 @@
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('discussion_tail_reply_raw', did=doc.parentId, drid=doc._id, drrid=rdoc._id) }}">
<div class="typo richmedia" data-emoji-enabled data-raw-url="{{ url('discussion_tail_reply_raw', did=doc.parentId, drid=doc._id, drrid=rdoc._id) }}">
{{ rdoc.content|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
@@ -122,7 +122,7 @@
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('problem_solution_raw', pid=doc.parentId, psid=doc._id) }}">
<div class="typo richmedia" data-emoji-enabled data-raw-url="{{ url('problem_solution_raw', pid=doc.parentId, psid=doc._id) }}">
{{ doc['content']|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
@@ -152,7 +152,7 @@
{% endif %}
</div>
</div>
<div class="typo" data-emoji-enabled data-raw-url="{{ url('problem_solution_reply_raw', pid=doc.parentId, psid=doc._id, psrid=rdoc._id) }}">
<div class="typo richmedia" data-emoji-enabled data-raw-url="{{ url('problem_solution_reply_raw', pid=doc.parentId, psid=doc._id, psrid=rdoc._id) }}">
{{ rdoc['content']|markdown|safe }}
</div>
<div class="commentbox-edit-target"></div>
@@ -24,7 +24,7 @@
</div>
</div>
<div class="section">
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ tdoc['content']|markdown|safe }}
{% if model.contest.isOngoing(tdoc, tsdoc) %}
<blockquote class="warn">
@@ -74,7 +74,7 @@
</div>
{% endif %}
</div>
<div class="typo" data-emoji-enabled>
<div class="typo richmedia" data-emoji-enabled>
{{ doc['content']|markdown|safe }}
</div>
</div>
@@ -90,7 +90,7 @@
<b>{{ _('Jury') }}</b>
</div>
</div>
<div class="typo" data-emoji-enabled>
<div class="typo richmedia" data-emoji-enabled>
{{ rdoc['content']|markdown|safe }}
</div>
</div>
@@ -117,7 +117,7 @@
{{_('Subject') }}: {{ contest.render_clarification_subject(tdoc,pdict,doc.subject) }} | {% if doc.owner == 0 %}<b>{{ _('Jury') }}</b>{% else %}{{ user.render_inline(udict[doc.owner], badge=false) }}{% endif %} @ {{ datetimeSpan(doc._id)|safe }}
</div>
</div>
<div class="typo" data-emoji-enabled>
<div class="typo richmedia" data-emoji-enabled>
{{ doc['content']|markdown|safe }}
</div>
</div>
@@ -133,7 +133,7 @@
<b>{{ _('Jury') }}</b> @ {{ datetimeSpan(rdoc['_id'])|safe }}
</div>
</div>
<div class="typo" data-emoji-enabled>
<div class="typo richmedia" data-emoji-enabled>
{{ rdoc['content']|markdown|safe }}
</div>
</div>
@@ -25,7 +25,7 @@
{{ datetimeSpan(ddoc._id)|safe }}
</li>
</ul>
<div class="typo topic__content" data-emoji-enabled data-raw-url="{{ url('discussion_raw', did=ddoc.docId) }}">
<div class="typo topic__content richmedia" data-emoji-enabled data-raw-url="{{ url('discussion_raw', did=ddoc.docId) }}">
{{ ddoc['content']|markdown|safe }}
</div>
</div>
@@ -3,7 +3,7 @@
{% block domain_content %}
{% if domain.bulletin %}
<div class="section">
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ domain.bulletin|markdown|safe }}
</div>
</div>
@@ -8,7 +8,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Homework Introduction') }}</h1>
</div>
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ tdoc['content']|markdown|safe }}
</div>
</div>
@@ -1,6 +1,6 @@
{% if domain.bulletin %}
<div class="section">
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ domain.bulletin|markdown|safe }}
</div>
</div>
@@ -60,7 +60,7 @@
</div>
{% endif %}
{% if node['content'] %}
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ node['content']|markdown|safe }}
</div>
{% endif %}
@@ -45,7 +45,7 @@
<div class="section__body typo">
{{ tdoc['content'] }}
</div>
<div class="section__body typo">
<div class="section__body typo richmedia">
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<blockquote class="typo note">
<p>{{ _('Login to join training plan') }}</p>
@@ -97,7 +97,7 @@
{% if not udoc.bio %}
{{ nothing.render("This person is lazy and didn't write anything.") }}
{% else %}
<div class="section__body typo">
<div class="section__body typo richmedia">
{{ udoc.bio|default('')|markdown|safe }}
</div>
{% endif %}