]> BookStack Code Mirror - bookstack/blob - resources/js/components/details-highlighter.js
Added a view for the API docs
[bookstack] / resources / js / components / details-highlighter.js
1 import Code from "../services/code"
2 class DetailsHighlighter {
3
4     constructor(elem) {
5         this.elem = elem;
6         this.dealtWith = false;
7         elem.addEventListener('toggle', this.onToggle.bind(this));
8     }
9
10     onToggle() {
11         if (this.dealtWith) return;
12
13         Code.highlightWithin(this.elem);
14         this.dealtWith = true;
15     }
16 }
17
18 export default DetailsHighlighter;