mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-30 17:53:31 -04:00 
			
		
		
		
	fix: JSON Editor Breaks On Invalid JSON (#5814)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
		| @@ -81,7 +81,7 @@ | |||||||
|       </v-card> |       </v-card> | ||||||
|       <WakelockSwitch /> |       <WakelockSwitch /> | ||||||
|       <RecipePageComments |       <RecipePageComments | ||||||
|         v-if="!recipe.settings.disableComments && !isEditForm && !isCookMode" |         v-if="!recipe.settings?.disableComments && !isEditForm && !isCookMode" | ||||||
|         v-model="recipe" |         v-model="recipe" | ||||||
|         class="px-1 my-4 d-print-none" |         class="px-1 my-4 d-print-none" | ||||||
|       /> |       /> | ||||||
| @@ -278,7 +278,7 @@ async function deleteRecipe() { | |||||||
|  * View Preferences |  * View Preferences | ||||||
|  */ |  */ | ||||||
| const landscape = computed(() => { | const landscape = computed(() => { | ||||||
|   const preferLandscape = recipe.value.settings.landscapeView; |   const preferLandscape = recipe.value.settings?.landscapeView; | ||||||
|   const smallScreen = !$vuetify.display.smAndUp.value; |   const smallScreen = !$vuetify.display.smAndUp.value; | ||||||
|  |  | ||||||
|   if (preferLandscape) { |   if (preferLandscape) { | ||||||
|   | |||||||
| @@ -26,10 +26,10 @@ export default defineComponent({ | |||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   emits: ["update:modelValue"], |   emits: ["update:modelValue"], | ||||||
|   setup(_, { emit }) { |   setup(props, { emit }) { | ||||||
|     function parseEvent(event: any): object { |     function parseEvent(event: any): object { | ||||||
|       if (!event) { |       if (!event) { | ||||||
|         return {}; |         return props.modelValue || {}; | ||||||
|       } |       } | ||||||
|       try { |       try { | ||||||
|         if (event.json) { |         if (event.json) { | ||||||
| @@ -43,11 +43,14 @@ export default defineComponent({ | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       catch { |       catch { | ||||||
|         return {}; |         return props.modelValue || {}; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     function onChange(event: any) { |     function onChange(event: any) { | ||||||
|       emit("update:modelValue", parseEvent(event)); |       const parsed = parseEvent(event); | ||||||
|  |       if (parsed !== props.modelValue) { | ||||||
|  |         emit("update:modelValue", parsed); | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|     return { |     return { | ||||||
|       onChange, |       onChange, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user