Fix instance settings prefs JS 404 on static route.
Register instance_settings_prefs.js (and options_panel.js) in install_instance_theme_static; add delegated click handlers for embed lazy tabs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -373,6 +373,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
function installDelegatedHandlers() {
|
||||
if (document.documentElement.dataset.prefsDelegateBound === "1") return;
|
||||
document.documentElement.dataset.prefsDelegateBound = "1";
|
||||
document.addEventListener("click", (ev) => {
|
||||
const target = ev.target;
|
||||
if (!(target instanceof Element)) return;
|
||||
if (target.closest("#display-prefs-save")) {
|
||||
ev.preventDefault();
|
||||
void saveDisplayPrefs();
|
||||
return;
|
||||
}
|
||||
if (target.closest("#env-config-save")) {
|
||||
ev.preventDefault();
|
||||
void saveEnvConfig(false);
|
||||
return;
|
||||
}
|
||||
if (target.closest("#env-config-save-restart")) {
|
||||
ev.preventDefault();
|
||||
void saveEnvConfig(true);
|
||||
return;
|
||||
}
|
||||
if (target.closest("#env-config-reload")) {
|
||||
ev.preventDefault();
|
||||
void loadEnvConfig(true);
|
||||
return;
|
||||
}
|
||||
if (target.closest("#pwd-save-btn")) {
|
||||
ev.preventDefault();
|
||||
void savePassword();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function bindClickOnce(id, handler) {
|
||||
const el = document.getElementById(id);
|
||||
if (!el || el.dataset.bound === "1") return;
|
||||
@@ -389,6 +422,7 @@
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
installDelegatedHandlers();
|
||||
bindEvents();
|
||||
loadDisplayPrefsForm(false);
|
||||
loadEnvConfig(false);
|
||||
|
||||
Reference in New Issue
Block a user