BookStack/resources/js/components/details-highlighter.js

18 lines
389 B
JavaScript
Raw Normal View History

2020-01-16 04:18:02 +08:00
import Code from "../services/code"
class DetailsHighlighter {
constructor(elem) {
this.elem = elem;
this.dealtWith = false;
elem.addEventListener('toggle', this.onToggle.bind(this));
}
onToggle() {
if (this.dealtWith) return;
Code.highlightWithin(this.elem);
this.dealtWith = true;
}
}
export default DetailsHighlighter;