mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-07 06:25:21 +02:00
rename var
This commit is contained in:
parent
bcfef10df4
commit
7e71079f07
2 changed files with 6 additions and 6 deletions
|
@ -6,11 +6,11 @@ export default class TableOfContent {
|
|||
* Initialize table of content
|
||||
*
|
||||
* @param {string} tagSelector - selector for tags to observe
|
||||
* @param {string} tocWrapperSelector - selector for table of content wrapper
|
||||
* @param {string} tocParentElement - selector for table of content wrapper
|
||||
*/
|
||||
constructor({ tagSelector, tocWrapperSelector }) {
|
||||
constructor({ tagSelector, tocParentElement }) {
|
||||
this.tagSelector = tagSelector || 'h2,h3,h4';
|
||||
this.tocWrapperSelector = tocWrapperSelector;
|
||||
this.tocParentElement = tocParentElement;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ export default class TableOfContent {
|
|||
container.classList.add('table-of-content');
|
||||
container.appendChild(this.tocElement);
|
||||
|
||||
const tocWrapper = document.querySelector(this.tocWrapperSelector);
|
||||
const tocWrapper = document.querySelector(this.tocParentElement);
|
||||
|
||||
if (!tocWrapper) {
|
||||
throw new Error('Table of content wrapper not found');
|
||||
|
|
|
@ -46,9 +46,9 @@ export default class Page {
|
|||
return new TableOfContent({
|
||||
tagSelector:
|
||||
'h2.block-header--anchor,' +
|
||||
'h3.block-header--anchor,' +
|
||||
'h3.block-header--anchor,' +
|
||||
'h4.block-header--anchor',
|
||||
tocWrapperSelector: '#layout-sidebar-right',
|
||||
tocParentElement: '#layout-sidebar-right',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue