Ver Fonte

BugFix: Initializing TableOfContents component is failed

Yuki Takei há 6 anos atrás
pai
commit
14463cee5a
1 ficheiros alterados com 4 adições e 0 exclusões
  1. 4 0
      src/client/js/components/TableOfContents.jsx

+ 4 - 0
src/client/js/components/TableOfContents.jsx

@@ -70,6 +70,10 @@ class TableOfContents extends React.Component {
   resetScrollbar(revisionTocTop) {
     const tocContentElem = document.querySelector('.revision-toc .markdownIt-TOC');
 
+    if (tocContentElem == null) {
+      return;
+    }
+
     // window height - revisionTocTop - .system-version height
     const viewHeight = window.innerHeight - revisionTocTop - 20;