]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/code-highlighter.js
Editors: Properly aligned edit area border radius
[bookstack] / resources / js / components / code-highlighter.js
index 5ffab377525d875f34e02f7be6d65e68dee1c4c3..e12d770447fb1584243e0d3d9820ef21302d96a6 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