mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
fix: recipe ingredient editor bugs (#1251)
* filter unallowed fields #1140 * fix type and layout * propery validate none type quantites * fix rendering error #1237
This commit is contained in:
parent
d06d4d2fd9
commit
cd0da36e7c
5 changed files with 47 additions and 22 deletions
|
@ -20,6 +20,7 @@
|
|||
class="mx-1"
|
||||
type="number"
|
||||
placeholder="Quantity"
|
||||
@keypress="quantityFilter"
|
||||
>
|
||||
<v-icon v-if="$listeners && $listeners.delete" slot="prepend" class="mr-n1 handle">
|
||||
{{ $globals.icons.arrowUpDown }}
|
||||
|
@ -166,7 +167,7 @@ export default defineComponent({
|
|||
if (state.showTitle) {
|
||||
value.title = "";
|
||||
}
|
||||
state.showTitle = !state.showTitle
|
||||
state.showTitle = !state.showTitle;
|
||||
}
|
||||
|
||||
function toggleOriginalText() {
|
||||
|
@ -211,7 +212,15 @@ export default defineComponent({
|
|||
return options;
|
||||
});
|
||||
|
||||
function quantityFilter(e: KeyboardEvent) {
|
||||
// if digit is pressed, add to quantity
|
||||
if (e.key === "-" || e.key === "+" || e.key === "e") {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
quantityFilter,
|
||||
toggleOriginalText,
|
||||
contextMenuOptions,
|
||||
handleUnitEnter,
|
||||
|
|
|
@ -10,11 +10,8 @@
|
|||
<v-divider v-if="showTitleEditor[index]"></v-divider>
|
||||
<v-list-item dense @click="toggleChecked(index)">
|
||||
<v-checkbox hide-details :value="checked[index]" class="pt-0 my-auto py-auto" color="secondary" />
|
||||
<v-list-item-content>
|
||||
<VueMarkdown
|
||||
class="ma-0 pa-0 text-subtitle-1 dense-markdown"
|
||||
:source="parseIngredientText(ingredient, disableAmount, scale)"
|
||||
/>
|
||||
<v-list-item-content :key="ingredient.quantity">
|
||||
<VueMarkdown class="ma-0 pa-0 text-subtitle-1 dense-markdown" :source="ingredientDisplay[index]" />
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
</div>
|
||||
|
@ -58,11 +55,7 @@ export default defineComponent({
|
|||
});
|
||||
|
||||
const ingredientCopyText = computed(() => {
|
||||
return props.value
|
||||
.map((ingredient) => {
|
||||
return `- [ ] ${parseIngredientText(ingredient, props.disableAmount, props.scale)}`;
|
||||
})
|
||||
.join("\n");
|
||||
return ingredientDisplay.value.join("\n");
|
||||
});
|
||||
|
||||
function toggleChecked(index: number) {
|
||||
|
@ -71,7 +64,14 @@ export default defineComponent({
|
|||
state.checked.splice(index, 1, !state.checked[index]);
|
||||
}
|
||||
|
||||
const ingredientDisplay = computed(() => {
|
||||
return props.value.map((ingredient) => {
|
||||
return `${parseIngredientText(ingredient, props.disableAmount, props.scale)}`;
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
ingredientDisplay,
|
||||
...toRefs(state),
|
||||
parseIngredientText,
|
||||
ingredientCopyText,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue