Ticket #22696: grid.diff

File grid.diff, 5.1 KB (added by koopersmith, 6 months ago)
Line 
1Index: wp-includes/css/media-views.css
2===================================================================
3--- wp-includes/css/media-views.css     (revision 23060)
4+++ wp-includes/css/media-views.css     (working copy)
5@@ -633,8 +633,8 @@
6 
7 .attachment-preview {
8        position: relative;
9-       width: 199px;
10-       height: 199px;
11+       width: 150px;
12+       height: 150px;
13        box-shadow:
14                inset 0 0 15px rgba( 0, 0, 0, 0.1 ),
15                inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
16@@ -642,21 +642,11 @@
17        cursor: pointer;
18 }
19 
20-.attachment .icon {
21-       margin: 0 auto;
22-       overflow: hidden;
23-       padding-top: 20%;
24-}
25-
26 .attachment .thumbnail {
27        display: block;
28-       position: absolute;
29-       top: 0;
30-       left: 0;
31+       position: relative;
32        margin: 0 auto;
33        overflow: hidden;
34-       max-width: 100%;
35-       max-height: 100%;
36 }
37 
38 .attachment-preview .thumbnail:after {
39@@ -672,31 +662,11 @@
40 }
41 
42 .attachment .thumbnail img {
43-       top: 0;
44-       left: 0;
45+       position: relative;
46+       display: inline-block;
47+       vertical-align: middle;
48 }
49 
50-.attachment .thumbnail .centered {
51-       position: absolute;
52-       top: 0;
53-       left: 0;
54-       width: 100%;
55-       height: 100%;
56-       -webkit-transform: translate( 50%, 50% );
57-       -moz-transform:    translate( 50%, 50% );
58-       -ms-transform:     translate( 50%, 50% );
59-       -o-transform:      translate( 50%, 50% );
60-       transform:         translate( 50%, 50% );
61-}
62-
63-.attachment .thumbnail .centered img {
64-       -webkit-transform: translate( -50%, -50% );
65-       -moz-transform:    translate( -50%, -50% );
66-       -ms-transform:     translate( -50%, -50% );
67-       -o-transform:      translate( -50%, -50% );
68-       transform:         translate( -50%, -50% );
69-}
70-
71 .attachment .filename {
72        position: absolute;
73        left: 0;
74@@ -717,14 +687,10 @@
75 }
76 
77 .attachment-preview .thumbnail {
78-       width: 199px;
79-       height: 199px;
80+       width: 150px;
81+       height: 150px;
82 }
83 
84-.attachment .thumbnail img {
85-       position: absolute;
86-}
87-
88 .attachment .close {
89        display: none;
90        position: absolute;
91@@ -1188,10 +1154,6 @@
92        vertical-align: top;
93 }
94 
95-.media-selection .attachment .icon {
96-       width: 50%;
97-}
98-
99 .attachment.selection.selected {
100        box-shadow: none;
101 }
102Index: wp-includes/js/media-views.js
103===================================================================
104--- wp-includes/js/media-views.js       (revision 23060)
105+++ wp-includes/js/media-views.js       (working copy)
106@@ -590,7 +590,7 @@
107                        id:         'gallery-edit',
108                        multiple:   false,
109                        describe:   true,
110-                       edge:       199,
111+                       edge:       150,
112                        editing:    false,
113                        sortable:   true,
114                        searchable: false,
115@@ -2743,6 +2743,7 @@
116                tagName:   'li',
117                className: 'attachment',
118                template:  media.template('attachment'),
119+               size:      'thumbnail',
120 
121                events: {
122                        'click .attachment-preview':      'toggleSelectionHandler',
123@@ -2959,7 +2960,7 @@
124                imageSize: function( size ) {
125                        var sizes = this.model.get('sizes');
126 
127-                       size = size || 'medium';
128+                       size = size || this.size;
129 
130                        // Use the provided image size if possible.
131                        if ( sizes && sizes[ size ] ) {
132@@ -3140,7 +3141,7 @@
133 
134                        _.bindAll( this, 'css' );
135                        this.model.on( 'change:edge change:gutter', this.css, this );
136-                       this._resizeCss = _.debounce( _.bind( this.css, this ), this.refreshSensitivity );
137+                       this._resizeCss = _.debounce( this.css, this.refreshSensitivity );
138                        if ( this.options.resize )
139                                $(window).on( 'resize.attachments', this._resizeCss );
140                        this.css();
141@@ -3153,14 +3154,17 @@
142                },
143 
144                css: function() {
145-                       var $css = $( '#' + this.el.id + '-css' );
146+                       var $css = $( '#' + this.el.id + '-css' ),
147+                               edge;
148 
149                        if ( $css.length )
150                                $css.remove();
151 
152+                       edge = this.edge();
153                        media.view.Attachments.$head().append( this.cssTemplate({
154                                id:     this.el.id,
155-                               edge:   this.edge(),
156+                               edge:   edge,
157+                               line:   Math.max( edge - 1, 0 ),
158                                gutter: this.model.get('gutter')
159                        }) );
160                },
161@@ -3939,6 +3943,7 @@
162                tagName:   'div',
163                className: 'attachment-details',
164                template:  media.template('attachment-details'),
165+               size:      'medium',
166 
167                events: {
168                        'change [data-setting]':          'updateSetting',
169Index: wp-includes/media.php
170===================================================================
171--- wp-includes/media.php       (revision 23060)
172+++ wp-includes/media.php       (working copy)
173@@ -1635,12 +1635,12 @@
174                                <div class="media-progress-bar"><div></div></div>
175                        <# } else if ( 'image' === data.type ) { #>
176                                <div class="thumbnail">
177-                                       <div class="centered">
178-                                               <img src="{{ data.size.url }}" draggable="false" />
179-                                       </div>
180+                                       <img src="{{ data.size.url }}" draggable="false" />
181                                </div>
182                        <# } else { #>
183-                               <img src="{{ data.icon }}" class="icon" draggable="false" />
184+                               <div class="thumbnail">
185+                                       <img src="{{ data.icon }}" class="icon" draggable="false" />
186+                               </div>
187                                <div class="filename">
188                                        <div>{{ data.filename }}</div>
189                                </div>
190@@ -1951,13 +1951,12 @@
191                                height: {{ data.edge }}px;
192                        }
193 
194-                       #{{ data.id }} .portrait .thumbnail img {
195-                               max-width: {{ data.edge }}px;
196-                               height: auto;
197+                       #{{ data.id }} .attachment-preview .thumbnail {
198+                               line-height: {{ data.line }}px;
199                        }
200 
201-                       #{{ data.id }} .landscape .thumbnail img {
202-                               width: auto;
203+                       #{{ data.id }} .thumbnail img {
204+                               max-width: {{ data.edge }}px;
205                                max-height: {{ data.edge }}px;
206                        }
207                </style>