@@ -13,45 +13,45 @@ const imageClass = css`
13
13
` ;
14
14
15
15
export default {
16
- name : 'Image' ,
17
- default : ( ) => '!IMAGE' ,
18
- view : ( ) : m . Component < ConfigProps > => ( {
19
- view : ( { attrs } ) => [
20
- ! attrs . inEdit ? null : m ( MiniHeader , 'Default' ) ,
21
- attrs . value && attrs . value . length > 0 && attrs . value . startsWith ( 'data:' )
22
- ? m ( Flex , { items : 'center' , justify : 'end' } , [
23
- m ( `img.br2.mr2.w-100.${ imageClass } ` , { src : attrs . value } ) , //
24
- m (
25
- Icon ,
26
- {
27
- icon : 'trash' ,
28
- size : 4 ,
29
- className : '.col-error' ,
30
- onClick : ( ) => {
31
- if ( ! attrs . onChange ) return ;
32
- attrs . onChange ( "" ) ;
33
- } ,
34
- } ,
35
- 'Remove' ,
36
- )
37
- ] )
38
- : m ( ImageUpload , {
39
- height : 50 ,
40
- compact : true ,
41
- className : '.mb3' ,
42
- onUpload : ( name , image ) => {
43
- if ( ! attrs . onChange ) return ;
16
+ name : 'Image' ,
17
+ default : ( ) => '!IMAGE' ,
18
+ view : ( ) : m . Component < ConfigProps > => ( {
19
+ view : ( { attrs } ) => [
20
+ ! attrs . inEdit ? null : m ( MiniHeader , 'Default' ) ,
21
+ attrs . value && attrs . value . length > 0 && attrs . value . startsWith ( 'data:' )
22
+ ? m ( Flex , { items : 'center' , justify : 'end' } , [
23
+ m ( `img.br2.mr2.w-100.${ imageClass } ` , { src : attrs . value } ) , //
24
+ m (
25
+ Icon ,
26
+ {
27
+ icon : 'trash' ,
28
+ size : 4 ,
29
+ className : '.col-error' ,
30
+ onClick : ( ) => {
31
+ if ( ! attrs . onChange ) return ;
32
+ attrs . onChange ( '' ) ;
33
+ } ,
34
+ } ,
35
+ 'Remove' ,
36
+ ) ,
37
+ ] )
38
+ : m ( ImageUpload , {
39
+ height : 50 ,
40
+ compact : true ,
41
+ className : '.mb3' ,
42
+ onUpload : ( name , image ) => {
43
+ if ( ! attrs . onChange ) return ;
44
44
45
- m . request ( {
46
- url : `/api/image-cache` ,
47
- method : 'POST' ,
48
- body : image ,
49
- } ) . then ( ( ) => {
50
- if ( ! attrs . onChange ) return ;
51
- attrs . onChange ( image ) ;
52
- } ) ;
53
- } ,
54
- } ) ,
55
- ] ,
56
- } ) ,
45
+ m . request ( {
46
+ url : `/api/image-cache` ,
47
+ method : 'POST' ,
48
+ body : image ,
49
+ } ) . then ( ( ) => {
50
+ if ( ! attrs . onChange ) return ;
51
+ attrs . onChange ( image ) ;
52
+ } ) ;
53
+ } ,
54
+ } ) ,
55
+ ] ,
56
+ } ) ,
57
57
} as Config ;
0 commit comments