Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
tocbot.init({
// Where to render the table of contents.
tocSelector: `.toc-list-container`,
// Where to grab the headings to build the table of contents.
contentSelector: `.post-content`,
// Which headings to grab inside of the contentSelector element.
headingSelector: `h2, h3`,
headingsOffset: parseInt(this.props.headingsOffset),
})
}
componentDidMount() {
tocbot.init({
tocSelector: '.userguide-toc',
contentSelector: '.userguide-wrapper',
headingSelector: 'h1, h2, h3, h4',
positionFixedSelector: '.userguide-toc',
collapseDepth: 0 // 0 collapses 6 expands all
});
this.userGuide = document.querySelector('.userguide');
this.userGuideStyle = window.getComputedStyle(this.userGuide);
this.toc = document.querySelector('.userguide-toc');
this.throttledScrollListener = _.throttle(this.scrollListener.bind(this), 50);
document.addEventListener('scroll', this.throttledScrollListener, { passive: true });
document.addEventListener('resize', this.throttledScrollListener, { passive: true });
}
componentDidMount() {
tocbot.init({
tocSelector: '.userguide-toc',
contentSelector: '.userguide-wrapper',
headingSelector: 'h1, h2, h3, h4',
positionFixedSelector: '.userguide-toc',
collapseDepth: 0 // 0 collapses 6 expands all
});
this.userGuide = document.querySelector('.userguide');
this.userGuideStyle = window.getComputedStyle(this.userGuide);
this.toc = document.querySelector('.userguide-toc');
this.throttledScrollListener = _.throttle(this.scrollListener.bind(this), 50);
document.addEventListener('scroll', this.throttledScrollListener, { passive: true });
document.addEventListener('resize', this.throttledScrollListener, { passive: true });
}
componentWillUnmount() { // eslint-disable-line class-methods-use-this
tocbot.destroy();
document.removeEventListener('scroll', this.throttledScrollListener, { passive: true });
document.removeEventListener('resize', this.throttledScrollListener, { passive: true });
}
componentWillUnmount() { // eslint-disable-line class-methods-use-this
tocbot.destroy();
document.removeEventListener('scroll', this.throttledScrollListener, { passive: true });
document.removeEventListener('resize', this.throttledScrollListener, { passive: true });
}
public tocbotInit() {
const headers = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
for (let i = 0, len = headers.length; i < len; i += 1) {
headers[i].id = `header-${i}`;
}
tocbot.init({
tocSelector: '.menu',
contentSelector: '.article_content',
headingSelector: 'h2, h3, h4, h5, h6',
});
}
tocbotInit() {
const headers = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
for (let i = 0, len = headers.length; i < len; i += 1) {
headers[i].id = `header-${i}`;
}
tocbot.init({
tocSelector: '.menu',
contentSelector: '.article_content',
headingSelector: 'h2, h3, h4, h5, h6',
});
}
componentDidMount() {
tocbot.init(Contents.tocOptions);
}
componentDidMount() {
tocbot.init(Contents.tocOptions);
}
componentWillUnmount() {
tocbot.destroy();
}