From 667f0d36344213450ed21034db480a30b913255b Mon Sep 17 00:00:00 2001 From: Damien Duhamel Date: Fri, 15 Dec 2017 14:19:39 +0100 Subject: [PATCH 1/4] Change regexp + keep alt undefined --- src/components/MarkdownPlugins/image.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MarkdownPlugins/image.js b/src/components/MarkdownPlugins/image.js index 4739b7a601b2..2b231951e460 100644 --- a/src/components/MarkdownPlugins/image.js +++ b/src/components/MarkdownPlugins/image.js @@ -7,9 +7,9 @@ const image = { image: match[2], alt: match[1], }, - toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`, + toBlock: data => `![${ data.alt }](${ data.image || '' })`, toPreview: (data, getAsset) => {data.alt, - pattern: /^!\[([^\]]+)]\(([^)]+)\)$/, + pattern: /^!\[([\S]*)]\(([\S]*)\)/, fields: [{ label: 'Image', name: 'image', From a4eb12898d411afdd4afbcf963d89cae911be7fc Mon Sep 17 00:00:00 2001 From: Damien Duhamel Date: Fri, 15 Dec 2017 14:28:58 +0100 Subject: [PATCH 2/4] Improve reg ex --- src/components/MarkdownPlugins/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MarkdownPlugins/image.js b/src/components/MarkdownPlugins/image.js index 2b231951e460..8e6e38e9cdf9 100644 --- a/src/components/MarkdownPlugins/image.js +++ b/src/components/MarkdownPlugins/image.js @@ -9,7 +9,7 @@ const image = { }, toBlock: data => `![${ data.alt }](${ data.image || '' })`, toPreview: (data, getAsset) => {data.alt, - pattern: /^!\[([\S]*)]\(([\S]*)\)/, + pattern: /^!\[([\S]*)\]\(([\S]*)\)$/, fields: [{ label: 'Image', name: 'image', From 61f2a10e6b49e054d5dcc2731aa11eb116424bed Mon Sep 17 00:00:00 2001 From: Damien Duhamel Date: Fri, 15 Dec 2017 14:34:19 +0100 Subject: [PATCH 3/4] Improve reg ex file with space in the name --- src/components/MarkdownPlugins/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MarkdownPlugins/image.js b/src/components/MarkdownPlugins/image.js index 8e6e38e9cdf9..3611cc4f3aa9 100644 --- a/src/components/MarkdownPlugins/image.js +++ b/src/components/MarkdownPlugins/image.js @@ -9,7 +9,7 @@ const image = { }, toBlock: data => `![${ data.alt }](${ data.image || '' })`, toPreview: (data, getAsset) => {data.alt, - pattern: /^!\[([\S]*)\]\(([\S]*)\)$/, + pattern: /^!\[([\S\s]*)\]\(([\S\s]*)\)$/, fields: [{ label: 'Image', name: 'image', From 745c4e2f773177d10669866f68d67cca4101bbe1 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 21 Dec 2017 14:09:12 -0500 Subject: [PATCH 4/4] update markdown image component config --- src/components/MarkdownPlugins/image.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/MarkdownPlugins/image.js b/src/components/MarkdownPlugins/image.js index 3611cc4f3aa9..55cd37539d52 100644 --- a/src/components/MarkdownPlugins/image.js +++ b/src/components/MarkdownPlugins/image.js @@ -7,9 +7,9 @@ const image = { image: match[2], alt: match[1], }, - toBlock: data => `![${ data.alt }](${ data.image || '' })`, - toPreview: (data, getAsset) => {data.alt, - pattern: /^!\[([\S\s]*)\]\(([\S\s]*)\)$/, + toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`, + toPreview: (data, getAsset) => {data.alt, + pattern: /^!\[(.*)\]\((.*)\)$/, fields: [{ label: 'Image', name: 'image',