fixed sidebar item inactive issue & fixed _sidebar.md 404 issue & smooth scroll #242
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
花了大半天做了几个修改,还有几个问题找不到在哪改,感觉好多细节问题啊……
已修正问题:
1. 加载谜之路径侧边栏
这项修改我是存疑的,不知道作者初始意图是什么,但在这里我个人认为 basePath 与文档文件路径再叠加一次有点奇怪吧?应该是bug
2. 侧边栏不能点亮问题
在看代码之前,我一直以为这个是feature,翻了一下发现不对劲啊?明明有实现的,然后打印信息看了一下。
结果是这样的:
然后我看了一下定位的那个元素
。。。
3. 平滑滚动以及点击反馈修正
问题2的衍生问题。
这里的问题是,如果右侧足以容纳若干项定位点,那么左侧导航将被永远锁在右侧最顶上的那一个。下面的你点了也不会有反馈,尽管url会变化。
这里我为了在点击后进行 scrollIntoView 滚动时不让 scroll 事件起效引入了 tweezer.js
弃用 scrollIntoView 的原因是我发现 scrollIntoView 是异步的,给出的选项太少了,滚动不能调速度也没有 callback,这就导致我根本不可能在滚动时关掉事件完成后弄回来。
平滑滚动就是一个副产品了。
其他已知问题:
1. 某情况下点击反馈无效
跟问题3类似的场景,也就是右边容纳了不止一个定位点。
当你点击了最底下的那个边栏导航,然后刷新。
点亮的项就会锁在更上面一个,与当前url中id相同的一项无法点击。
2. 边栏下级菜单消失问题
我试了多次一直没找到稳定的复现方式,总之经常莫名出现三级菜单点不出来的问题,不是很懂怎么弄。 很影响体验。
3. 不能点击二级菜单回顶
这个我不知道是不是故意的设计,二级菜单id是 null 所以点了之后啥也不会发生。
例如docsify文档里的 Quick start,比如说你在这个地址
https://docsify.js.org/#/quickstart?id=preview-your-site
并不能通过点击 Quick start 回顶
masterbranch.