mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-02 23:40:04 +00:00
parent
ccb2cb5b7c
commit
5404f22bf9
1 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,7 @@ class PageDisplay {
|
||||||
Code.highlight();
|
Code.highlight();
|
||||||
this.setupPointer();
|
this.setupPointer();
|
||||||
this.setupNavHighlighting();
|
this.setupNavHighlighting();
|
||||||
|
this.setupDetailsCodeBlockRefresh();
|
||||||
|
|
||||||
// Check the hash on load
|
// Check the hash on load
|
||||||
if (window.location.hash) {
|
if (window.location.hash) {
|
||||||
|
@ -196,6 +197,16 @@ class PageDisplay {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupDetailsCodeBlockRefresh() {
|
||||||
|
const onToggle = event => {
|
||||||
|
const codeMirrors = [...event.target.querySelectorAll('.CodeMirror')];
|
||||||
|
codeMirrors.forEach(cm => cm.CodeMirror && cm.CodeMirror.refresh());
|
||||||
|
};
|
||||||
|
|
||||||
|
const details = [...this.elem.querySelectorAll('details')];
|
||||||
|
details.forEach(detail => detail.addEventListener('toggle', onToggle));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PageDisplay;
|
export default PageDisplay;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue