Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#895 Adding an image to an empty rich text editor doesn't trigger the Image widget #926

Merged
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/MarkdownPlugins/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const image = {
image: match[2],
alt: match[1],
},
toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dammmien I'm just wondering why we want it to be undefined instead of an empty string, since that was just implemented recently. I'm not saying it's wrong, I'd just like a little background on why you can to change it.

Copy link
Contributor

@erquhart erquhart Dec 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think his reasoning lies in comparison to the youtube component:

Input will be filled with undefined label ( the youtube widget has this behavior ).

But yeah I agree, should be empty string. Have a commit going that I'll be pushing soon, should be good to merge after that.

toBlock: data => `![${ data.alt }](${ data.image || '' })`,
toPreview: (data, getAsset) => <img src={getAsset(data.image || '')} alt={data.alt || ''} />,
Copy link
Contributor

@tech4him1 tech4him1 Dec 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erquhart I noticed that you modified this line as well in your 1.0 changes -- I had it as src={getAsset(data.image) || ''}. Is that something that needs reverted/fixed as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tech4him1 good catch, yes, that was unintentional.

pattern: /^!\[([^\]]+)]\(([^)]+)\)$/,
pattern: /^!\[([\S\s]*)\]\(([\S\s]*)\)$/,
fields: [{
label: 'Image',
name: 'image',
Expand Down