mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-10 05:06:56 +08:00
Split out codemirror JS to its own module
Added a cache-compatible module loading system/pattern to the codebase.
This commit is contained in:
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user