fi3ework / hexo-theme-archer

🎯 A smart and modern theme for Hexo.
https://fi3ework.github.io/hexo-theme-archer
MIT License
1.49k stars 274 forks source link

[Dev]更了下dev,然后发现toc-wrapper没了,就是右侧那个根据本章内小标题生成的列表 #317

Closed ted423 closed 1 month ago

ted423 commented 2 years ago

「描述遇到的问题」或「发现的 bug」(Describe the problem or bug you encounter) https://github.com/fi3ework/hexo-theme-archer/issues/316 因为这个issue升的 确认了下 toc确实是enable的 你是否已经阅读过以下内容,并确认你的行为是正确的,在 [ ] 中填入 x 选中(Ensure that you had consulted followings and confirm the validity of your operation, fill x in [ ] to select)

如何复现(To Reproduce)

存在问题或 bug 的已部署上线的页面地址(A deployed page link that with bug or problem)

如果可能是与 markdown 内容相关的问题或 bug,请粘贴对应的 markdown 内容(If the problem or bug that may be related to markdown, paste it here)

打开控制台,填写控制台中打印的主题的版本,如果脚本出错可直接提供控制台截图(Open the console and report the version of hexo-theme-archer. You can paste the screenshot on console directly if there is error with script)

信息 (please complete the following information):

其他信息(Additional context)

ted423 commented 2 years ago

还有这个报错 image

image h是2级标题,只有两个,然后c到2的时候就报错退出了 看了下右边还是有东西, 只不过有个opacity: 0; 大概是脚本出错导致css没改

LolipopJ commented 2 years ago

我这边使用 dev 分支代码并没有出现渲染失败的问题……

或许尝试一下 Hexo 根目录执行 hexo clean 清除以前版本的缓存文件避免冲突?

ted423 commented 2 years ago

我这边使用 dev 分支代码并没有出现渲染失败的问题……

或许尝试一下 Hexo 根目录执行 hexo clean 清除以前版本的缓存文件避免冲突?

我这边尝试了hexo clean 也试了删除主题文件,重新解压也是一样

ted423 commented 2 years ago

又试了下,现在没有报错,主要是 &-loding { opacity: 0; } 这个的问题

LolipopJ commented 2 years ago

src/js/toc.js 执行的最后一步移除了其未就绪的等待状态:$('.toc-wrapper').removeClass('toc-wrapper-loding')。我这边能够正常移除:

image

也许还是您那边的脚本文件未能正确执行?是每一篇博客都出现了这个问题吗?

ted423 commented 2 years ago

我发现又开始报错了,每篇都有。报错是导致右边的二级标题无法展开

toc.js:142 Uncaught TypeError: Cannot set property 'onclick' of undefined at i (toc.js:142) at s (toc.js:125) at L (toc.js:194) at HTMLDocument. (init.js:45)

ted423 commented 2 years ago

https://ted423.github.io/Anime/Frozen/#/P2P 似乎是因为i超了上限,i是14,但二级标题只有11个

ted423 commented 2 years ago

只有1级标题的情况下,archorjsLinks length是0,但是仍然会读下,导致报错,我现在是吧loding 那个opacity注释掉了 https://ted423.github.io/Software/tools/#KeePassXC

LolipopJ commented 2 years ago

我想问题出在每个标题后的这个小链接图标:

image

它并没有在执行脚本前渲染出来,我想应该修改一下渲染顺序试试看。

我再加一个判断,如果不存在这个 archorjsLinks,就跳过:

if (archorjsLinks.length && archorjsLinks.length > i) {
  archorjsLinks[i].onclick = () => {
    tocOnclickFunction()
    return false
  }
}

已经推动修改到 dev 分支,现在再试试呢……

LolipopJ commented 2 years ago

目前 toc.js 存在一些问题,我计划后面将它重写一遍。

ted423 commented 2 years ago

了解,我不急哈

LolipopJ commented 1 month ago

Fixed here.