fix(comment): 修复开启评论侧边栏时报错

This commit is contained in:
nineya 2023-12-22 11:59:57 +08:00
parent 00aaeb871a
commit 9aae30eca2
4 changed files with 5 additions and 5 deletions

View File

@ -408,11 +408,11 @@ const commonContext = {
if (!window.CommentWidget) { if (!window.CommentWidget) {
return return
} }
$('.widget-comment').each(function (index, item) { $('.comment-section').each(function (index, item) {
let target = $(this).attr('data-target') let target = $(this).attr('data-target')
let id = $(this).attr('data-id') let id = $(this).attr('data-id')
CommentWidget.init( CommentWidget.init(
`.widget-comment[data-id='${id}'][data-target='${target}']`, `.comment-section[data-id='${id}'][data-target='${target}']`,
'/plugins/PluginCommentWidget/assets/static/style.css', '/plugins/PluginCommentWidget/assets/static/style.css',
{ {
group: target === 'Moment' ? 'moment.halo.run' : 'content.halo.run', group: target === 'Moment' ? 'moment.halo.run' : 'content.halo.run',

View File

@ -48,7 +48,7 @@
</div> </div>
<div class="card card-content" id="comment-wrapper" th:if="${enableComment}"> <div class="card card-content" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3> <h3 class="comment-title">评论</h3>
<div class="widget-comment" th:data-id="${theme.config.page_config.link_comment_id}" data-target="SinglePage"></div> <div class="comment-section" th:data-id="${theme.config.page_config.link_comment_id}" data-target="SinglePage"></div>
</div> </div>
</th:block> </th:block>
</th:block> </th:block>

View File

@ -91,6 +91,6 @@
<div class="card card-content" id="comment-wrapper" th:if="${enableComment}"> <div class="card card-content" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">评论</h3> <h3 class="comment-title">评论</h3>
<div class="widget-comment" th:data-id="${post.metadata.name}" th:data-target="${type}"></div> <div class="comment-section" th:data-id="${post.metadata.name}" th:data-target="${type}"></div>
</div> </div>
</th:block> </th:block>

View File

@ -38,7 +38,7 @@
</span> </span>
</div> </div>
<div class="journal-comment" th:if="${enableComment}"> <div class="journal-comment" th:if="${enableComment}">
<div class="widget-comment" data-target="Moment" th:data-id="${moment.metadata.name}"></div> <div class="comment-section" data-target="Moment" th:data-id="${moment.metadata.name}"></div>
</div> </div>
</div> </div>
<th:block th:replace="~{main/pagination :: pagination (${moments}, '/moments')}"/> <th:block th:replace="~{main/pagination :: pagination (${moments}, '/moments')}"/>