mirror of
https://github.com/h-sphere/sql-seal.git
synced 2026-07-22 10:10:28 +00:00
* chore: reworking plugin internals into modules * feat: settings module is now working, added debug module, enabled new api module * chore: restoring external API * feat: refactoring project to use proper inversion of control * feat: plugins can now be loaded in any order * chore: final file migration, all typescript is in modules now * chore: fixing dependencies of cellParser * feat: csv and json views are only registered when they are not colliding with other plugins * feat: fixed library behaviour on canvas
32 lines
1 KiB
TypeScript
32 lines
1 KiB
TypeScript
import { makeInjector } from "@hypersphere/dity";
|
|
import { SettingsModule } from "./module";
|
|
import { App, Plugin } from "obsidian";
|
|
import { SQLSealSettingsTab } from "./SQLSealSettingsTab";
|
|
import { Settings } from "./Settings";
|
|
import { SettingsCSVControls } from "./settingsTabSection/SettingsCSVControls";
|
|
import { SettingsJsonControls } from "./settingsTabSection/SettingsJsonControls";
|
|
|
|
@(makeInjector<SettingsModule>()(["plugin", "settingsTab", "app", "settings"]))
|
|
export class SettingsInit {
|
|
async make(
|
|
plugin: Plugin,
|
|
settingsTab: SQLSealSettingsTab,
|
|
app: App,
|
|
settings: Settings,
|
|
) {
|
|
const csvControl = new SettingsCSVControls(settings, app, plugin);
|
|
const jsonControl = new SettingsJsonControls(settings, app, plugin);
|
|
|
|
const controls = [csvControl, jsonControl];
|
|
|
|
settingsTab.registerControls(...controls);
|
|
|
|
return () => {
|
|
controls.forEach((c) => c.register());
|
|
plugin.addSettingTab(settingsTab);
|
|
plugin.register(() => {
|
|
controls.forEach((c) => c.unregister());
|
|
});
|
|
};
|
|
}
|
|
}
|