]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/details-highlighter.js
Covered app icon setting with testing
[bookstack] / resources / js / components / details-highlighter.js
index 1f3b66c674c2c882b7f1d71b4fcb79867c06dcfe..6466fb584882b0af36280f06dc2420f7599305e8 100644 (file)
@@ -1,21 +1,22 @@
-class DetailsHighlighter {
+import {Component} from "./component";
 
-    constructor(elem) {
-        this.elem = elem;
+export class DetailsHighlighter extends Component {
+
+    setup() {
+        this.container = this.$el;
         this.dealtWith = false;
-        elem.addEventListener('toggle', this.onToggle.bind(this));
+
+        this.container.addEventListener('toggle', this.onToggle.bind(this));
     }
 
     onToggle() {
         if (this.dealtWith) return;
 
-        if (this.elem.querySelector('pre')) {
+        if (this.container.querySelector('pre')) {
             window.importVersioned('code').then(Code => {
-                Code.highlightWithin(this.elem);
+                Code.highlightWithin(this.container);
             });
         }
         this.dealtWith = true;
     }
-}
-
-export default DetailsHighlighter;
\ No newline at end of file
+}
\ No newline at end of file