feat(editor-components): support title in image component (#1862)

This commit is contained in:
Zach Vinless
2018-12-11 08:23:07 -08:00
committed by Shawn Erquhart
parent 13b126ef6b
commit cbb7762883
3 changed files with 85 additions and 5 deletions

View File

@ -15,8 +15,8 @@ export default function remarkImagesToText() {
child.children.length === 1 &&
child.children[0].type === 'image'
) {
const { alt, url } = child.children[0];
const value = `![${alt || ''}](${url || ''})`;
const { alt, url, title } = child.children[0];
const value = `![${alt || ''}](${url || ''}${title ? ` "${title}"` : ''})`;
child.children = [{ type: 'text', value }];
}
return child;