diff --git a/src/views/FormBuilder.svelte b/src/views/FormBuilder.svelte index 6215b4c2..480f91e2 100644 --- a/src/views/FormBuilder.svelte +++ b/src/views/FormBuilder.svelte @@ -7,7 +7,7 @@ validateFields, } from "src/core/formDefinition"; import { FolderSuggest } from "src/suggesters/suggestFolder"; - import { setIcon, Setting, App, Notice } from "obsidian"; + import { setIcon, Setting, App } from "obsidian"; import FormRow from "./components/FormRow.svelte"; import InputBuilderDataview from "./components/inputBuilderDataview.svelte"; import InputBuilderSelect from "./components/InputBuilderSelect.svelte"; @@ -90,11 +90,6 @@ if (!isValidFormDefinition(definition)) return; onPreview(definition); }; - const handleExport = () => { - if (!isValidFormDefinition(definition)) return; - navigator.clipboard.writeText(JSON.stringify(definition)); - new Notice("Form has been copied to the clipboard"); - }; {#if errors.length > 0}

diff --git a/src/views/ManageFormsView.ts b/src/views/ManageFormsView.ts index bcb0af70..68e29828 100644 --- a/src/views/ManageFormsView.ts +++ b/src/views/ManageFormsView.ts @@ -1,5 +1,5 @@ import ModalFormPlugin from "../main"; -import { ItemView, Setting, WorkspaceLeaf } from "obsidian"; +import { ItemView, Notice, Setting, WorkspaceLeaf } from "obsidian"; export const MANAGE_FORMS_VIEW = "modal-form-manage-forms-view"; @@ -78,6 +78,13 @@ export class ManageFormsView extends ItemView { this.plugin.duplicateForm(form); }) }) + .addButton(button => { + button.setIcon('clipboard-copy') + button.onClick(() => { + navigator.clipboard.writeText(JSON.stringify(form, null, 2)); + new Notice("Form has been copied to the clipboard"); + }); + }) ; }) }