Skip to content

Commit

Permalink
Defensive programming no wp.media settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaz committed Sep 23, 2020
1 parent 44c3e7b commit 19c8fe2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export function ImageEdit( {
// Use the WordPress option to determine the proper default.
// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.
// TODO: fix this in a follow up PR, requires updating media-text and ui component.
switch ( wp.media.view.settings.defaultProps.link ) {
switch (
wp?.media?.view?.settings?.defaultProps?.link ||
LINK_DESTINATION_NONE
) {
case 'file':
case LINK_DESTINATION_MEDIA:
linkDestination = LINK_DESTINATION_MEDIA;
Expand Down

0 comments on commit 19c8fe2

Please sign in to comment.