我正在构建一个 Gutenberg 块,并尝试在选择元素时显示输入。
<RichText
tagName="a"
className="button"
placeholder={ __( 'Text...' ) }
keepPlaceholderOnFocus={ true }
value={ text }
onChange={ ( value ) => setAttributes( { text: value } ) }
/>
{ isSelected && (
<form
className="inline-input"
onSubmit={ ( event ) => event.preventDefault() }>
<URLInput
value={ URL }
onChange={ ( value ) => setAttributes( { URL: value } ) }
/>
</form>
) }
When the element with class name "button" is selected the form should show. 相反,表格从一开始就显示。我使用 isSelected 错误吗?