BookStack/resources/js/components/details-highlighter.js
Dan Brown e711290d8b
Ran eslint fix on existing codebase
Had to do some manual fixing of the app.js file due to misplaced
comments
2023-04-18 22:20:02 +01:00

24 lines
542 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;
}
}