@@ -11,7 +11,8 @@ import {
11
11
useContentElementConfigurationUpdate ,
12
12
useContentElementEditorState ,
13
13
useI18n ,
14
- utils
14
+ utils ,
15
+ LinkButton
15
16
} from 'pageflow-scrolled/frontend' ;
16
17
17
18
import { Thumbnail } from './Thumbnail' ;
@@ -89,21 +90,21 @@ export function ExternalLink({id, configuration, ...props}) {
89
90
return (
90
91
< li className = { classNames ( styles . item ,
91
92
styles [ `textPosition-${ props . textPosition } ` ] ,
92
- { [ styles . link ] : ! ! href } ,
93
+ { [ styles . link ] : ! ! href && ! configuration . displayButtons } ,
93
94
{ [ styles . outlined ] : props . outlined } ,
94
95
{ [ styles . highlighted ] : props . highlighted } ,
95
96
{ [ styles . selected ] : props . selected } ) }
96
97
onClick = { props . onClick } >
97
- < Link isEditable = { isEditable }
98
+ < Link isEnabled = { ! configuration . displayButtons }
99
+ isEditable = { isEditable }
98
100
actionButtonVisible = { props . selected }
99
101
href = { href }
100
102
openInNewTab = { openInNewTab }
101
103
onChange = { handleLinkChange } >
102
104
< div className = { classNames (
103
105
styles . card ,
104
- styles [ `thumbnailSize-${ props . thumbnailSize } ` ] ,
105
- { [ styles . invert ] : props . invert
106
- } ) } >
106
+ styles [ `thumbnailSize-${ props . thumbnailSize } ` ]
107
+ ) } >
107
108
< div className = { styles . thumbnail } >
108
109
< Thumbnail imageFile = { thumbnailImageFile }
109
110
aspectRatio = { props . thumbnailAspectRatio }
@@ -112,7 +113,8 @@ export function ExternalLink({id, configuration, ...props}) {
112
113
< InlineFileRights context = "insideElement" items = { [ { file : thumbnailImageFile , label : 'image' } ] } />
113
114
</ Thumbnail >
114
115
</ div >
115
- < div className = { styles . background }
116
+ < div className = { classNames ( styles . background ,
117
+ props . darkBackground ? styles . light : styles . dark ) }
116
118
style = { { pointerEvents : ! isEditable || isSelected ? undefined : 'none' } } >
117
119
< InlineFileRights context = "afterElement" items = { [ { file : thumbnailImageFile , label : 'image' } ] } />
118
120
< div className = { styles . details } >
@@ -134,6 +136,14 @@ export function ExternalLink({id, configuration, ...props}) {
134
136
placeholder = { t ( 'pageflow_scrolled.inline_editing.type_text' ) }
135
137
onChange = { value => handleTextChange ( 'description' , value ) } />
136
138
</ 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 ) } /> }
137
147
</ div >
138
148
</ div >
139
149
</ div >
@@ -142,8 +152,8 @@ export function ExternalLink({id, configuration, ...props}) {
142
152
) ;
143
153
}
144
154
145
- function Link ( props ) {
146
- if ( props . href || props . isEditable ) {
155
+ function Link ( { isEnabled , isEditable , ... props } ) {
156
+ if ( ( isEnabled && props . href ) || isEditable ) {
147
157
return (
148
158
< EditableLink { ...props }
149
159
actionButtonVisible = { props . actionButtonVisible }
0 commit comments