diff --git a/src/index.js b/src/index.js index f517d586a021..e78426500e62 100644 --- a/src/index.js +++ b/src/index.js @@ -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 => `![${ data.alt }](${ data.image })`, - toPreview: (data, getAsset) => {data.alt}, + toBlock: data => `![${ data.alt || "" }](${ data.image || "" })`, + toPreview: (data, getAsset) => {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