1. 移除搜索内容显示,由于意外html标签导致样式问题暂时移除

2. 适配搜索瞬间查看页面,搜索到瞬间时支持查看,避免500错误
This commit is contained in:
j m 2024-07-30 05:32:35 +08:00
parent e244c532ce
commit 5c04585a9a
5 changed files with 154 additions and 74 deletions

View File

@ -5288,6 +5288,10 @@ button.swiper-pagination-bullet {
} }
} }
.description {
display: inline-block;
}
b { b {
color: var(--light-z); color: var(--light-z);
background: var(--theme); background: var(--theme);

File diff suppressed because one or more lines are too long

76
templates/moment.html Normal file
View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<th:block
th:insert="~{common/layout :: layout (title = ${title} + ' - ' + ${site.title}, canonical = @{/moments}, content = ~{::content}, isPost = true)}"
th:with="isJournals = true, enableShare = ${theme.config.page_config.enable_journals_share}, baseEnableComment = ${theme.config.page_config.enable_journals_comment}"
xmlns:th="https://www.thymeleaf.org">
<th:block th:fragment="content">
<div class="card card-content journal">
<p class="journal-date">
<i class="ri-send-plane-line"></i>
<em th:text="${#dates.format(moment.spec.releaseTime,'yyyy年MM月dd日 HH:mm:ss')}"></em>
</p>
<div class="journal-content fold">
<div class="main-content not-toc" data-target="Moment" th:data-id="${moment.metadata.name}">
[(${moment.spec.content.html})]
<mew-photos th:if="${!#lists.isEmpty(moment.spec.content.medium)}">
<img th:each="momentItem : ${moment.spec.content.medium}" th:if="${momentItem.type.name == 'PHOTO'}" th:src="${momentItem.url}" />
</mew-photos>
<th:block th:if="${!#lists.isEmpty(moment.spec.content.medium)}" th:each="momentItem : ${moment.spec.content.medium}">
<mew-video th:if="${momentItem.type.name == 'VIDEO'}" th:src="${momentItem.url}"></mew-video>
</th:block>
<th:block th:if="${!#lists.isEmpty(moment.spec.content.medium)}" th:each="momentItem : ${moment.spec.content.medium}">
<mew-music th:if="${momentItem.type.name == 'AUDIO'}" th:url="${momentItem.url}"
th:with="list = ${#strings.listSplit(momentItem.url,'/')}, size = ${#lists.size(list)}"
th:name="${size >= 0 ? list[size - 1] : momentItem.url}"
th:cover="${#theme.assets('/img/music.webp')}"
></mew-music>
</th:block>
</div>
</div>
<div class="journal-operation">
<span class="journal-operation-item">
<a class="like" th:data-id="${moment.metadata.name}" th:data-likes="${moment.stats.upvote}">
<i class="ri-heart-3-line"></i>
<em th:text="${(moment.stats.upvote != 0)? moment.stats.upvote : '喜欢'}"></em>
</a>
</span>
<span class="journal-operation-item" th:if="${enableComment}">
<a class="comment">
<i class="ri-message-3-line"></i>
<em th:text="${(moment.stats.totalComment != 0)? moment.stats.totalComment : '评论'}"></em>
</a>
</span>
<span class="journal-operation-item" th:if="${enableShare}">
<a class="share"><i class="ri-share-forward-line"></i><em>分享</em></a>
</span>
<div th:if="${theme.config.page_config.enable_journals_owner}" class="journal-operation-owner" th:title="${moment.owner.displayName}">
<img th:unless="${#strings.isEmpty(moment.owner.avatar)}" class="avatar" th:src="${moment.owner.avatar}"
alt="avatar">
<div th:if="${#strings.isEmpty(moment.owner.avatar)}" class="no-avatar">
<span class="avatar-info">[[${#strings.substring(moment.owner.displayName, 0, 1)}]]</span>
</div>
<span class="name">[[${moment.owner.displayName}]]</span>
</div>
</div>
<div class="journal-comment comment-wrapper-z-index" th:if="${enableComment}">
<th:block th:if="${theme.config.enhance.enable_pjax}">
<comment-widget
group="moment.halo.run"
kind="Moment"
version="v1alpha1"
th:name="${moment.metadata.name}"
with-replies="false"
></comment-widget>
</th:block>
<th:block th:unless="${theme.config.enhance.enable_pjax}">
<halo:comment
group="moment.halo.run"
kind="Moment"
th:attr="name=${moment.metadata.name}"
/>
</th:block>
</div>
</div>
</th:block>
</th:block>

View File

@ -20,19 +20,19 @@
Qmsg.warning(!query ? '请输入内容' : '不能输入星号(*)作为内容开头') Qmsg.warning(!query ? '请输入内容' : '不能输入星号(*)作为内容开头')
return return
} }
if(DreamConfig.pjax_state) { if (DreamConfig.pjax_state) {
event.preventDefault() event.preventDefault()
searchForm.setAttribute('data-pjax', '') searchForm.setAttribute('data-pjax', '')
} }
}) })
document.addEventListener('keydown', function(event) { document.addEventListener('keydown', function (event) {
if (event.key === 'Enter') { if (event.key === 'Enter') {
if (!searchForm.contains(document.activeElement)) { if (!searchForm.contains(document.activeElement)) {
event.preventDefault(); // 阻止默认行为 event.preventDefault() // 阻止默认行为
searchForm.dispatchEvent(new Event('submit')); // 触发submit事件 searchForm.dispatchEvent(new Event('submit')) // 触发submit事件
} }
} }
}); })
}) })
</script> </script>
<form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search"> <form id="halo-search-form" class="search-form-inner" method="get" action="/search" role="search">
@ -46,28 +46,28 @@
th:placeholder="${theme.config.page_config.search.search_placeholder}" th:placeholder="${theme.config.page_config.search.search_placeholder}"
th:value="${searchResult.keyword}" th:value="${searchResult.keyword}"
/> />
<button class="search-form-btn" th:title="${theme.config.page_config.search.search_btn_title}" type="submit"> <button class="search-form-btn" th:title="${theme.config.page_config.search.search_btn_title}"
type="submit">
<i class="ri-search-line"></i> <i class="ri-search-line"></i>
</button> </button>
</form> </form>
</div> </div>
</div> </div>
<div th:if="${searchResult.hits.size() > 0}" class="widget card search" th:each="hit : ${searchResult.hits}"> <div th:if="${searchResult.hits.size() > 0}" class="widget card search" th:each="hit : ${searchResult.hits}">
<a th:href="${hit.permalink}" th:target="${theme.config.page_config.search.search_target}" >
<div class="card-content main"> <div class="card-content main">
<h2 class="title" th:utext="${hit.title}"></h2> <a th:href="${hit.permalink}" th:target="${theme.config.page_config.search.search_target}">
<div class="main-content not-toc"> <h2 class="title">[(${hit.title})]</h2>
<span th:utext="${hit.description}"></span> </a>
</div> <!-- <div class="main-content not-toc description" th:utext="${hit.description}">-->
<!-- </div>-->
<hr/> <hr/>
<div class="meta"> <div class="meta">
<div></div> <div></div>
<em th:text="'最后更新于 ' + ${#dates.format(hit.updateTimestamp,'yyyy年MM月dd日 HH:mm:ss')}"></em> <em th:text="'最后更新于 ' + ${#dates.format(hit.updateTimestamp,'yyyy年MM月dd日 HH:mm:ss')}"></em>
</div> </div>
</div> </div>
</a>
</div> </div>
<div th:unless="${searchResult.hits.size() > 0}" class="widget card search" > <div th:unless="${searchResult.hits.size() > 0}" class="widget card search">
<div class="result-empty"> <div class="result-empty">
<div class="result-empty-tips" th:utext="${theme.config.page_config.search.search_empty_tips}"></div> <div class="result-empty-tips" th:utext="${theme.config.page_config.search.search_empty_tips}"></div>
</div> </div>

View File

@ -30,7 +30,7 @@ spec:
settingName: theme-dream2-plus-setting settingName: theme-dream2-plus-setting
configMapName: theme-dream2-plus-configMap configMapName: theme-dream2-plus-configMap
# 版本号 # 版本号
version: 1.2.7.beta1 version: 1.2.7.beta2
# 最低支持的 Halo 版本 # 最低支持的 Halo 版本
require: ">=2.15.0" require: ">=2.15.0"
# 许可 # 许可