@@ -11,6 +11,7 @@ export interface EmbeddedContentAttributeProps {
1111 placeholder : string | undefined ;
1212 /** Optional function that allows component to modify supplied user input before saving */
1313 onLinkUpdated ?: LinkUpdatedCallback ;
14+ aspectRatio ?: number ;
1415}
1516
1617/**
@@ -26,14 +27,15 @@ export const EmbeddedContentAttribute = ({
2627 product,
2728 placeholder,
2829 onLinkUpdated = ( v ) => v ,
30+ aspectRatio = 4 / 3 ,
2931} : EmbeddedContentAttributeProps ) => {
30- const fieldName = `${ product . replace ( / \s + / g, "" ) } :link` ;
32+ const fieldName = `${ product . replace ( / \s + / g, '' ) } :link`
3133 const src = fields [ fieldName ] as string ;
3234
3335 const openLink = ( ) => {
3436 const sanitized = aha . sanitizeUrl ( src ) ;
35- window . open ( sanitized , " _blank" , " noopener,noreferrer" ) ;
36- } ;
37+ window . open ( sanitized , ' _blank' , ' noopener,noreferrer' ) ;
38+ }
3739
3840 const setLink = ( e : React . ChangeEvent < HTMLInputElement > ) => {
3941 let value = e . target . value ;
@@ -63,16 +65,19 @@ export const EmbeddedContentAttribute = ({
6365
6466 return (
6567 < div
66- style = { { display : " grid" , gridTemplateColumns : " 1fr auto" , gridGap : 10 } }
68+ style = { { display : ' grid' , alignItems : 'start' , gridTemplateColumns : ' 1fr auto' , gridGap : 10 } }
6769 >
68- < EmbeddedContent src = { src } />
70+ < EmbeddedContent src = { src } aspectRatio = { aspectRatio } />
6971 < aha-menu >
7072 < aha-button slot = "button" type = "attribute" size = "small" >
7173 < aha-icon icon = "fa-solid fa-ellipsis" > </ aha-icon >
7274 </ aha-button >
7375 < aha-menu-item onClick = { openLink } > View in { product } </ aha-menu-item >
74- < aha-menu-item onClick = { removeLink } > Remove</ aha-menu-item >
76+ < hr />
77+ < aha-menu-item onClick = { removeLink } >
78+ < span className = "text-error" > Remove</ span >
79+ </ aha-menu-item >
7580 </ aha-menu >
7681 </ div >
77- ) ;
82+ )
7883} ;
0 commit comments