Fix empty image fields saving null or undefined.
This commit is contained in:
parent
0515a70c03
commit
5271e0f7e7
@ -29,15 +29,15 @@ if (module.hot) {
|
||||
module.hot.accept('./root', () => { render(Root); });
|
||||
}
|
||||
|
||||
const buildtInPlugins = [{
|
||||
const builtInPlugins = [{
|
||||
label: 'Image',
|
||||
id: 'image',
|
||||
fromBlock: match => match && {
|
||||
image: match[2],
|
||||
alt: match[1],
|
||||
},
|
||||
toBlock: data => ``,
|
||||
toPreview: (data, getAsset) => <img src={getAsset(data.image)} alt={data.alt} />,
|
||||
toBlock: data => ``,
|
||||
toPreview: (data, getAsset) => <img src={getAsset(data.image) || ""} alt={data.alt || ""} />,
|
||||
pattern: /^!\[([^\]]+)]\(([^)]+)\)$/,
|
||||
fields: [{
|
||||
label: 'Image',
|
||||
@ -48,7 +48,7 @@ const buildtInPlugins = [{
|
||||
name: 'alt',
|
||||
}],
|
||||
}];
|
||||
buildtInPlugins.forEach(plugin => registry.registerEditorComponent(plugin));
|
||||
builtInPlugins.forEach(plugin => registry.registerEditorComponent(plugin));
|
||||
|
||||
const CMS = {};
|
||||
for (const method in registry) { // eslint-disable-line
|
||||
|
Loading…
x
Reference in New Issue
Block a user