Insert from URL: Make sure the link text is actually used.
Turns out there were more pieces to renaming the field. props iseulde. fixes #29476. git-svn-id: https://develop.svn.wordpress.org/trunk@32055 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d8f439c335
commit
2f368bf396
|
@ -2484,8 +2484,8 @@ function wp_ajax_send_link_to_editor() {
|
||||||
if ( ! $src = esc_url_raw( $src ) )
|
if ( ! $src = esc_url_raw( $src ) )
|
||||||
wp_send_json_error();
|
wp_send_json_error();
|
||||||
|
|
||||||
if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) )
|
if ( ! $link_text = trim( wp_unslash( $_POST['link_text'] ) ) )
|
||||||
$title = wp_basename( $src );
|
$link_text = wp_basename( $src );
|
||||||
|
|
||||||
$post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
|
$post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
|
||||||
|
|
||||||
|
@ -2498,8 +2498,8 @@ function wp_ajax_send_link_to_editor() {
|
||||||
if ( $check_embed !== $fallback ) {
|
if ( $check_embed !== $fallback ) {
|
||||||
// TinyMCE view for [embed] will parse this
|
// TinyMCE view for [embed] will parse this
|
||||||
$html = '[embed]' . $src . '[/embed]';
|
$html = '[embed]' . $src . '[/embed]';
|
||||||
} elseif ( $title ) {
|
} elseif ( $link_text ) {
|
||||||
$html = '<a href="' . esc_url( $src ) . '">' . $title . '</a>';
|
$html = '<a href="' . esc_url( $src ) . '">' . $link_text . '</a>';
|
||||||
} else {
|
} else {
|
||||||
$html = '';
|
$html = '';
|
||||||
}
|
}
|
||||||
|
@ -2511,7 +2511,7 @@ function wp_ajax_send_link_to_editor() {
|
||||||
$type = $ext_type;
|
$type = $ext_type;
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/includes/media.php */
|
/** This filter is documented in wp-admin/includes/media.php */
|
||||||
$html = apply_filters( $type . '_send_to_editor_url', $html, $src, $title );
|
$html = apply_filters( $type . '_send_to_editor_url', $html, $src, $link_text );
|
||||||
|
|
||||||
wp_send_json_success( $html );
|
wp_send_json_success( $html );
|
||||||
}
|
}
|
||||||
|
|
|
@ -880,7 +880,7 @@
|
||||||
|
|
||||||
if ( 'link' === type ) {
|
if ( 'link' === type ) {
|
||||||
_.defaults( embed, {
|
_.defaults( embed, {
|
||||||
title: embed.url,
|
linkText: embed.linkText,
|
||||||
linkUrl: embed.url
|
linkUrl: embed.url
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1036,7 +1036,7 @@
|
||||||
return wp.media.post( 'send-link-to-editor', {
|
return wp.media.post( 'send-link-to-editor', {
|
||||||
nonce: wp.media.view.settings.nonce.sendToEditor,
|
nonce: wp.media.view.settings.nonce.sendToEditor,
|
||||||
src: embed.linkUrl,
|
src: embed.linkUrl,
|
||||||
title: embed.title,
|
link_text: embed.linkText,
|
||||||
html: wp.media.string.link( embed ),
|
html: wp.media.string.link( embed ),
|
||||||
post_id: wp.media.view.settings.post.id
|
post_id: wp.media.view.settings.post.id
|
||||||
});
|
});
|
||||||
|
|
|
@ -814,7 +814,7 @@ function wp_print_media_templates() {
|
||||||
<script type="text/html" id="tmpl-embed-link-settings">
|
<script type="text/html" id="tmpl-embed-link-settings">
|
||||||
<label class="setting link-text">
|
<label class="setting link-text">
|
||||||
<span><?php _e( 'Link Text' ); ?></span>
|
<span><?php _e( 'Link Text' ); ?></span>
|
||||||
<input type="text" class="alignment" data-setting="link-text" />
|
<input type="text" class="alignment" data-setting="linkText" />
|
||||||
</label>
|
</label>
|
||||||
<div class="embed-container" style="display: none;">
|
<div class="embed-container" style="display: none;">
|
||||||
<div class="embed-preview"></div>
|
<div class="embed-preview"></div>
|
||||||
|
|
Loading…
Reference in New Issue