File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
packages/block-library/src/gallery Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11export const LINK_DESTINATION_NONE = 'none' ;
22export const LINK_DESTINATION_MEDIA = 'media' ;
33export const LINK_DESTINATION_ATTACHMENT = 'attachment' ;
4+ export const LINK_DESTINATION_MEDIA_WP_CORE = 'file' ;
5+ export const LINK_DESTINATION_ATTACHMENT_WP_CORE = 'post' ;
Original file line number Diff line number Diff line change 55 LINK_DESTINATION_ATTACHMENT ,
66 LINK_DESTINATION_MEDIA ,
77 LINK_DESTINATION_NONE ,
8+ LINK_DESTINATION_MEDIA_WP_CORE ,
9+ LINK_DESTINATION_ATTACHMENT_WP_CORE ,
810} from './constants' ;
911import {
1012 LINK_DESTINATION_ATTACHMENT as IMAGE_LINK_DESTINATION_ATTACHMENT ,
@@ -21,15 +23,17 @@ import {
2123 * @return {Object } New attributes to assign to image block.
2224 */
2325export function getHrefAndDestination ( image , destination ) {
24- // Need to determine the URL that the selected destination maps to.
25- // Gutenberg and WordPress use different constants so the new link
26- // destination also needs to be tweaked.
26+ // Gutenberg and WordPress use different constants so if image_default_link_type
27+ // option is set we need to map from the WP Core values.
28+
2729 switch ( destination ) {
30+ case LINK_DESTINATION_MEDIA_WP_CORE :
2831 case LINK_DESTINATION_MEDIA :
2932 return {
3033 href : image ?. source_url || image ?. url , // eslint-disable-line camelcase
3134 linkDestination : IMAGE_LINK_DESTINATION_MEDIA ,
3235 } ;
36+ case LINK_DESTINATION_ATTACHMENT_WP_CORE :
3337 case LINK_DESTINATION_ATTACHMENT :
3438 return {
3539 href : image ?. link ,
You can’t perform that action at this time.
0 commit comments