Split out codemirror JS to its own module

Added a cache-compatible module loading system/pattern to the codebase.
This commit is contained in:
Dan Brown
2022-02-08 11:10:01 +00:00
parent 130dc05517
commit a2bcf765a8
10 changed files with 73 additions and 56 deletions

View File

@ -1,8 +1,12 @@
import Code from "../services/code"
class CodeHighlighter {
constructor(elem) {
Code.highlightWithin(elem);
const codeBlocks = elem.querySelectorAll('pre');
if (codeBlocks.length > 0) {
window.importVersioned('code').then(Code => {
Code.highlightWithin(elem);
});
}
}
}