mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-07-19 05:09:41 +02:00
* Create nodemon.json
* Add table of content
* update view
* remove logs
* update tags var
* update layout
* Revert "update layout"
This reverts commit 18aad62257
.
* update layout
* Update layout.pcss
* update from master
* Update sidebar.twig
* remove non valued changes
* Update table-of-content.js
* Update table-of-content.pcss
* Update table-of-content.pcss
* Update layout.pcss
* Update table-of-content.js
* remove unused styles
* not module
* rename var
* remove log
* update structure
* Update table-of-content.js
* Update table-of-content.js
* Update layout.pcss
* Update table-of-content.js
* try not to use intersection observer
* Update table-of-content.js
* fix scroll padding
* fix header component layout
* update logic
* fix click area
* Update table-of-content.js
* Update table-of-content.js
* small fixes
* remove unused
* Update table-of-content.js
* Update decorators.js
* Update table-of-content.js
* Update table-of-content.js
* Update table-of-content.js
* Update table-of-content.js
* Update table-of-content.js
* fix scroll issues, resolve eslit ts/js conflicts
* add some todos
* handle up-direction scroll as well
* optimization
* update offsets
* Update header.pcss
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
/**
|
|
* @class Page
|
|
* @classdesc Class for page module
|
|
*/
|
|
export default class Page {
|
|
/**
|
|
* Creates base properties
|
|
*/
|
|
constructor() {
|
|
this.codeStyler = null;
|
|
this.tableOfContent = null;
|
|
}
|
|
|
|
/**
|
|
* Called by ModuleDispatcher to initialize module from DOM
|
|
*/
|
|
init() {
|
|
this.codeStyler = this.createCodeStyling();
|
|
this.tableOfContent = this.createTableOfContent();
|
|
}
|
|
|
|
/**
|
|
* Init code highlighting
|
|
*/
|
|
async createCodeStyling() {
|
|
const { default: CodeStyler } = await import(/* webpackChunkName: "code-styling" */ './../classes/codeStyler');
|
|
|
|
try {
|
|
// eslint-disable-next-line no-new
|
|
new CodeStyler({
|
|
selector: '.block-code__content',
|
|
});
|
|
} catch (error) {
|
|
console.error(error); // @todo send to Hawk
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Init table of content
|
|
*
|
|
* @returns {Promise<TableOfContent>}
|
|
*/
|
|
async createTableOfContent() {
|
|
const { default: TableOfContent } = await import(/* webpackChunkName: "table-of-content" */ '../classes/table-of-content');
|
|
|
|
try {
|
|
// eslint-disable-next-line no-new
|
|
new TableOfContent({
|
|
tagSelector:
|
|
'h2.block-header--anchor,' +
|
|
'h3.block-header--anchor,' +
|
|
'h4.block-header--anchor',
|
|
appendTo: document.getElementById('layout-sidebar-right'),
|
|
});
|
|
} catch (error) {
|
|
console.error(error); // @todo send to Hawk
|
|
}
|
|
}
|
|
}
|