Skip to content

Commit 8c57e5c

Browse files
Mamadukantsekouras
authored andcommitted
Inserter: Fix title condition for media tab previews (#58993)
Unlinked contributors: nbcsteveb. Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
1 parent a4478d8 commit 8c57e5c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/block-editor/src/components/inserter/media-tab/media-preview.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ export function MediaPreview( { media, onClick, category } ) {
195195
createSuccessNotice,
196196
]
197197
);
198-
const title = media.title?.rendered || media.title;
198+
199+
const title =
200+
typeof media.title === 'string'
201+
? media.title
202+
: media.title?.rendered || __( 'no title' );
203+
199204
let truncatedTitle;
200205
if ( title.length > MAXIMUM_TITLE_LENGTH ) {
201206
const omission = '...';

0 commit comments

Comments
 (0)