1 import { Placeholder
, TextControl
} from '@wordpress/components';
2 import { __experimentalNumberControl as NumberControl
} from '@wordpress/components';
3 import { __
} from '@wordpress/i18n';
4 import MD5
from 'crypto-js/md5';
6 export default function Edit( {
13 if ( attributes
.size
) {
14 var sizes
= attributes
.size
;
18 if ( attributes
.email
) {
19 var mail
= attributes
.email
;
20 var addr
= mail
.toLowerCase().trim();
21 var hash
= MD5( addr
).toString();
22 var url
= '//www.gravatar.com/avatar/' + hash
+ '?s=' + sizes
;
24 var height
= sizes
+ 40;
26 <div className
={ className
}>
27 { attributes
.email
&& ! isSelected
? (
29 className
={ className
}
30 style
={ { width
: sizes
+ 'px', height
: height
+ 'px' } }
38 <figcaption
>{ attributes
.caption
}</figcaption
>
42 label
={ __( 'Gravatar', 'dnxvatar' ) }
44 'Insert at least the email address',
49 placeholder
={ 'danix@example.com' }
50 label
={ __( 'Email', 'dnxvatar' ) }
51 value
={ attributes
.email
}
52 onChange
={ ( val
) => setAttributes( { email
: val
} ) }
55 placeholder
={ 'my profile photo' }
56 label
={ __( 'Alt text', 'dnxvatar' ) }
57 value
={ attributes
.alt
}
58 onChange
={ ( val
) => setAttributes( { alt
: val
} ) }
61 placeholder
={ 'this is me...' }
62 label
={ __( 'Caption', 'dnxvatar' ) }
63 value
={ attributes
.caption
}
65 setAttributes( { caption
: val
} )
70 label
={ __( 'Size', 'dnxvatar' ) }
71 isShiftStepEnabled
={ true }
72 labelPosition
={ 'top' }
73 onChange
={ ( val
) => setAttributes( { size
: val
} ) }