-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update: Document and Remove experimental mark from URLPopover "subcomponents" #16566
Update: Document and Remove experimental mark from URLPopover "subcomponents" #16566
Conversation
…wer and URLPopover.LinkEditor.
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 tested this PR locally and the functionality is the same. Code wise it is an improvement and I see no issues.
I have also merged this so that it is available in master, since the components can be useful in the incoming navigation menu block. |
…wer and URLPopover.LinkEditor. (#16566)
…wer and URLPopover.LinkEditor. (#16566)
} from '@wordpress/components'; | ||
import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url'; | ||
|
||
function LinkViewerUrl( { url, urlLabel, className } ) { |
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.
Based on the file name, this probably should have been named LinkViewer
. In any case, this specific naming doesn't adhere to capitalization guidelines, and it should at the very least be LinkViewerURL
. Thankfully it doesn't seem to be part of the public API?
Edit: Oh, I see this file contains multiple components. In that case, I might have suggested each component get its own file.
Follow up on #15570.
I'm not sure if these components should be "inside" URLPopover as they may be used outside. But I don't know a better place for them.
Exposing the components inside wp.components... seems to pollute the number of components we offer. These components use other components, they are not very useful, and it is easy to get their behavior using different components. The main reason they were created was to avoid code repetition.
They make it more straightforward to get a URLPopover with some UI. Otherwise, for each block where we want to add href functionality, we will need to repeat this code all the time. The reason to have them inside URLPopover is that the use case we have in mind for them is as children of that component and they were only tested in that context they may or may not work correctly when the parent is different.
How has this been tested?
I verified the link functionality in the image block toolbar still works as expected.
I verified the link format in the paragraph block still works as expected.