Skip to content

Commit

Permalink
Update HTML anchor explaination text (#16142)
Browse files Browse the repository at this point in the history
Update the HTML anchor text to be more user friendly to anyone who doesn't already know what HTML anchors are.
  • Loading branch information
melchoyce authored and noisysocks committed Jul 8, 2019
1 parent a047c54 commit d6cd349
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
13 changes: 11 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 @@ -70,8 +70,17 @@ export const withInspectorControl = createHigherOrderComponent( ( BlockEdit ) =>
<BlockEdit { ...props } />
<InspectorAdvancedControls>
<TextControl
className="html-anchor-control"
label={ __( 'HTML Anchor' ) }
help={ __( 'Anchors lets you link directly to a section on a page.' ) }
help={ (
<>
{ __( '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 to link directly to this section of your page.' ) }

<ExternalLink href={ 'https://wordpress.org/support/article/page-jumps/' }>
{ __( 'Learn more about anchors' ) }
</ExternalLink>
</>
) }
value={ props.attributes.anchor || '' }
onChange={ ( nextValue ) => {
nextValue = nextValue.replace( ANCHOR_REGEX, '-' );
Expand Down
4 changes: 4 additions & 0 deletions packages/block-editor/src/hooks/anchor.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.html-anchor-control .components-external-link {
display: block;
margin-top: $grid-size;
}
1 change: 1 addition & 0 deletions packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
@import "./components/url-popover/style.scss";
@import "./components/warning/style.scss";
@import "./components/writing-flow/style.scss";
@import "./hooks/anchor.scss";

0 comments on commit d6cd349

Please sign in to comment.