mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
Media: Restore 3.4 behavior by consulting the old-school DB options for default align, size, and link properties.
This restores linking to media files as the default, over attachment pages. This 'default' cannot currently be changed by a user setting (per 3.4 behavior), due to the default database schema. see #22841, for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@23262 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
// outputting the proper object format based on the
|
||||
// attachment's type.
|
||||
props: function( props, attachment ) {
|
||||
var link, linkUrl, size, sizes, fallbacks;
|
||||
var link, linkUrl, size, sizes, fallbacks,
|
||||
defaultProps = wp.media.view.settings.defaultProps;
|
||||
|
||||
// Final fallbacks run after all processing has been completed.
|
||||
fallbacks = function( props ) {
|
||||
@@ -29,8 +30,8 @@
|
||||
|
||||
if ( 'image' === props.type ) {
|
||||
props = _.defaults( props || {}, {
|
||||
align: getUserSetting( 'align', 'none' ),
|
||||
size: getUserSetting( 'imgsize', 'medium' ),
|
||||
align: defaultProps.align || getUserSetting( 'align', 'none' ),
|
||||
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
|
||||
url: '',
|
||||
classes: []
|
||||
});
|
||||
@@ -42,7 +43,7 @@
|
||||
|
||||
props.title = props.title || attachment.title;
|
||||
|
||||
link = props.link || getUserSetting( 'urlbutton', 'post' );
|
||||
link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );
|
||||
if ( 'file' === link )
|
||||
linkUrl = attachment.url;
|
||||
else if ( 'post' === link )
|
||||
|
||||
@@ -438,11 +438,12 @@
|
||||
},
|
||||
|
||||
resetDisplays: function() {
|
||||
var defaultProps = media.view.settings.defaultProps;
|
||||
this._displays = [];
|
||||
this._defaultDisplaySettings = {
|
||||
align: getUserSetting( 'align', 'none' ),
|
||||
size: getUserSetting( 'imgsize', 'medium' ),
|
||||
link: getUserSetting( 'urlbutton', 'post' )
|
||||
align: defaultProps.align || getUserSetting( 'align', 'none' ),
|
||||
size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ),
|
||||
link: defaultProps.link || getUserSetting( 'urlbutton', 'file' )
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user