Skip to content

Update articletoc.js 修复目录首次点击失效问题 #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tiengming
Copy link
Contributor

✨ 修复说明

  • 修复目录首次点击无效的问题(内容尚未渲染完成时 TOC 未构建)
  • 使用 MutationObserver 观察 .markdown-body 自动生成目录
  • 插件仅执行一次,避免重复挂载 .toc

✅ 效果验证

  1. 在任意文章页等待内容加载
  2. 点击右下角图标即可展开目录(无需滚动页面)
  3. 验证目录正确生成所有标题链接

插件行为对原样式零侵入,样式作用域限制在 .toc.toc-icon

### ✨ 修复说明

- 修复目录首次点击无效的问题(内容尚未渲染完成时 TOC 未构建)
- 使用 `MutationObserver` 观察 `.markdown-body` 自动生成目录
- 插件仅执行一次,避免重复挂载 `.toc`

### ✅ 效果验证

1. 在任意文章页等待内容加载
2. 点击右下角图标即可展开目录(无需滚动页面)
3. 验证目录正确生成所有标题链接

> 插件行为对原样式零侵入,样式作用域限制在 `.toc` 与 `.toc-icon`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant