mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 12:16:07 +00:00
22 lines
540 B
JavaScript
22 lines
540 B
JavaScript
import {Component} from "./component";
|
|
|
|
export class DetailsHighlighter extends Component {
|
|
|
|
setup() {
|
|
this.container = this.$el;
|
|
this.dealtWith = false;
|
|
|
|
this.container.addEventListener('toggle', this.onToggle.bind(this));
|
|
}
|
|
|
|
onToggle() {
|
|
if (this.dealtWith) return;
|
|
|
|
if (this.container.querySelector('pre')) {
|
|
window.importVersioned('code').then(Code => {
|
|
Code.highlightWithin(this.container);
|
|
});
|
|
}
|
|
this.dealtWith = true;
|
|
}
|
|
} |