-
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
Fix/issue 12033 url label #12959
Fix/issue 12033 url label #12959
Changes from 36 commits
39bc785
e15b05f
f9856ed
0395ac4
9eca9bf
2297665
246370f
dfd129a
e730af9
277ff12
b0ec06c
8792af3
de9d101
cc87beb
d7d5a8d
cc4e6ca
b9e444f
2cf001e
3dc2f01
94b2f52
09400da
9446bc2
bf8a16d
21b3b3e
260375e
8aef5e5
8fa3ad7
4834328
daa937a
fadb6cb
cd8481f
5226cd4
0ef7a22
5219d36
6049de6
69e495e
b123408
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,38 +53,46 @@ function PostLink( { | |
onToggle={ onTogglePanel } | ||
> | ||
{ isEditable && ( | ||
<TextControl | ||
label={ __( 'URL' ) } | ||
value={ forceEmptyField ? '' : currentSlug } | ||
onChange={ ( newValue ) => { | ||
editPermalink( newValue ); | ||
// When we delete the field the permalink gets | ||
// reverted to the original value. | ||
// The forceEmptyField logic allows the user to have | ||
// the field temporarily empty while typing. | ||
if ( ! newValue ) { | ||
if ( ! forceEmptyField ) { | ||
<div className="editor-post-link"> | ||
<TextControl | ||
label={ __( 'URL Slug:' ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though my search wasn't exhaustive, it seems as though most input field labels in the sidebar don't end with a colon. The only other one I could see is 'Parent Page:'. Might be good to drop the colon for sake of consistency. @jasmussen what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's an EXCELLENT catch & eye for detail. Yeah, if we can get that one final detail smoothed out let's ship it. Otherwise, this is also very lovely as is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @talldan @jasmussen removed the colon, nice catch! |
||
value={ forceEmptyField ? '' : currentSlug } | ||
onChange={ ( newValue ) => { | ||
editPermalink( newValue ); | ||
// When we delete the field the permalink gets | ||
// reverted to the original value. | ||
// The forceEmptyField logic allows the user to have | ||
// the field temporarily empty while typing. | ||
if ( ! newValue ) { | ||
if ( ! forceEmptyField ) { | ||
setState( { | ||
forceEmptyField: true, | ||
} ); | ||
} | ||
return; | ||
} | ||
if ( forceEmptyField ) { | ||
setState( { | ||
forceEmptyField: false, | ||
} ); | ||
} | ||
} } | ||
onBlur={ ( event ) => { | ||
editPermalink( cleanForSlug( event.target.value ) ); | ||
if ( forceEmptyField ) { | ||
setState( { | ||
forceEmptyField: true, | ||
forceEmptyField: false, | ||
} ); | ||
} | ||
return; | ||
} | ||
if ( forceEmptyField ) { | ||
setState( { | ||
forceEmptyField: false, | ||
} ); | ||
} | ||
} } | ||
onBlur={ ( event ) => { | ||
editPermalink( cleanForSlug( event.target.value ) ); | ||
if ( forceEmptyField ) { | ||
setState( { | ||
forceEmptyField: false, | ||
} ); | ||
} | ||
} } | ||
/> | ||
} } | ||
/> | ||
<p> | ||
{ __( 'The last part of the URL. ' ) } | ||
<ExternalLink href="https://codex.wordpress.org/Posts_Add_New_Screen"> | ||
{ __( 'Read about permalinks' ) } | ||
</ExternalLink> | ||
</p> | ||
</div> | ||
) } | ||
<p className="edit-post-post-link__preview-label"> | ||
{ __( 'Preview' ) } | ||
|
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 looks like the className
editor-post-link
doesn't have any associated styles. It can probably be removed unless there's a good reason for 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.
Is this div really necessary or should we just replace it with
<Fragment />