This is covered in the documentation section directly above the one you linked, for value
:
A link
value
is composed of a union between the values of default
link properties and any custom linksettings
.The resulting default properties of
value
include:
url
(string
): Link URL.title
(string
, optional): Link title.opensInNewTab
(boolean
, optional): Whether link should open in a new browser tab. This value is only assigned when not providing a
customsettings
prop.
So you’d need to include it in the value:
<LinkControl
searchInputPlaceholder="Add Link"
value={{
url: attributes.link,
opensInNewTab: attributes.opensInNewTab,
}}
onChange={(value) => {
setAttributes({ link: value.url, opensInNewTab: value.opensInNewTab })
}}
settings={[
{
id: 'opensInNewTab',
title: 'Opens in new tab',
},
]}
suggestionsQuery={{ type: "post", subtype: 'page' }}
/>