mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-25 10:50:50 +02:00
feat: dispatch wcThemeChange
event to support themeable user plugins
See https://discord.com/channels/722225264733716590/742863504515793149/807370581611511858
This commit is contained in:
parent
aa1071adfc
commit
50d3d41e9e
1 changed files with 4 additions and 0 deletions
|
@ -155,6 +155,10 @@ function renderThemeVariation(isDarkTheme, themeMode = 2, init = false) {
|
|||
// Update active theme mode in navbar theme selector.
|
||||
showActiveTheme(themeMode);
|
||||
|
||||
// Dispatch `wcThemeChange` event to support themeable user plugins.
|
||||
const themeChangeEvent = new CustomEvent('wcThemeChange', {detail: {isDarkTheme: () => isDarkTheme}});
|
||||
document.dispatchEvent(themeChangeEvent);
|
||||
|
||||
// Check if re-render required.
|
||||
if (!init) {
|
||||
// If request to render light when light variation already rendered, return.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue