mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03: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,4 +1,3 @@
|
||||
import Code from "../services/code"
|
||||
class DetailsHighlighter {
|
||||
|
||||
constructor(elem) {
|
||||
@ -10,7 +9,11 @@ class DetailsHighlighter {
|
||||
onToggle() {
|
||||
if (this.dealtWith) return;
|
||||
|
||||
Code.highlightWithin(this.elem);
|
||||
if (this.elem.querySelector('pre')) {
|
||||
window.importVersioned('code').then(Code => {
|
||||
Code.highlightWithin(this.elem);
|
||||
});
|
||||
}
|
||||
this.dealtWith = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user