Ticket #22553: 22553.diff
| File 22553.diff, 2.9 KB (added by nacin, 6 months ago) |
|---|
-
wp-admin/includes/ajax-actions.php
1931 1931 if ( 'attachment' != $post->post_type ) 1932 1932 wp_send_json_error(); 1933 1933 1934 $html = isset( $attachment['title'] ) ? $attachment['title'] : ''; 1934 $rel = $url = ''; 1935 $html = $title = isset( $attachment['post_title'] ) ? $attachment['post_title'] : ''; 1935 1936 if ( ! empty( $attachment['url'] ) ) { 1936 $ rel = '';1937 if ( strpos( $attachment['url'], 'attachment_id') || get_attachment_link( $id ) == $attachment['url'])1937 $url = $attachment['url']; 1938 if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url ) 1938 1939 $rel = ' rel="attachment wp-att-' . $id . '"'; 1939 $html = '<a href="' . esc_url( $ attachment['url']) . '"' . $rel . '>' . $html . '</a>';1940 $html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>'; 1940 1941 } 1941 1942 1942 1943 remove_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 ); 1943 1944 1944 1945 if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { 1945 $url = $attachment['url']; 1946 $align = isset( $attachment['image-align'] ) ? $attachment['image-align'] : 'none'; 1946 $align = isset( $attachment['align'] ) ? $attachment['align'] : 'none'; 1947 1947 $size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; 1948 $alt = isset( $attachment['image -alt'] ) ? $attachment['image-alt'] : '';1949 $caption = isset( $attachment[' caption'] ) ? $attachment['caption'] : '';1948 $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; 1949 $caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : ''; 1950 1950 $title = ''; // We no longer insert title tags into <img> tags, as they are redundant. 1951 1951 $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt ); 1952 1952 } -
wp-includes/js/media-editor.js
426 426 id: attachment.id 427 427 }; 428 428 429 if ( props.linkUrl ) 430 options.url = props.linkUrl; 431 429 432 if ( 'image' === attachment.type ) { 430 433 html = wp.media.string.image( props ); 431 options ['caption']= caption;434 options.post_excerpt = caption; 432 435 433 436 _.each({ 434 align: 'image-align', 435 size: 'image-size', 436 alt: 'image-alt', 437 linkUrl: 'url' 437 align: 'align', 438 size: 'image-size', 439 alt: 'image_alt' 438 440 }, function( option, prop ) { 439 441 if ( props[ prop ] ) 440 442 options[ option ] = props[ prop ]; … … 442 444 443 445 } else { 444 446 html = wp.media.string.link( props ); 445 options. title = props.title;447 options.post_title = props.title; 446 448 } 447 449 448 450 return media.post( 'send-attachment-to-editor', {
