fix(editor-component-image): fix null on empty markdown image alt (#1778)
This commit is contained in:
parent
87768ee2c8
commit
9b72419096
@ -71,7 +71,8 @@ exports[`Markdown Preview renderer Markdown rendering General should render mark
|
||||
<p><a href=\\"http://google.com\\">link title</a></p>
|
||||
<h5>H5</h5>
|
||||
<p></p>
|
||||
<h6>H6</h6>",
|
||||
<h6>H6</h6>
|
||||
<p></p>",
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
@ -33,6 +33,8 @@ Text with **bold** & _em_ elements
|
||||

|
||||
|
||||
###### H6
|
||||
|
||||

|
||||
`;
|
||||
expect(
|
||||
renderer.create(<MarkdownPreview value={markdownToHtml(value)} />).toJSON(),
|
||||
|
@ -15,8 +15,8 @@ export default function remarkImagesToText() {
|
||||
child.children.length === 1 &&
|
||||
child.children[0].type === 'image'
|
||||
) {
|
||||
const { alt = '', url = '', title = '' } = child.children[0];
|
||||
const value = ``;
|
||||
const { alt, url } = child.children[0];
|
||||
const value = ``;
|
||||
child.children = [{ type: 'text', value }];
|
||||
}
|
||||
return child;
|
||||
|
Loading…
x
Reference in New Issue
Block a user