Fix crash closing settings

This commit is contained in:
pythongosssss
2024-11-07 20:47:13 +00:00
parent 1ca249fcb8
commit 9cc42914af
2 changed files with 28 additions and 2 deletions
+15 -1
View File
@@ -492,7 +492,21 @@ app.registerExtension({
$el("button", {
textContent: "Manage Custom Words",
onclick: () => {
app.ui.settings.element.close();
try {
// Try closing old settings window
if (typeof app.ui.settings.element?.close === "function") {
app.ui.settings.element.close();
}
} catch (error) {
}
try {
// Try closing new vue dialog
document.querySelector(".p-dialog-close-button").click();
} catch (error) {
// Fallback to just hiding the element
app.ui.settings.element.style.display = "none";
}
new CustomWordsDialog().show();
},
style: {
+13 -1
View File
@@ -268,7 +268,19 @@ app.registerExtension({
$el("button", {
textContent: "Manage",
onclick: () => {
app.ui.settings.element.close();
try {
// Try closing old settings window
if (typeof app.ui.settings.element?.close === "function") {
app.ui.settings.element.close();
}
} catch (error) {}
try {
// Try closing new vue dialog
document.querySelector(".p-dialog-close-button").click();
} catch (error) {
// Fallback to just hiding the element
app.ui.settings.element.style.display = "none";
}
const dialog = new WidgetDefaultsDialog();
dialog.show();
},