diff --git a/src/main.ts b/src/main.ts index 4cf9e65..c9e3a05 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,7 +23,7 @@ import { TemplateService } from "./core/template/TemplateService"; import { getTemplateService } from "./core/template/getTemplateService"; import { retryForm } from "./core/template/retryForm"; import { executeTemplate } from "./core/template/templateParser"; -import { settingsStore } from "./store/store"; +import { settingsStore } from "./store/SettngsStore"; import { FormPickerModal } from "./suggesters/FormPickerModal"; import { NewNoteModal } from "./suggesters/NewNoteModal"; import { log_error, log_notice, notifyWarning } from "./utils/Log"; diff --git a/src/store/store.ts b/src/store/SettngsStore.ts similarity index 100% rename from src/store/store.ts rename to src/store/SettngsStore.ts diff --git a/src/views/EditFormView.ts b/src/views/EditFormView.ts index a62738b..a680235 100644 --- a/src/views/EditFormView.ts +++ b/src/views/EditFormView.ts @@ -1,9 +1,9 @@ -import ModalFormPlugin from "../main"; import { ItemView, type ViewStateResult, WorkspaceLeaf } from "obsidian"; -import type { FormDefinition, EditableFormDefinition } from "../core/formDefinition"; -import FormEditor from './FormBuilder.svelte' +import { settingsStore } from "src/store/SettngsStore"; import { log_notice } from "src/utils/Log"; -import { settingsStore } from "src/store/store"; +import type { EditableFormDefinition, FormDefinition } from "../core/formDefinition"; +import ModalFormPlugin from "../main"; +import FormEditor from './FormBuilder.svelte'; export const EDIT_FORM_VIEW = "modal-form-edit-form-view"; diff --git a/src/views/ManageFormsView.ts b/src/views/ManageFormsView.ts index 42b00e4..9071c42 100644 --- a/src/views/ManageFormsView.ts +++ b/src/views/ManageFormsView.ts @@ -1,6 +1,10 @@ import { ItemView, Notice, WorkspaceLeaf } from "obsidian"; import { FormDefinition } from "src/core/formDefinition"; -import { formsStore, invalidFormsStore, settingsStore } from "src/store/store"; +import { + formsStore, + invalidFormsStore, + settingsStore, +} from "src/store/SettngsStore"; import ModalFormPlugin from "../main"; import ManageForms from "./ManageForms.svelte"; @@ -10,60 +14,58 @@ export const MANAGE_FORMS_VIEW = "modal-form-manage-forms-view"; * Manage existing forms and create new ones */ export class ManageFormsView extends ItemView { - component!: ManageForms; - constructor( - readonly leaf: WorkspaceLeaf, - readonly plugin: ModalFormPlugin, - ) { - super(leaf); - this.icon = "documents"; - } + component!: ManageForms; + constructor(readonly leaf: WorkspaceLeaf, readonly plugin: ModalFormPlugin) { + super(leaf); + this.icon = "documents"; + } - getViewType() { - return MANAGE_FORMS_VIEW; - } + getViewType() { + return MANAGE_FORMS_VIEW; + } - getDisplayText() { - return "Manage forms"; - } + getDisplayText() { + return "Manage forms"; + } - async onOpen() { - // console.log('On open manage forms'); - const container = this.containerEl.children[1] || this.containerEl.createDiv(); - container.empty(); + async onOpen() { + // console.log('On open manage forms'); + const container = + this.containerEl.children[1] || this.containerEl.createDiv(); + container.empty(); - this.component = new ManageForms({ - target: container, - props: { - forms: formsStore, - invalidForms: invalidFormsStore, - createNewForm: () => { - this.plugin.createNewForm(); - }, - editForm: (formName: string) => { - this.plugin.editForm(formName); - }, - deleteForm: (formName: string) => { - settingsStore.removeForm(formName); - }, - duplicateForm: (formName: string) => { - settingsStore.duplicateForm(formName); - }, - copyFormToClipboard: async (form: FormDefinition) => { - await navigator.clipboard.writeText(JSON.stringify(form, null, 2)); - new Notice("Form has been copied to the clipboard"); - }, - openImportFormModal: () => { - this.plugin.openImportFormModal(); - }, - openInTemplateBuilder: (formDefinition: FormDefinition) => { - this.plugin.openTemplateBuilder({ formDefinition }); - }, - }, - }); - } + this.component = new ManageForms({ + target: container, + props: { + forms: formsStore, + invalidForms: invalidFormsStore, + createNewForm: () => { + this.plugin.createNewForm(); + }, + editForm: (formName: string) => { + this.plugin.editForm(formName); + }, + deleteForm: (formName: string) => { + settingsStore.removeForm(formName); + }, + duplicateForm: (formName: string) => { + settingsStore.duplicateForm(formName); + }, + copyFormToClipboard: async (form: FormDefinition) => { + await navigator.clipboard.writeText(JSON.stringify(form, null, 2)); + new Notice("Form has been copied to the clipboard"); + }, + openImportFormModal: () => { + this.plugin.openImportFormModal(); + }, + openInTemplateBuilder: (formDefinition: FormDefinition) => { + this.plugin.openTemplateBuilder({ formDefinition }); + }, + }, + }); + } - async onClose() { - this.component.$destroy(); - } + async onClose() { + this.component.$destroy(); + } }