Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions packages/block-library/src/file/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
MediaPlaceholder,
MediaReplaceFlow,
RichText,
PlainText,
useBlockProps,
store as blockEditorStore,
} from '@wordpress/block-editor';
Expand Down Expand Up @@ -279,16 +280,14 @@ function FileEdit( {
</ResizableBox>
) }
<div className={ 'wp-block-file__content-wrapper' }>
<RichText
tagName="a"
<PlainText
value={ fileName }
placeholder={ __( 'Write file name…' ) }
withoutInteractiveFormatting
onChange={ ( text ) =>
setAttributes( { fileName: text } )
}
href={ textLinkHref }
/>

{ showDownloadButton && (
<div
className={
Expand Down
10 changes: 10 additions & 0 deletions packages/block-library/src/file/editor.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.wp-block-file {
/* prettier-ignore */
.wp-block[data-align="left"] > &,
.wp-block[data-align="right"] > & {
// Stop file block from collapsing when floated.
Expand Down Expand Up @@ -30,7 +31,16 @@
}

.wp-block-file__content-wrapper {
display: flex;
align-items: center;
flex-grow: 1;
textarea {
width: min-content;
&:focus {
border: none;
box-shadow: none;
}
}
}

a {
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/file/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function save( { attributes } ) {
/>
</>
) }
{ ! RichText.isEmpty( fileName ) && (
{
<a
id={ fileId }
href={ textLinkHref }
Expand All @@ -51,9 +51,9 @@ export default function save( { attributes } ) {
textLinkTarget ? 'noreferrer noopener' : undefined
}
>
<RichText.Content value={ fileName } />
{ fileName }
</a>
) }
}
{ showDownloadButton && (
<a
href={ href }
Expand Down