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

Add an "Open in new tab" option to the navigation block's sidebar settings. #67291

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added New tab option
  • Loading branch information
pitamdey committed Nov 26, 2024
commit d349e0338487a4a2f2b0e0fa7135e5c0eed3dd58
11 changes: 10 additions & 1 deletion packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ToolbarButton,
Tooltip,
ToolbarGroup,
CheckboxControl,
} from '@wordpress/components';
import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
import { __ } from '@wordpress/i18n';
Expand Down Expand Up @@ -159,7 +160,7 @@ function getMissingText( type ) {
* Consider reuseing this components for both blocks.
*/
function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
const { label, url, description, title, rel } = attributes;
const { label, url, description, title, rel, opensInNewTab } = attributes;
return (
<PanelBody title={ __( 'Settings' ) }>
<TextControl
Expand Down Expand Up @@ -188,6 +189,14 @@ function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
label={ __( 'Link' ) }
autoComplete="off"
/>
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Open in new tab' ) }
checked={ opensInNewTab }
onChange={ ( value ) =>
setAttributes( { opensInNewTab: value } )
}
/>
<TextareaControl
__nextHasNoMarginBottom
value={ description || '' }
Expand Down
Loading