X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/09c6a3c2405742ea6003e9a8a30e7ad212ab6977..4310d34135243e91fdacd960a825f60f0231621e:/resources/js/components/code-highlighter.js diff --git a/resources/js/components/code-highlighter.js b/resources/js/components/code-highlighter.js index 5ffab3775..14bfc97f0 100644 --- a/resources/js/components/code-highlighter.js +++ b/resources/js/components/code-highlighter.js @@ -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