summaryrefslogtreecommitdiffstats
path: root/vendor/mdbook/src/theme/book.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/mdbook/src/theme/book.js')
-rw-r--r--vendor/mdbook/src/theme/book.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/vendor/mdbook/src/theme/book.js b/vendor/mdbook/src/theme/book.js
index d40440c72..e303ebb45 100644
--- a/vendor/mdbook/src/theme/book.js
+++ b/vendor/mdbook/src/theme/book.js
@@ -4,14 +4,16 @@
window.onunload = function () { };
// Global variable, shared between modules
-function playground_text(playground) {
+function playground_text(playground, hidden = true) {
let code_block = playground.querySelector("code");
if (window.ace && code_block.classList.contains("editable")) {
let editor = window.ace.edit(code_block);
return editor.getValue();
- } else {
+ } else if (hidden) {
return code_block.textContent;
+ } else {
+ return code_block.innerText;
}
}
@@ -166,7 +168,6 @@ function playground_text(playground) {
.filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); });
- Array
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
@@ -300,6 +301,13 @@ function playground_text(playground) {
themePopup.querySelector("button#" + get_theme()).focus();
}
+ function updateThemeSelected() {
+ themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
+ el.classList.remove('theme-selected');
+ });
+ themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
+ }
+
function hideThemes() {
themePopup.style.display = 'none';
themeToggleButton.setAttribute('aria-expanded', false);
@@ -355,6 +363,7 @@ function playground_text(playground) {
html.classList.remove(previousTheme);
html.classList.add(theme);
+ updateThemeSelected();
}
// Set theme
@@ -592,7 +601,7 @@ function playground_text(playground) {
text: function (trigger) {
hideTooltip(trigger);
let playground = trigger.closest("pre");
- return playground_text(playground);
+ return playground_text(playground, false);
}
});