When inserting an image into a post, the values in `wp.media.controller.Library` should not default to linking the image when no user settings are present.

The default display setting value for `link` is now `none`. User settings persist and will override or confirm this value based on user actions.

Props liljimmi, janhenckens, eherman24, wonderboymusic.
Fixes #31467.


git-svn-id: https://develop.svn.wordpress.org/trunk@33729 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-08-25 12:12:59 +00:00
parent a9b27cbc07
commit e1b1541932
4 changed files with 11 additions and 11 deletions

View File

@ -467,7 +467,7 @@ function populate_options() {
// 2.7 // 2.7
'large_size_w' => 1024, 'large_size_w' => 1024,
'large_size_h' => 1024, 'large_size_h' => 1024,
'image_default_link_type' => 'file', 'image_default_link_type' => 'none',
'image_default_size' => '', 'image_default_size' => '',
'image_default_align' => '', 'image_default_align' => '',
'close_comments_for_old_posts' => 0, 'close_comments_for_old_posts' => 0,

View File

@ -1182,9 +1182,9 @@ Library = wp.media.controller.State.extend({
var defaultProps = wp.media.view.settings.defaultProps; var defaultProps = wp.media.view.settings.defaultProps;
this._displays = []; this._displays = [];
this._defaultDisplaySettings = { this._defaultDisplaySettings = {
align: defaultProps.align || getUserSetting( 'align', 'none' ), align: getUserSetting( 'align', defaultProps.align ) || 'none',
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ), size: getUserSetting( 'imgsize', defaultProps.size ) || 'medium',
link: defaultProps.link || getUserSetting( 'urlbutton', 'file' ) link: getUserSetting( 'urlbutton', defaultProps.link ) || 'none'
}; };
}, },

View File

@ -139,9 +139,9 @@ Library = wp.media.controller.State.extend({
var defaultProps = wp.media.view.settings.defaultProps; var defaultProps = wp.media.view.settings.defaultProps;
this._displays = []; this._displays = [];
this._defaultDisplaySettings = { this._defaultDisplaySettings = {
align: defaultProps.align || getUserSetting( 'align', 'none' ), align: getUserSetting( 'align', defaultProps.align ) || 'none',
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ), size: getUserSetting( 'imgsize', defaultProps.size ) || 'medium',
link: defaultProps.link || getUserSetting( 'urlbutton', 'file' ) link: getUserSetting( 'urlbutton', defaultProps.link ) || 'none'
}; };
}, },

View File

@ -652,7 +652,10 @@ function wp_print_media_templates() {
</option> </option>
<option value="file"> <option value="file">
<# } else { #> <# } else { #>
<option value="file" selected> <option value="none" selected>
<?php esc_attr_e('None'); ?>
</option>
<option value="file">
<# } #> <# } #>
<# if ( data.model.canEmbed ) { #> <# if ( data.model.canEmbed ) { #>
<?php esc_attr_e('Link to Media File'); ?> <?php esc_attr_e('Link to Media File'); ?>
@ -671,9 +674,6 @@ function wp_print_media_templates() {
<option value="custom"> <option value="custom">
<?php esc_attr_e('Custom URL'); ?> <?php esc_attr_e('Custom URL'); ?>
</option> </option>
<option value="none">
<?php esc_attr_e('None'); ?>
</option>
<# } #> <# } #>
</select> </select>
</label> </label>