Skip to content

Commit

Permalink
Revert change that removes the social link block when pressing backsp…
Browse files Browse the repository at this point in the history
…ace in the URL Popover (#61344)

Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: alexstine <alexstine@git.wordpress.org>
  • Loading branch information
4 people authored and ellatrix committed Jun 18, 2024
1 parent 1867db9 commit cee81d8
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions packages/block-library/src/social-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import { DELETE, BACKSPACE } from '@wordpress/keycodes';
import { useDispatch } from '@wordpress/data';

import {
InspectorControls,
URLPopover,
URLInput,
useBlockProps,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { useState } from '@wordpress/element';
import {
Expand All @@ -36,9 +32,7 @@ const SocialLinkURLPopover = ( {
setAttributes,
setPopover,
popoverAnchor,
clientId,
} ) => {
const { removeBlock } = useDispatch( blockEditorStore );
return (
<URLPopover
anchor={ popoverAnchor }
Expand All @@ -62,18 +56,6 @@ const SocialLinkURLPopover = ( {
label={ __( 'Enter social link' ) }
hideLabelFromVision
disableSuggestions
onKeyDown={ ( event ) => {
if (
!! url ||
event.defaultPrevented ||
! [ BACKSPACE, DELETE ].includes(
event.keyCode
)
) {
return;
}
removeBlock( clientId );
} }
/>
</div>
<Button
Expand All @@ -91,7 +73,6 @@ const SocialLinkEdit = ( {
context,
isSelected,
setAttributes,
clientId,
} ) => {
const { url, service, label = '', rel } = attributes;
const {
Expand Down Expand Up @@ -178,7 +159,6 @@ const SocialLinkEdit = ( {
setAttributes={ setAttributes }
setPopover={ setPopover }
popoverAnchor={ popoverAnchor }
clientId={ clientId }
/>
) }
</li>
Expand Down

0 comments on commit cee81d8

Please sign in to comment.