Fix theme change if no file tree is shown

This commit is contained in:
Sebastian Serth
2023-08-01 16:33:45 +02:00
parent 32893bed43
commit 1d7fd98c79

View File

@ -422,9 +422,13 @@ var CodeOceanEditor = {
this.toggleButtonStates(); this.toggleButtonStates();
}.bind(this)); }.bind(this));
$(document).on('theme:change', function(event) { $(document).on('theme:change', function(event) {
const newColorScheme = event.detail.currentTheme; const jsTree = filesInstance?.jstree(true);
// Update the JStree theme
filesInstance.jstree(true).set_theme(newColorScheme === "dark" ? "default-dark" : "default"); if (jsTree) {
const newColorScheme = event.detail.currentTheme;
// Update the JStree theme
jsTree?.set_theme(newColorScheme === "dark" ? "default-dark" : "default");
}
}); });
}, },