-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
#895 Adding an image to an empty rich text editor doesn't trigger the Image widget #926
Conversation
Deploy preview ready! Built with commit 745c4e2 |
Deploy preview ready! Built with commit 745c4e2 |
@@ -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) => <img src={getAsset(data.image || '')} alt={data.alt || ''} />, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@@ -7,9 +7,9 @@ const image = { | |||
image: match[2], | |||
alt: match[1], | |||
}, | |||
toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
df63859
to
745c4e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dammmien thanks for this! Quick review of my changes:
- the dot operator captures everything except line breaks, but
\S\s
captures everything plus line breaks. Since line breaks aren't needed in alt text or the url, I've switched to the dot operator. - Implemented the fix pointed out by @tech4him1, where the
OR
operator was meant to be outside of thegetAsset
call args.
Fixes #895 : Adding an image to an empty rich text editor doesn't trigger the Image widget.
- Summary
Input will be filled with
undefined
label ( the youtube widget has this behavior ).- Test plan
Add an image to an empty rich text editor
- Description for the changelog
Input will be filled with
undefined
label ( the youtube widget has this behavior ).