File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed
src/block-components/image Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ const Controls = props => {
137137 imageWidthAttribute : width ,
138138 imageHeightAttribute : height ,
139139 imageExternalUrl : '' ,
140- ...( attributes . imageAlt ? { } : { imageAlt : image . alt || '' } ) , // Only set the alt if it's empty.
140+ ...( image . alt ? { imageAlt : image . alt || '' } : { } ) , // Only overwrite current alt if new alt is not empty.
141141 } )
142142 } }
143143 />
Original file line number Diff line number Diff line change 11/**
22 * WordPress Dependencies
33 */
4- import { useBlockAttributesContext , useBlockSetAttributesContext } from '~stackable/hooks'
4+ import { useBlockSetAttributesContext } from '~stackable/hooks'
55
66export const useImage = ( ) => {
77 const setAttributes = useBlockSetAttributesContext ( )
8- const attributes = useBlockAttributesContext ( attributes => ( {
9- imageAlt : attributes . imageAlt ,
10- } ) )
118
129 const onChange = image => {
1310 setAttributes ( {
@@ -16,7 +13,7 @@ export const useImage = () => {
1613 imageHeightAttribute : image . height ,
1714 imageWidthAttribute : image . width ,
1815 imageExternalUrl : '' ,
19- ...( attributes . imageAlt ? { } : { imageAlt : image . alt || '' } ) , // Only add the image alt if it's empty.
16+ ...( image . alt ? { imageAlt : image . alt || '' } : { } ) , // Only overwrite current alt if new alt is not empty.
2017 } )
2118 }
2219
You can’t perform that action at this time.
0 commit comments