feat: barre d'outils de lecture epinglee, coloration syntaxique des fichiers de code et avatars predefinis (#115, #117, BUG-078)
This commit is contained in:
@@ -598,6 +598,17 @@ function applyTheme(themeKey, mode) {
|
||||
// Notify other components of theme change
|
||||
try {
|
||||
root.setAttribute('data-theme', mode);
|
||||
// Syntax highlighting follows the light/dark mode (BUG-078): the theme
|
||||
// *key* is not a mode, so toggling the sheets by key used to disable both
|
||||
// and strip every code block of its colours. Sepia/high-contrast reuse the
|
||||
// light palette.
|
||||
var darkSheet = document.getElementById('hljs-theme-dark');
|
||||
var lightSheet = document.getElementById('hljs-theme-light');
|
||||
if (darkSheet && lightSheet) {
|
||||
var isDark = mode === 'dark';
|
||||
darkSheet.disabled = !isDark;
|
||||
lightSheet.disabled = isDark;
|
||||
}
|
||||
document.dispatchEvent(new CustomEvent('themechange', { detail: { theme: themeKey, mode: mode } }));
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user