1
0
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:
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,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;
}
}