2018-12-02 01:48:53 +00:00
## Image
```js
let caption = null;
< div style = {{ position: ' relative ' , width: ' 100 % ' , height: 500 } } >
< CaptionEditor
url={util.gifObjectUrl}
attachment={{
contentType: 'image/jpeg',
}}
2019-01-15 17:33:23 +00:00
onSave={caption => console.log('onSave', caption)}
close={() => console.log('close')}
2018-12-02 01:48:53 +00:00
i18n={util.i18n}
/>
< / div > ;
```
## Image with caption
```js
let caption =
"This is the user-provided caption. We show it overlaid on the image. If it's really long, then it wraps, but it doesn't get too close to the edges of the image.";
< div style = {{ position: ' relative ' , width: ' 100 % ' , height: 500 } } >
< CaptionEditor
url="https://placekitten.com/800/600"
attachment={{
contentType: 'image/jpeg',
}}
caption={caption}
contentType="image/jpeg"
2019-01-15 17:33:23 +00:00
onSave={caption => console.log('onSave', caption)}
close={() => console.log('close')}
2018-12-02 01:48:53 +00:00
i18n={util.i18n}
/>
< / div > ;
```
## Video
```js
let caption = null;
< div style = {{ position: ' relative ' , width: ' 100 % ' , height: 500 } } >
< CaptionEditor
url="fixtures/pixabay-Soap-Bubble-7141.mp4"
attachment={{
contentType: 'video/mp4',
}}
2019-01-15 17:33:23 +00:00
onSave={caption => console.log('onSave', caption)}
close={() => console.log('close')}
2018-12-02 01:48:53 +00:00
i18n={util.i18n}
/>
< / div > ;
```
## Video with caption
```js
let caption =
"This is the user-provided caption. We show it overlaid on the image. If it's really long, then it wraps, but it doesn't get too close to the edges of the image.";
< div style = {{ position: ' relative ' , width: ' 100 % ' , height: 500 } } >
< CaptionEditor
url="fixtures/pixabay-Soap-Bubble-7141.mp4"
attachment={{
contentType: 'video/mp4',
}}
caption={caption}
2019-01-15 17:33:23 +00:00
onSave={caption => console.log('onSave', caption)}
close={() => console.log('close')}
2018-12-02 01:48:53 +00:00
i18n={util.i18n}
/>
< / div > ;
```