-
Notifications
You must be signed in to change notification settings - Fork 4.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
Framework: split RichText component (part 1) #15212
Conversation
baac748
to
592246e
Compare
8f58d2b
to
c6acc3b
Compare
c6acc3b
to
ecf2816
Compare
d57587b
to
068c5e4
Compare
@hypest Do you foresee any problems with mobile? Who could help check? |
068c5e4
to
2716e5f
Compare
@SergioEstevao has already picked this up from the native mobile side 👍 |
👋 @ellatrix , I wonder, can you expand the PR description to include explanation/mention of the non-obvious changes in the PR? For example, this change from |
b6505d0
to
6c3528f
Compare
__unstableOnEnterFormattedText={ onEnterFormattedText } | ||
__unstableOnExitFormattedText={ onExitFormattedText } | ||
__unstableCanUserUseUnfilteredHTML={ canUserUseUnfilteredHTML } | ||
__unstableOnCreateUndoLevel={ onCreateUndoLevel } |
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.
Seems like a lot of unstable Props :) How do we plan to solve these in the future?
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.
Yes! :) But I don't want to rewrite it all at once so I temporarily marked them unstable.
<FormatToolbar /> | ||
</IsolatedEventContainer> | ||
) } | ||
{ isSelected && <RemoveBrowserShortcuts /> } |
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.
Why aren't these absorb by the underlying component (toolbars and RemoveBrowserShortcuts)?
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.
It's block editor specific?
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'm not sure what RemoveBrowserShortcuts is but don't we want the format toolbar support by default in the RichText component?
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.
It has toolbar support, but not a specific toolbar. This is the toolbar implementation for RichText instances in blocks. When using RichText (without the context), you could create your own custom toolbars.
format: 'string', | ||
value: '', | ||
}; | ||
|
||
const RichTextContainer = compose( [ | ||
withInstanceId, | ||
withBlockEditContext( ( { clientId } ) => ( { clientId } ) ), |
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.
Minor: The withSelect here, could become a useSelect
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.
Yes, I've merely moved this code, I don't want to do a rewrite here to avoid making the PR more complex. I'm hoping for a quick merge so I don't have to do painful rebases. :)
@@ -22,11 +22,21 @@ | |||
"react-native": "src/index", | |||
"dependencies": { | |||
"@babel/runtime": "^7.4.4", | |||
"@wordpress/blob": "file:../blob", |
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.
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.
Sorry for overlooking this. Is there an open issue somewhere to track this or can you provide more details? I don't know what would be involved in that work.
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.
What's different here from other dependencies being added to packages?
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.
Left some small comments, but this makes sense to me.
Thanks for the review @youknowriad! I will now merge the mobile PR into this one, then wait for tests to pass, then merge it into |
@hypest yes, that’s what I mean, the mobile PR needs to be merged into this branch? |
If no one beats me to it. I’ll have to do it later tonight.
…On Tue, 25 Jun 2019 at 18:18, Stefanos Togoulidis ***@***.***> wrote:
#16219 <#16219> seems to have
conflicts currently. Are you planning to update it to resolve @ellatrix
<https://github.com/ellatrix>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15212?email_source=notifications&email_token=ABD6B25ISLG7X237IKGZWJTP4JANXA5CNFSM4HIWDL6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQZHRA#issuecomment-505516996>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABD6B22ZU3Y7YBKFCQMF4JTP4JANXANCNFSM4HIWDL6A>
.
|
Thanks! I think I'll be able to help tomorrow if not done by then. Sérgio is AFK so, happy to help. |
* Move React Native RichText to new package * Fix multiline reading. * Move default styles to component. * Move tests to component. * Fix paste on title
Thanks everyone! |
return ( | ||
<div className="editor-format-toolbar block-editor-format-toolbar"> | ||
<Toolbar> | ||
{ controls.map( ( format ) => | ||
{ [ 'bold', 'italic', 'link' ].map( ( format ) => |
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.
Forgot to ask, why is this hardcoded now?
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.
Ah, good question! These names are kind of hardcoded already in the formatting library. You cannot really add anything else here. But I forgot about the case where you'd remove the controls by setting an empty array. That case was already only partially working in master
, see #14542. Let's try to correct it there again.
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.
Now fixed in #14542.
Description
What?
This PR splits out general RichText logic from the
block-editor
package to therich-text
package. It leaves block related context. That's all it does!Why?
RichText
component can be used outside of the block or post context, such as in a sidebar, note...How?
There will be two
RichText
components in each package, where the one in theblock-editor
package wraps the one in therich-text
package and adds block context.There's a few temporary unstable props added that aid this wrapping, but in the future these props should be stabilised. Some props might disappears, some need to be renamed for the "bare" RichText component.
How has this been tested?
Nothing should have changed. Just ensure all e2e tests pass.
Screenshots
Types of changes
Refactoring.
Checklist: