File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
app/components/widgets/forms Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { socialMediaExtraPrefixes } from 'open-event-frontend/utils/dictionary/s
6
6
interface Args {
7
7
prefix : string | undefined ,
8
8
value : string | undefined ,
9
- onChange : ( text : string ) => void
9
+ onChange : ( text : string | null ) => void
10
10
}
11
11
12
12
export default class LinkField extends Component < Args > {
@@ -35,7 +35,8 @@ export default class LinkField extends Component<Args> {
35
35
/**
36
36
* Final value with prefix to be sent to parent component
37
37
*/
38
- get finalValue ( ) : string {
38
+ get finalValue ( ) : string | null {
39
+ if ( ! this . fixedValue && this . prefix === 'https://' ) { return null ; }
39
40
return this . prefix + this . fixedValue ;
40
41
}
41
42
@@ -63,7 +64,8 @@ export default class LinkField extends Component<Args> {
63
64
setValue ( event : { target : HTMLInputElement } ) : void {
64
65
const text = event . target . value ;
65
66
this . value = this . fixValue ( text ) ;
66
- this . args . onChange ( this . finalValue ) ;
67
+ const finalUrl = this . value ? this . finalValue : null ;
68
+ this . args . onChange ( finalUrl ) ;
67
69
}
68
70
69
71
@action
You can’t perform that action at this time.
0 commit comments