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

Update HTML anchor explaination text #16142

Merged
merged 11 commits into from
Jul 8, 2019
15 changes: 13 additions & 2 deletions packages/block-editor/src/hooks/anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { assign, has } from 'lodash';
* WordPress dependencies
*/
import { addFilter } from '@wordpress/hooks';
import { TextControl } from '@wordpress/components';
import { TextControl, ExternalLink } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { hasBlockSupport } from '@wordpress/blocks';
import { createHigherOrderComponent } from '@wordpress/compose';
Expand Down Expand Up @@ -71,7 +71,18 @@ export const withInspectorControl = createHigherOrderComponent( ( BlockEdit ) =>
<InspectorAdvancedControls>
<TextControl
label={ __( 'HTML Anchor' ) }
help={ __( 'Anchors lets you link directly to a section on a page.' ) }
help={ (
<>
<p>
Copy link
Contributor

@tellthemachines tellthemachines Jul 5, 2019

Choose a reason for hiding this comment

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

I don't love the idea of adding extra markup in order to style the component. It's not a huge amount of work to create a stylesheet for this section (and I volunteer to do it myself if needed), is there any good reason not to though?

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to have a play and push to this branch!

Copy link
Contributor

Choose a reason for hiding this comment

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

Done!

{ __( 'Enter a word or two — without spaces — to make a unique web address just for this heading, called an "anchor." Then, you\'ll be able link directly to this section of your page.' ) }
melchoyce marked this conversation as resolved.
Show resolved Hide resolved
</p>
<p className="components-base-control__learn-more">
melchoyce marked this conversation as resolved.
Show resolved Hide resolved
<ExternalLink href={ __( 'https://wordpress.org/support/article/#/' ) }>
Copy link
Member

Choose a reason for hiding this comment

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

This URL doesn't go anywhere useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to sub it in for https://wordpress.org/support/article/page-jumps/ now that the page exists

{ __( 'Learn more about anchors' ) }
</ExternalLink>
</p>
</>
) }
value={ props.attributes.anchor || '' }
onChange={ ( nextValue ) => {
nextValue = nextValue.replace( ANCHOR_REGEX, '-' );
Expand Down