Refactor ProviderSettingsModal to include a callback on close and clean up CSS file

This commit is contained in:
Ahmet Ildirim 2025-03-26 10:55:09 +01:00
parent fb9bc5df20
commit 21059daeef
4 changed files with 9 additions and 22567 deletions

22553
main.js

File diff suppressed because one or more lines are too long

View file

@ -3,14 +3,16 @@ import { ProviderType } from 'src/providers';
import Inscribe from 'src/main';
export class ProviderSettingsModal extends Modal {
plugin: Inscribe;
providerType: ProviderType;
private plugin: Inscribe;
private providerType: ProviderType;
private onCloseCallback: () => void;
constructor(app: App, plugin: Inscribe, providerType: ProviderType) {
constructor(app: App, plugin: Inscribe, providerType: ProviderType, onCloseCallback: () => void) {
super(app);
this.plugin = plugin;
this.providerType = providerType;
this.modalEl.addClass('inscribe-provider-settings-modal');
this.onCloseCallback = onCloseCallback;
}
onOpen() {
@ -129,6 +131,6 @@ export class ProviderSettingsModal extends Modal {
onClose() {
const { contentEl } = this;
contentEl.empty();
(this.plugin.app as any).setting?.openTabById(this.plugin.manifest.id);
this.onCloseCallback();
}
}

View file

@ -147,7 +147,9 @@ class ProvidersSection {
.setIcon(configured ? "cog" : "cog")
.setTooltip(configured ? "Provider configured" : "Provider not configured")
.onClick(() => {
new ProviderSettingsModal(this.app, this.plugin, type).open()
new ProviderSettingsModal(this.app, this.plugin, type, () => {
this.render();
}).open();
});
}
}

View file

@ -1,12 +1,3 @@
/*
This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.
If your plugin does not need CSS, delete this file.
*/
/* Path Mapping Styles */
.mapping-input-section {
margin-bottom: 20px;