diff --git a/src/block-components/helpers/link/edit.js b/src/block-components/helpers/link/edit.js index 252da1f6fc..07ff3ea33c 100644 --- a/src/block-components/helpers/link/edit.js +++ b/src/block-components/helpers/link/edit.js @@ -11,6 +11,7 @@ import { */ import { __ } from '@wordpress/i18n' import { useAttributeEditHandlers } from '~stackable/hooks' +import { useState } from '@wordpress/element' export const LinkControls = props => { const { @@ -23,9 +24,13 @@ export const LinkControls = props => { const { getAttribute, + updateAttribute, updateAttributeHandler, } = useAttributeEditHandlers( props.attrNameTemplate ) + const [ rel, setRel ] = useState( getAttribute( 'rel' ) ) + const [ title, setTitle ] = useState( getAttribute( 'title' ) ) + const url = getAttribute( 'url' ) || '' const showGoogleMapHint = getAttribute( 'hasLightbox' ) && @@ -70,14 +75,20 @@ export const LinkControls = props => { { + setRel( value ) + updateAttribute( 'rel', value ) + } } /> { ( hasTitle || getAttribute( 'hasTitle' ) ) && ( { + setTitle( value ) + updateAttribute( 'title', value ) + } } isDynamic={ true } isFormatType={ false } help={ __( 'Also used for lightbox caption', i18n ) }