diff --git a/frontend/app/components/Domain/Recipe/RecipeDialogBulkAdd.vue b/frontend/app/components/Domain/Recipe/RecipeDialogBulkAdd.vue index 64d6b00e6..07ad0137b 100644 --- a/frontend/app/components/Domain/Recipe/RecipeDialogBulkAdd.vue +++ b/frontend/app/components/Domain/Recipe/RecipeDialogBulkAdd.vue @@ -9,6 +9,7 @@ :title="$t('new-recipe.bulk-add')" :icon="$globals.icons.createAlt" :submit-text="$t('general.add')" + :submit-disabled="!canSave" :disable-submit-on-enter="true" can-submit @submit="save" @@ -74,9 +75,11 @@ const dialog = ref(false); const inputText = ref(props.inputTextProp); function splitText() { - return inputText.value.split("\n").filter(line => !(line === "\n" || !line)); + return inputText.value.split("\n").filter(line => line.trim().length > 0); } +const canSave = computed(() => splitText().length > 0); + function removeFirstCharacter() { inputText.value = splitText() .map(line => line.substring(1)) @@ -106,6 +109,10 @@ function trimAllLines() { } function save() { + if (!canSave.value) { + return; + } + emit("bulk-data", splitText()); dialog.value = false; } diff --git a/frontend/app/pages/g/[groupSlug]/r/create/bulk.vue b/frontend/app/pages/g/[groupSlug]/r/create/bulk.vue index 915b7a2c7..57ddd7c30 100644 --- a/frontend/app/pages/g/[groupSlug]/r/create/bulk.vue +++ b/frontend/app/pages/g/[groupSlug]/r/create/bulk.vue @@ -223,6 +223,10 @@ async function deleteReport(id: string) { fetchReports(); function assignUrls(urls: string[]) { + if (urls.length === 0) { + return; + } + bulkUrls.value = urls.map(url => ({ url, categories: [], tags: [] })); }