]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/code-highlighter.js
Updated a batch of JS components
[bookstack] / resources / js / components / code-highlighter.js
index 5ffab377525d875f34e02f7be6d65e68dee1c4c3..14bfc97f04ed5358b2758112e9cf3f06d47ae423 100644 (file)
@@ -1,14 +1,16 @@
-class CodeHighlighter {
+import {Component} from "./component";
 
-    constructor(elem) {
-        const codeBlocks = elem.querySelectorAll('pre');
+export class CodeHighlighter extends Component{
+
+    setup() {
+        const container = this.$el;
+
+        const codeBlocks = container.querySelectorAll('pre');
         if (codeBlocks.length > 0) {
             window.importVersioned('code').then(Code => {
-               Code.highlightWithin(elem);
+               Code.highlightWithin(container);
             });
         }
     }
 
-}
-
-export default CodeHighlighter;
\ No newline at end of file
+}
\ No newline at end of file