From a1f2fea1bc8a1fff392640bb349acd97bbc6a39f Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Mon, 13 Jul 2026 08:54:25 -0300 Subject: [PATCH] Merge the alt-text setter into the save handler --- .../posts/editor/PostEditorComposer.vue | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/resources/js/components/posts/editor/PostEditorComposer.vue b/resources/js/components/posts/editor/PostEditorComposer.vue index 3729b6ea..96ede96b 100644 --- a/resources/js/components/posts/editor/PostEditorComposer.vue +++ b/resources/js/components/posts/editor/PostEditorComposer.vue @@ -219,20 +219,17 @@ const openAltText = (index: number) => { altDialogOpen.value = true; }; -const setAltText = (index: number, alt: string): void => { +const onAltTextSave = (alt: string): void => { + if (altDialogIndex.value === null) return; + const next = [...media.value]; const trimmed = alt.trim(); - next[index] = { - ...next[index], - meta: { ...(next[index].meta ?? {}), alt_text: trimmed || undefined }, + next[altDialogIndex.value] = { + ...next[altDialogIndex.value], + meta: { ...(next[altDialogIndex.value].meta ?? {}), alt_text: trimmed || undefined }, }; media.value = next; }; - -const onAltTextSave = (value: string): void => { - if (altDialogIndex.value === null) return; - setAltText(altDialogIndex.value, value); -};