From 4c9ae36e5dc8fffba12b0e41e8606ccf6c7b241d Mon Sep 17 00:00:00 2001 From: Kerry Liu Date: Wed, 5 May 2021 13:52:36 -0700 Subject: [PATCH] remove open in new tab, back out link to settings --- packages/block-library/src/editor.scss | 1 - .../block-library/src/home-link/block.json | 5 +--- packages/block-library/src/home-link/edit.js | 25 +++---------------- .../block-library/src/home-link/editor.scss | 9 ------- packages/block-library/src/home-link/index.js | 8 ------ .../block-library/src/home-link/index.php | 12 --------- .../fixtures/blocks/core__home-link.html | 2 +- .../fixtures/blocks/core__home-link.json | 3 +-- .../blocks/core__home-link.parsed.json | 3 +-- .../blocks/core__home-link.serialized.html | 2 +- 10 files changed, 8 insertions(+), 62 deletions(-) delete mode 100644 packages/block-library/src/home-link/editor.scss diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 31ee0ec856d8b3..cef09dbb86549b 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -25,7 +25,6 @@ @import "./more/editor.scss"; @import "./navigation/editor.scss"; @import "./navigation-link/editor.scss"; -@import "./home-link/editor.scss"; @import "./nextpage/editor.scss"; @import "./page-list/editor.scss"; @import "./paragraph/editor.scss"; diff --git a/packages/block-library/src/home-link/block.json b/packages/block-library/src/home-link/block.json index 544e209ab530ce..42cea69c7aaf7f 100644 --- a/packages/block-library/src/home-link/block.json +++ b/packages/block-library/src/home-link/block.json @@ -4,14 +4,11 @@ "category": "design", "parent": [ "core/navigation" ], "title": "Home Link", + "description": "Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header.", "textdomain": "default", "attributes": { "label": { "type": "string" - }, - "opensInNewTab": { - "type": "boolean", - "default": false } }, "usesContext": [ diff --git a/packages/block-library/src/home-link/edit.js b/packages/block-library/src/home-link/edit.js index 9bdc9a3a390d15..85571c518c8621 100644 --- a/packages/block-library/src/home-link/edit.js +++ b/packages/block-library/src/home-link/edit.js @@ -6,16 +6,11 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { - RichText, - useBlockProps, - InspectorControls, -} from '@wordpress/block-editor'; -import { __, _x } from '@wordpress/i18n'; +import { RichText, useBlockProps } from '@wordpress/block-editor'; +import { __ } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; import { useEffect } from '@wordpress/element'; -import { ToggleControl } from '@wordpress/components'; const preventDefault = ( event ) => event.preventDefault(); @@ -51,7 +46,7 @@ export default function HomeEdit( { }, } ); - const { label, opensInNewTab } = attributes; + const { label } = attributes; useEffect( () => { if ( label === undefined ) { @@ -61,20 +56,6 @@ export default function HomeEdit( { return ( <> - -
-

- { _x( 'Settings', 'Home link settings' ) } -

- { - setAttributes( { opensInNewTab: ! opensInNewTab } ); - } } - /> -
-
  • your homepage.', 'block description' ), - //TODO: slot/fill to override link - // eslint-disable-next-line jsx-a11y/anchor-has-content - { a: } - ), - edit, save, diff --git a/packages/block-library/src/home-link/index.php b/packages/block-library/src/home-link/index.php index e0ef303504c09f..9de6b5d59bf9c1 100644 --- a/packages/block-library/src/home-link/index.php +++ b/packages/block-library/src/home-link/index.php @@ -132,18 +132,6 @@ function render_block_core_home( $attributes, $content, $block ) { // Start appending HTML attributes to anchor tag. $html .= ' href="' . esc_url( home_url() ) . '"'; - if ( isset( $attributes['opensInNewTab'] ) && true === $attributes['opensInNewTab'] ) { - $html .= ' target="_blank" '; - } - - if ( isset( $attributes['rel'] ) ) { - $html .= ' rel="' . esc_attr( $attributes['rel'] ) . '"'; - } - - if ( isset( $attributes['title'] ) ) { - $html .= ' title="' . esc_attr( $attributes['title'] ) . '"'; - } - // End appending HTML attributes to anchor tag. $html .= '>'; diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.html b/packages/e2e-tests/fixtures/blocks/core__home-link.html index cba810356d4cb9..e1564a33298ae6 100644 --- a/packages/e2e-tests/fixtures/blocks/core__home-link.html +++ b/packages/e2e-tests/fixtures/blocks/core__home-link.html @@ -1 +1 @@ - + diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.json b/packages/e2e-tests/fixtures/blocks/core__home-link.json index ff4835d9a1c5bd..1a2c5fc0c6c5d5 100644 --- a/packages/e2e-tests/fixtures/blocks/core__home-link.json +++ b/packages/e2e-tests/fixtures/blocks/core__home-link.json @@ -4,8 +4,7 @@ "name": "core/home-link", "isValid": true, "attributes": { - "label": "Home", - "opensInNewTab": false + "label": "Home" }, "innerBlocks": [], "originalContent": "" diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json b/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json index c8e3e255ed2d82..7dee324f4fd40e 100644 --- a/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json +++ b/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json @@ -2,8 +2,7 @@ { "blockName": "core/home-link", "attrs": { - "label": "Home", - "opensInNewTab": false + "label": "Home" }, "innerBlocks": [], "innerHTML": "", diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html b/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html index cba810356d4cb9..e1564a33298ae6 100644 --- a/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html +++ b/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html @@ -1 +1 @@ - +