mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
🐛 Fix: APlayer invades the click event of the anchor links, resulting in invalid Chinese anchor links scrolling (#292)
This commit is contained in:
+7
-1
@@ -612,10 +612,16 @@ class FixIt {
|
||||
* init table of contents
|
||||
*/
|
||||
initToc() {
|
||||
const $tocCore = document.getElementById('TableOfContents');
|
||||
let $tocCore = document.getElementById('TableOfContents');
|
||||
if ($tocCore === null) {
|
||||
return;
|
||||
}
|
||||
// It's a dirty hack to fix the bug of APlayer, see https://github.com/hugo-fixit/FixIt/issues/292
|
||||
if (typeof APlayer === 'function') {
|
||||
const $newTocCore = $tocCore.cloneNode(true);
|
||||
$tocCore.parentElement.replaceChild($newTocCore, $tocCore);
|
||||
$tocCore = $newTocCore;
|
||||
}
|
||||
if (document.getElementById('toc-static').dataset.kept === true || this.util.isTocStatic()) {
|
||||
const $tocContentStatic = document.getElementById('toc-content-static');
|
||||
if ($tocCore.parentElement !== $tocContentStatic) {
|
||||
|
||||
Reference in New Issue
Block a user