fix(post-tools): fixed bug where post tools does not show

This commit is contained in:
XPoet 2022-10-29 00:16:15 +08:00
parent 5536e3db17
commit 028b7eebd6
4 changed files with 13 additions and 5 deletions

View File

@ -30,12 +30,14 @@ const {
<% } %>
<div class="post-scripts<%= theme.pjax?.enable === true ? ' pjax' : '' %>">
<% if (t_toc?.enable === true && is_post()) { %>
<% if (is_post()) { %>
<%- __js([
'js/post-helper.js',
'js/toc.js',
'js/libs/anime.min.js'
]) %>
<% if (t_toc?.enable === true) { %>
<%- __js('js/toc.js') %>
<% } %>
<% } %>
</div>

View File

@ -44,6 +44,7 @@ hexo.extend.helper.register('export_config', function () {
side_tools: theme.side_tools || {},
pjax: theme.pjax || {},
lazyload: theme.lazyload || {},
comment: theme.comment || {},
version: require('../../package.json').version
}

View File

@ -136,6 +136,7 @@
position fixed
top $header-height + $component-spacing-value
left 'calc((100vw - %s / 2) - 5rem)' % $content-max-width
box-sizing border-box
opacity 0
transition-t("top, transform, opacity, left", "0, 0, 0.2, 0", "0.2, 0.2, 0.2, 0.2", "ease, ease, ease, ease")

View File

@ -114,10 +114,14 @@ function initToggleShowToc() {
observer.observe(commentsCountDom, config)
}
}
KEEP.utils.postHelper.initToggleToc()
KEEP.utils.postHelper.initSetPostToolsLeft()
KEEP.utils.postHelper.goToComments()
KEEP.utils.postHelper.watchPostCommentsCount()
if (KEEP.theme_config.toc.enable === true) {
KEEP.utils.postHelper.initToggleToc()
}
if (KEEP.theme_config.comment.enable === true) {
KEEP.utils.postHelper.goToComments()
KEEP.utils.postHelper.watchPostCommentsCount()
}
}
if (KEEP.theme_config.pjax.enable === true && KEEP.utils) {