From 53f10b3a2451efd347855e486f46aa64eaaeeec3 Mon Sep 17 00:00:00 2001 From: Danielo Rodriguez Date: Fri, 15 Sep 2023 17:06:07 +0200 Subject: [PATCH] fix: make sure the editor always has the right height fixes #38 --- .github/workflows/sync-version.yml | 2 +- src/views/EditFormView.ts | 7 ++++--- src/views/FormBuilder.svelte | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sync-version.yml b/.github/workflows/sync-version.yml index f865c5e5..c4152adc 100644 --- a/.github/workflows/sync-version.yml +++ b/.github/workflows/sync-version.yml @@ -13,7 +13,7 @@ permissions: jobs: sync-versions: - # if: "${{ github.event.label.name == 'autorelease: pending' }}" + # if: "${{ contains(github.event.pull_request.labels.*.name, 'autorelease: pending') }}" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/src/views/EditFormView.ts b/src/views/EditFormView.ts index 6f6522dc..35bac3f0 100644 --- a/src/views/EditFormView.ts +++ b/src/views/EditFormView.ts @@ -1,11 +1,11 @@ import ModalFormPlugin from "main"; import { ItemView, type ViewStateResult, WorkspaceLeaf } from "obsidian"; -import type { FormDefinition, AllFieldTypes } from "../core/formDefinition"; +import type { FormDefinition, EditableFormDefinition } from "../core/formDefinition"; import FormEditor from './FormBuilder.svelte' export const EDIT_FORM_VIEW = "modal-form-edit-form-view"; -function parseState(maybeState: unknown): maybeState is FormDefinition { +function parseState(maybeState: unknown): maybeState is EditableFormDefinition { if (maybeState === null) { return false } @@ -24,7 +24,7 @@ function parseState(maybeState: unknown): maybeState is FormDefinition { * Simple, right? */ export class EditFormView extends ItemView { - formState: FormDefinition = { title: '', name: '', fields: [] }; + formState: EditableFormDefinition = { title: '', name: '', fields: [] }; formEditor!: FormEditor; constructor(readonly leaf: WorkspaceLeaf, readonly plugin: ModalFormPlugin) { super(leaf); @@ -40,6 +40,7 @@ export class EditFormView extends ItemView { } async onOpen() { + this.containerEl.empty() this.formEditor = new FormEditor({ target: this.containerEl, props: { diff --git a/src/views/FormBuilder.svelte b/src/views/FormBuilder.svelte index 6ef989c2..e9783805 100644 --- a/src/views/FormBuilder.svelte +++ b/src/views/FormBuilder.svelte @@ -368,6 +368,7 @@ .wrapper, form { max-height: 100%; + min-height: 100%; height: 100%; display: flex; flex-direction: column; @@ -396,9 +397,6 @@ border: none; padding: 0; } - .p-2 { - padding: 0.5rem; - } .hint { color: var(--color-base-70); }