mirror of
https://github.com/ahmetildirim/obsidian-inscribe.git
synced 2026-07-22 05:44:10 +00:00
Refactor ProviderSettingsModal to include a callback on close and clean up CSS file
This commit is contained in:
parent
fb9bc5df20
commit
21059daeef
4 changed files with 9 additions and 22567 deletions
22553
main.js
22553
main.js
File diff suppressed because one or more lines are too long
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue