mirror of
https://github.com/LamGC/wp-asciiplayer.git
synced 2026-11-26 20:55:48 +00:00
Keep editor caption geometry stable during block selection
This commit is contained in:
+1
-1
@@ -100,7 +100,7 @@ export default function Edit( { attributes, setAttributes, isSelected } ) {
|
||||
{ source && <Button variant="secondary" onClick={ () => { setApprovedSource( source ); setAttempt( ( current ) => current + 1 ); } }>{ __( 'Load preview', 'wp-asciiplayer' ) }</Button> }
|
||||
</Placeholder>
|
||||
) }
|
||||
{ ( isSelected || caption ) && <RichText tagName="figcaption" className="wp-element-caption" value={ caption } allowedFormats={ [] } onChange={ ( value ) => setAttributes( { caption: value } ) } placeholder={ __( 'Add a caption…', 'wp-asciiplayer' ) } aria-label={ __( 'Recording caption', 'wp-asciiplayer' ) } /> }
|
||||
<RichText tagName="figcaption" className={ `wp-element-caption${ ! isSelected && ! caption ? ' asciiplayer-caption-empty' : '' }` } value={ caption } allowedFormats={ [] } onChange={ ( value ) => setAttributes( { caption: value } ) } placeholder={ __( 'Add a caption…', 'wp-asciiplayer' ) } aria-label={ __( 'Recording caption', 'wp-asciiplayer' ) } />
|
||||
</figure>
|
||||
{ approvedSource === source && source && <p className="asciiplayer-editor__hint">{ __( 'Use the player controls to play, pause, and seek. Autoplay is disabled only in the editor.', 'wp-asciiplayer' ) }</p> }
|
||||
{ [ 'height', 'both' ].includes( fit ) && <p className="asciiplayer-editor__hint">{ __( 'Height-based previews use the shortcode’s fixed height when available, or a 320px editor frame. Published height still comes from your container style.', 'wp-asciiplayer' ) }</p> }
|
||||
|
||||
@@ -58,3 +58,8 @@
|
||||
.asciiplayer-example__terminal > span:first-child { color: #a9da76; }
|
||||
.asciiplayer-example__controls { padding: 8px 16px; background: #222; font: 12px/1.5 monospace; }
|
||||
.asciiplayer-example figcaption { padding: 8px; background: #fff; color: #333; text-align: center; font-size: 12px; }
|
||||
|
||||
/* Keep an empty caption's footprint stable when another block is selected.
|
||||
* Removing it on pointerdown can move the next block's button before pointerup. */
|
||||
.asciiplayer-editor .asciiplayer-figure > figcaption { min-height: 1.5em; }
|
||||
.asciiplayer-editor .asciiplayer-caption-empty { visibility: hidden; }
|
||||
|
||||
Reference in New Issue
Block a user