@@ -11,7 +11,8 @@ import {
1111 useContentElementConfigurationUpdate ,
1212 useContentElementEditorState ,
1313 useI18n ,
14- utils
14+ utils ,
15+ LinkButton
1516} from 'pageflow-scrolled/frontend' ;
1617
1718import { Thumbnail } from './Thumbnail' ;
@@ -89,21 +90,21 @@ export function ExternalLink({id, configuration, ...props}) {
8990 return (
9091 < li className = { classNames ( styles . item ,
9192 styles [ `textPosition-${ props . textPosition } ` ] ,
92- { [ styles . link ] : ! ! href } ,
93+ { [ styles . link ] : ! ! href && ! configuration . displayButtons } ,
9394 { [ styles . outlined ] : props . outlined } ,
9495 { [ styles . highlighted ] : props . highlighted } ,
9596 { [ styles . selected ] : props . selected } ) }
9697 onClick = { props . onClick } >
97- < Link isEditable = { isEditable }
98+ < Link isEnabled = { ! configuration . displayButtons }
99+ isEditable = { isEditable }
98100 actionButtonVisible = { props . selected }
99101 href = { href }
100102 openInNewTab = { openInNewTab }
101103 onChange = { handleLinkChange } >
102104 < div className = { classNames (
103105 styles . card ,
104- styles [ `thumbnailSize-${ props . thumbnailSize } ` ] ,
105- { [ styles . invert ] : props . invert
106- } ) } >
106+ styles [ `thumbnailSize-${ props . thumbnailSize } ` ]
107+ ) } >
107108 < div className = { styles . thumbnail } >
108109 < Thumbnail imageFile = { thumbnailImageFile }
109110 aspectRatio = { props . thumbnailAspectRatio }
@@ -112,7 +113,8 @@ export function ExternalLink({id, configuration, ...props}) {
112113 < InlineFileRights context = "insideElement" items = { [ { file : thumbnailImageFile , label : 'image' } ] } />
113114 </ Thumbnail >
114115 </ div >
115- < div className = { styles . background }
116+ < div className = { classNames ( styles . background ,
117+ props . darkBackground ? styles . light : styles . dark ) }
116118 style = { { pointerEvents : ! isEditable || isSelected ? undefined : 'none' } } >
117119 < InlineFileRights context = "afterElement" items = { [ { file : thumbnailImageFile , label : 'image' } ] } />
118120 < div className = { styles . details } >
@@ -134,6 +136,14 @@ export function ExternalLink({id, configuration, ...props}) {
134136 placeholder = { t ( 'pageflow_scrolled.inline_editing.type_text' ) }
135137 onChange = { value => handleTextChange ( 'description' , value ) } />
136138 </ div > }
139+ { configuration . displayButtons && presentOrEditing ( 'link' ) &&
140+ < LinkButton href = { href }
141+ openInNewTab = { openInNewTab }
142+ value = { itemTexts [ id ] ?. link }
143+ linkPreviewDisabled = { true }
144+ actionButtonVisible = { false }
145+ onTextChange = { value => handleTextChange ( 'link' , value ) }
146+ onLinkChange = { value => handleLinkChange ( value ) } /> }
137147 </ div >
138148 </ div >
139149 </ div >
@@ -142,8 +152,8 @@ export function ExternalLink({id, configuration, ...props}) {
142152 ) ;
143153}
144154
145- function Link ( props ) {
146- if ( props . href || props . isEditable ) {
155+ function Link ( { isEnabled , isEditable , ... props } ) {
156+ if ( ( isEnabled && props . href ) || isEditable ) {
147157 return (
148158 < EditableLink { ...props }
149159 actionButtonVisible = { props . actionButtonVisible }
0 commit comments