mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
fix: handle hash navigation to prevent duplicate callbacks (#2575)
This commit is contained in:
parent
84ba4686ed
commit
72569dee8d
@ -917,7 +917,7 @@ If you have a link to the homepage in the sidebar and want it to be shown as act
|
||||
|
||||
For more details, see [#1131](https://github.com/docsifyjs/docsify/issues/1131).
|
||||
|
||||
## themeColor ⚠️
|
||||
## themeColor ⚠️ :id=themecolor
|
||||
|
||||
!> Deprecated as of v5. Use the `--theme-color` [theme property](themes#theme-properties) to [customize](themes#customization) your theme color.
|
||||
|
||||
@ -931,7 +931,7 @@ window.$docsify = {
|
||||
};
|
||||
```
|
||||
|
||||
## topMargin ⚠️
|
||||
## topMargin ⚠️ :id=topmargin
|
||||
|
||||
!> Deprecated as of v5. Use the `--scroll-padding-top` [theme property](themes#theme-properties) to specify a scroll margin when using a sticky navbar.
|
||||
|
||||
|
||||
@ -47,6 +47,15 @@ export class HashHistory extends History {
|
||||
|
||||
if (el && el.tagName === 'A' && !isExternal(el.href)) {
|
||||
navigating = true;
|
||||
|
||||
// Do not compare hash containing these classes.
|
||||
if (['app-name-link', 'page-link'].includes(el.className)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (el.hash === location.hash) {
|
||||
cb({ event: e, source: 'navigate' });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user