Ticket #50523: 50523.9.diff
| File 50523.9.diff, 47.9 KB (added by , 3 years ago) |
|---|
-
src/js/_enqueues/lib/image-edit.js
(this hunk was shorter than expected) 22 22 _view : false, 23 23 24 24 /** 25 * Handle crop tool clicks.25 * Enable crop tool. 26 26 */ 27 handleCropToolClick: function( postid, nonce, cropButton ) {27 toggleCropTool: function( postid, nonce, cropButton ) { 28 28 var img = $( '#image-preview-' + postid ), 29 29 selection = this.iasapi.getSelection(); 30 30 31 // Ensure selection is available, otherwise reset to full image. 32 if ( isNaN( selection.x1 ) ) { 33 this.setCropSelection( postid, { 'x1': 0, 'y1': 0, 'x2': img.innerWidth(), 'y2': img.innerHeight(), 'width': img.innerWidth(), 'height': img.innerHeight() } ); 34 selection = this.iasapi.getSelection(); 31 imageEdit.toggleControls( cropButton ); 32 var $el = $( cropButton ); 33 var state = ( $el.attr( 'aria-expanded' ) === 'true' ) ? 'true' : 'false'; 34 // Crop tools have been closed. 35 if ( 'false' === state ) { 36 // Cancel selection, but do not unset inputs. 37 this.iasapi.cancelSelection(); 38 imageEdit.setDisabled($('.imgedit-crop-clear'), 0); 39 } else { 40 imageEdit.setDisabled($('.imgedit-crop-clear'), 1); 41 // Get values from inputs to restore previous selection. 42 var startX = ( $( '#imgedit-start-x-' + postid ).val() ) ? $('#imgedit-start-x-' + postid).val() : 0; 43 var startY = ( $( '#imgedit-start-y-' + postid ).val() ) ? $('#imgedit-start-y-' + postid).val() : 0; 44 var width = ( $( '#imgedit-sel-width-' + postid ).val() ) ? $('#imgedit-sel-width-' + postid).val() : img.innerWidth(); 45 var height = ( $( '#imgedit-sel-height-' + postid ).val() ) ? $('#imgedit-sel-height-' + postid).val() : img.innerHeight(); 46 // Ensure selection is available, otherwise reset to full image. 47 if ( isNaN( selection.x1 ) ) { 48 this.setCropSelection( postid, { 'x1': startX, 'y1': startY, 'x2': width, 'y2': height, 'width': width, 'height': height } ); 49 selection = this.iasapi.getSelection(); 50 } 51 52 // If we don't already have a selection, select the entire image. 53 if ( 0 === selection.x1 && 0 === selection.y1 && 0 === selection.x2 && 0 === selection.y2 ) { 54 this.iasapi.setSelection( 0, 0, img.innerWidth(), img.innerHeight(), true ); 55 this.iasapi.setOptions( { show: true } ); 56 this.iasapi.update(); 57 } else { 58 this.iasapi.setSelection( startX, startY, width, height, true ); 59 this.iasapi.setOptions( { show: true } ); 60 this.iasapi.update(); 61 } 35 62 } 63 }, 36 64 37 // If we don't already have a selection, select the entire image. 38 if ( 0 === selection.x1 && 0 === selection.y1 && 0 === selection.x2 && 0 === selection.y2 ) { 39 this.iasapi.setSelection( 0, 0, img.innerWidth(), img.innerHeight(), true ); 40 this.iasapi.setOptions( { show: true } ); 41 this.iasapi.update(); 65 /** 66 * Handle crop tool clicks. 67 */ 68 handleCropToolClick: function( postid, nonce, cropButton ) { 69 70 if ( cropButton.classList.contains( 'imgedit-crop-clear' ) ) { 71 this.iasapi.cancelSelection(); 72 imageEdit.setDisabled($('.imgedit-crop-apply'), 0); 73 74 $('#imgedit-sel-width-' + postid).val(''); 75 $('#imgedit-sel-height-' + postid).val(''); 76 $('#imgedit-start-x-' + postid).val('0'); 77 $('#imgedit-start-y-' + postid).val('0'); 78 $('#imgedit-selection-' + postid).val(''); 42 79 } else { 43 44 80 // Otherwise, perform the crop. 45 81 imageEdit.crop( postid, nonce , cropButton ); 46 82 } … … 122 159 t.postid = postid; 123 160 $('#imgedit-response-' + postid).empty(); 124 161 162 $('#imgedit-panel-' + postid).on( 'keypress', function(e) { 163 var nonce = $( '#imgedit-nonce-' + postid ).val(); 164 if ( e.which === 26 && e.ctrlKey ) { 165 imageEdit.undo( postid, nonce ); 166 } 167 168 if ( e.which === 25 && e.ctrlKey ) { 169 imageEdit.redo( postid, nonce ); 170 } 171 }); 172 125 173 $('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) { 126 174 var k = e.keyCode; 127 175 … … 190 238 }, 191 239 192 240 /** 241 * Shows or hides image edit input fields when enabled. 242 * 243 * @since 6.3.0 244 * 245 * @memberof imageEdit 246 * 247 * @param {HTMLElement} el The element to trigger the edit panel. 248 * 249 * @return {boolean} Always returns false. 250 */ 251 toggleControls : function(el) { 252 var $el = $( el ); 253 var $target = $( '#' + $el.attr( 'aria-controls' ) ); 254 $el 255 .attr( 'aria-expanded', 'false' === $el.attr( 'aria-expanded' ) ? 'true' : 'false' ); 256 $target 257 .parent( '.imgedit-group' ).toggleClass( 'imgedit-panel-active' ); 258 259 return false; 260 }, 261 262 /** 193 263 * Gets the value from the image edit target. 194 264 * 195 265 * The image edit target contains the image sizes where the (possible) changes … … 405 475 } 406 476 407 477 if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) { 408 $(' input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);478 $('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false); 409 479 } else { 410 $(' input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);480 $('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); 411 481 } 412 482 413 483 t.toggleEditor(postid, 0); … … 713 783 var t = this, 714 784 selW = $('#imgedit-sel-width-' + postid), 715 785 selH = $('#imgedit-sel-height-' + postid), 786 selX = $('#imgedit-start-x-' + postid), 787 selY = $('#imgedit-start-y-' + postid), 716 788 $image = $( image ), 717 789 $img; 718 790 … … 771 843 */ 772 844 onSelectStart: function() { 773 845 imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1); 846 imageEdit.setDisabled($('.imgedit-crop-clear'), 1); 847 imageEdit.setDisabled($('.imgedit-crop-apply'), 1); 774 848 }, 775 849 /** 776 850 * Event triggered when the selection is ended. … … 784 858 */ 785 859 onSelectEnd: function(img, c) { 786 860 imageEdit.setCropSelection(postid, c); 861 if ( ! $('#imgedit-crop > *').is(':visible') ) { 862 imageEdit.toggleControls($('.imgedit-crop.button')); 863 } 787 864 }, 788 865 789 866 /** … … 800 877 var sizer = imageEdit.hold.sizer; 801 878 selW.val( imageEdit.round(c.width / sizer) ); 802 879 selH.val( imageEdit.round(c.height / sizer) ); 880 selX.val( imageEdit.round(c.x1 / sizer) ); 881 selY.val( imageEdit.round(c.y1 / sizer) ); 803 882 } 804 883 }); 805 884 }, … … 826 905 this.setDisabled( $( '#imgedit-crop-sel-' + postid ), 1 ); 827 906 $('#imgedit-sel-width-' + postid).val(''); 828 907 $('#imgedit-sel-height-' + postid).val(''); 908 $('#imgedit-start-x-' + postid).val('0'); 909 $('#imgedit-start-y-' + postid).val('0'); 829 910 $('#imgedit-selection-' + postid).val(''); 830 911 return false; 831 912 } … … 1014 1095 // Clear the selection fields after cropping. 1015 1096 $('#imgedit-sel-width-' + postid).val(''); 1016 1097 $('#imgedit-sel-height-' + postid).val(''); 1098 $('#imgedit-start-x-' + postid).val('0'); 1099 $('#imgedit-start-y-' + postid).val('0'); 1017 1100 }, 1018 1101 1019 1102 /** … … 1097 1180 */ 1098 1181 setNumSelection : function( postid, el ) { 1099 1182 var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid), 1183 elX1 = $('#imgedit-start-x-' + postid), elY1 = $('#imgedit-start-y-' + postid), 1184 xS = this.intval( elX1.val() ), yS = this.intval( elY1.val() ), 1100 1185 x = this.intval( elX.val() ), y = this.intval( elY.val() ), 1101 1186 img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(), 1102 1187 sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi; … … 1115 1200 return false; 1116 1201 } 1117 1202 1118 if ( x && y&& ( sel = ias.getSelection() ) ) {1203 if ( ( ( x && y ) || ( xS && yS ) ) && ( sel = ias.getSelection() ) ) { 1119 1204 x2 = sel.x1 + Math.round( x * sizer ); 1120 1205 y2 = sel.y1 + Math.round( y * sizer ); 1121 x1 = sel.x1;1122 y1 = sel.y1;1206 x1 = ( xS === sel.x1 ) ? sel.x1 : Math.round( xS * sizer ); 1207 y1 = ( yS === sel.y1 ) ? sel.y1 : Math.round( yS * sizer ); 1123 1208 1124 1209 if ( x2 > imgw ) { 1125 1210 x1 = 0; … … 1205 1290 1206 1291 if ( r > h ) { 1207 1292 r = h; 1293 var errorMessage = __( 'Selected crop ratio exceeds the boundaries of the image. Try a different ratio.' ); 1294 1295 $( '#imgedit-crop-' + postid ) 1296 .prepend( '<div class="notice notice-error" tabindex="-1" role="alert"><p>' + errorMessage + '</p></div>' ); 1297 1298 wp.a11y.speak( errorMessage, 'assertive' ); 1208 1299 if ( n ) { 1209 $('#imgedit-crop-height-' + postid).val( '');1300 $('#imgedit-crop-height-' + postid).val( '' ); 1210 1301 } else { 1211 $('#imgedit-crop-width-' + postid).val( '');1302 $('#imgedit-crop-width-' + postid).val( ''); 1212 1303 } 1304 } else { 1305 var error = $( '#imgedit-crop-' + postid ).find( '.notice-error' ); 1306 if ( 'undefined' !== typeof( error ) ) { 1307 error.remove(); 1308 } 1213 1309 } 1214 1310 1215 1311 this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r ); … … 1231 1327 * void when it is. 1232 1328 */ 1233 1329 validateNumeric: function( el ) { 1234 if ( !this.intval( $( el ).val() ) ) {1330 if ( false === this.intval( $( el ).val() ) ) { 1235 1331 $( el ).val( '' ); 1236 1332 return false; 1237 1333 } -
src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js
956 956 * default 5px 957 957 */ 958 958 if (!parseInt($handles.css('width')) >= 0) 959 $handles.width( 5).height(5);959 $handles.width(10).height(10); 960 960 961 961 /* 962 962 * If the borderWidth option is in use, add a solid border to -
src/wp-admin/css/common.css
191 191 .wp-editor-container, 192 192 .popular-tags, 193 193 .feature-filter, 194 .imgedit-group,195 194 .comment-ays { 196 195 border: 1px solid #c3c4c7; 197 196 box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); … … 204 203 .widgets-holder-wrap, 205 204 .popular-tags, 206 205 .feature-filter, 207 .imgedit-group,208 206 .comment-ays { 209 207 background: #fff; 210 208 } -
src/wp-admin/css/media.css
877 877 padding-top: 10px; 878 878 } 879 879 880 .im gedit-settingsp,881 .im gedit-settingsfieldset {880 .image-editor p, 881 .image-editor fieldset { 882 882 margin: 8px 0; 883 883 } 884 884 885 .im gedit-settingslegend {885 .image-editor legend { 886 886 margin-bottom: 5px; 887 887 } 888 888 889 .describe .imgedit-wrap .im gedit-settings{889 .describe .imgedit-wrap .image-editor { 890 890 padding: 0 5px; 891 891 } 892 892 … … 898 898 height: auto; 899 899 } 900 900 901 .wp_attachment_holder .imgedit-wrap .imgedit-panel-content { 902 float: left; 903 padding: 3px 16px 0 0; 904 min-width: 400px; 905 max-width: calc( 100% - 266px ); 901 .imgedit-panel-content { 902 display: grid; 903 grid-template-columns: 640px 1fr; 904 gap: 20px; 906 905 } 907 906 908 .wp_attachment_holder .imgedit-wrap .imgedit-settings { 907 @media screen and (max-width: 1120px) { 908 .imgedit-panel-content { 909 grid-template-columns: 1fr; 910 } 911 } 912 913 .imgedit-settings { 914 max-width: 400px; /* Prevent reflow when help info is expanded. */ 915 } 916 917 .imgedit-group-controls > * { 918 display: none; 919 } 920 921 .imgedit-panel-active .imgedit-group-controls > * { 922 display: block; 923 } 924 925 .wp_attachment_holder .imgedit-wrap .image-editor { 909 926 float: right; 910 927 width: 250px; 911 928 } 912 929 913 .im gedit-settingsinput {930 .image-editor input { 914 931 margin-top: 0; 915 932 vertical-align: middle; 916 933 } … … 945 962 } 946 963 947 964 .media-disabled, 948 .im gedit-settings.disabled {965 .image-editor .disabled { 949 966 /* WCAG 1.4.3 Text or images of text that are part of an inactive user 950 967 interface component ... have no contrast requirement. */ 951 968 color: #a7aaad; … … 969 986 float: left; 970 987 } 971 988 972 .imgedit-menu {973 margin: 0 0 12px;974 }975 976 989 .imgedit-menu .note-no-rotate { 977 990 clear: both; 978 991 margin: 0; … … 985 998 min-height: 28px; 986 999 font-size: 13px; 987 1000 line-height: 2; 988 margin: 0 8px 8px 0;989 1001 padding: 0 10px; 990 1002 } 991 1003 … … 1014 1026 content: "\f165"; 1015 1027 } 1016 1028 1029 .imgedit-scale:before { 1030 content: "\f211"; 1031 } 1032 1017 1033 .imgedit-rleft:before { 1018 1034 content: "\f166"; 1019 1035 } … … 1048 1064 background-size: 20px 20px; 1049 1065 } 1050 1066 1067 .imgedit-crop-wrap { 1068 padding: 20px; 1069 background-image: linear-gradient(45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7), linear-gradient(45deg, #c3c4c7 25%, transparent 25%, transparent 75%, #c3c4c7 75%, #c3c4c7); 1070 background-position: 0 0, 10px 10px; 1071 background-size: 20px 20px; 1072 } 1073 1074 1051 1075 .imgedit-crop { 1052 1076 margin: 0 8px 0 0; 1053 1077 } … … 1076 1100 margin: 0 8px 0 3px; 1077 1101 } 1078 1102 1103 .imgedit-thumbnail-preview-group { 1104 display: flex; 1105 flex-wrap: wrap; 1106 column-gap: 10px; 1107 } 1108 1079 1109 .imgedit-thumbnail-preview { 1080 1110 margin: 10px 8px 0 0; 1081 1111 } … … 1139 1169 padding: 0; 1140 1170 } 1141 1171 1142 .imgedit-submit {1143 margin: 8px 0 0;1144 }1145 1146 1172 .imgedit-submit-btn { 1147 1173 margin-left: 20px; 1148 1174 } … … 1173 1199 } 1174 1200 1175 1201 .imgedit-group { 1176 margin-bottom: 8px; 1177 padding: 10px; 1202 margin-bottom: 20px; 1178 1203 } 1179 1204 1180 .im gedit-settings.imgedit-original-dimensions {1205 .image-editor .imgedit-original-dimensions { 1181 1206 display: inline-block; 1182 1207 } 1183 1208 1184 .im gedit-settings .imgedit-scaleinput[type="text"],1185 .im gedit-settings.imgedit-crop-ratio input[type="text"],1186 .im gedit-settings.imgedit-crop-sel input[type="text"] {1209 .image-editor .imgedit-scale-controls input[type="text"], 1210 .image-editor .imgedit-crop-ratio input[type="text"], 1211 .image-editor .imgedit-crop-sel input[type="text"] { 1187 1212 width: 80px; 1188 1213 font-size: 14px; 1189 1214 padding: 0 8px; … … 1197 1222 color: #3c434a; 1198 1223 } 1199 1224 1200 .im gedit-settings.imgedit-scale-button-wrapper {1225 .image-editor .imgedit-scale-button-wrapper { 1201 1226 margin-top: 0.3077em; 1202 1227 display: block; 1203 1228 } 1204 1229 1205 .im gedit-settings .imgedit-scale.button {1230 .image-editor .imgedit-scale-controls .button { 1206 1231 margin-bottom: 0; 1207 1232 } 1208 1233 … … 1271 1296 padding: 10px 0 10px 12px; 1272 1297 } 1273 1298 1274 .im gedit-settings.imgedit-scale input[type="text"],1275 .im gedit-settings.imgedit-crop-ratio input[type="text"],1276 .im gedit-settings.imgedit-crop-sel input[type="text"] {1299 .image-editor .imgedit-scale input[type="text"], 1300 .image-editor .imgedit-crop-ratio input[type="text"], 1301 .image-editor .imgedit-crop-sel input[type="text"] { 1277 1302 font-size: 16px; 1278 1303 padding: 6px 10px; 1279 1304 } 1280 1305 1281 1306 .wp_attachment_holder .imgedit-wrap .imgedit-panel-content, 1282 .wp_attachment_holder .imgedit-wrap .im gedit-settings{1307 .wp_attachment_holder .imgedit-wrap .image-editor { 1283 1308 float: none; 1284 1309 width: auto; 1285 1310 max-width: none; … … 1296 1321 } 1297 1322 1298 1323 .media-modal .imgedit-wrap .imgedit-panel-content, 1299 .media-modal .imgedit-wrap .im gedit-settings{1324 .media-modal .imgedit-wrap .image-editor { 1300 1325 position: initial !important; 1301 1326 } 1302 1327 1303 .media-modal .imgedit-wrap .im gedit-settings{1328 .media-modal .imgedit-wrap .image-editor { 1304 1329 box-sizing: border-box; 1305 1330 width: 100% !important; 1306 1331 } 1307 1332 1308 .im gedit-settings.imgedit-scale-button-wrapper {1333 .image-editor .imgedit-scale-button-wrapper { 1309 1334 display: inline-block; 1310 1335 } 1311 1336 } -
src/wp-admin/includes/image-edit.php
28 28 die( __( 'Image data does not exist. Please re-upload the image.' ) ); 29 29 } 30 30 31 $sizer = $big > 400 ? 400 / $big : 1;31 $sizer = $big > 600 ? 600 / $big : 1; 32 32 33 33 $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); 34 34 $can_restore = false; … … 55 55 ?> 56 56 <div class="imgedit-wrap wp-clearfix"> 57 57 <div id="imgedit-panel-<?php echo $post_id; ?>"> 58 <?php echo $note; ?> 59 <div class="imgedit-panel-content wp-clearfix" role="menu" tabindex="0" aria-label=" 60 <?php 61 // translators: Hidden accessibility text. 62 esc_attr_e( 'Image Editing Tools' ); 63 ?> 64 "> 65 <div class="imgedit-menu wp-clearfix"> 66 <button role="menuitem" type="button" onclick="imageEdit.toggleCropTool( <?php echo "$post_id, '$nonce'"; ?>, this );" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button> 67 <button role="menuitem" type="button" class="imgedit-scale button" onclick="imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-scale"><?php esc_html_e( 'Scale' ); ?></button> 58 68 59 <div class="imgedit-panel-content wp-clearfix">60 <?php echo $note; ?>61 <div class="imgedit-menu wp-clearfix">62 <button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this )" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button>63 69 <?php 64 65 70 // On some setups GD library does not provide imagerotate() - Ticket #11536. 66 71 if ( wp_image_editor_supports( 67 72 array( … … 71 76 ) ) { 72 77 $note_no_rotate = ''; 73 78 ?> 74 <button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate left' ); ?></button>75 <button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate right' ); ?></button>79 <button role="menuitem" type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate left' ); ?></button> 80 <button role="menuitem" type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><?php esc_html_e( 'Rotate right' ); ?></button> 76 81 <?php 77 82 } else { 78 83 $note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>'; 79 84 ?> 80 <button type="button" class="imgedit-rleft button disabled" disabled></button> 81 <button type="button" class="imgedit-rright button disabled" disabled></button> 82 <?php } ?> 83 84 <button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button> 85 <button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button> 86 87 <br class="imgedit-undo-redo-separator" /> 88 <button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><?php esc_html_e( 'Undo' ); ?></button> 89 <button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><?php esc_html_e( 'Redo' ); ?></button> 90 <?php echo $note_no_rotate; ?> 91 </div> 92 93 <input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" /> 94 <input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" /> 95 <input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" /> 96 <input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" /> 97 <input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> 98 <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" /> 99 100 <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap"> 101 <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" 102 src="<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=imgedit-preview&_ajax_nonce=' . $nonce . '&postid=' . $post_id . '&rand=' . rand( 1, 99999 ); ?>" alt="" /> 103 </div> 104 105 <div class="imgedit-submit"> 106 <input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e( 'Cancel' ); ?>" /> 107 <input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" /> 108 </div> 109 </div> 110 111 <div class="imgedit-settings"> 112 <div class="imgedit-group"> 113 <div class="imgedit-group-top"> 114 <h2><?php _e( 'Scale Image' ); ?></h2> 115 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 116 <?php 117 /* translators: Hidden accessibility text. */ 118 esc_html_e( 'Scale Image Help' ); 119 ?> 120 </span></button> 121 <div class="imgedit-help"> 122 <p><?php _e( 'You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up.' ); ?></p> 123 </div> 124 <?php if ( isset( $meta['width'], $meta['height'] ) ) : ?> 125 <p> 126 <?php 127 printf( 128 /* translators: %s: Image width and height in pixels. */ 129 __( 'Original dimensions %s' ), 130 '<span class="imgedit-original-dimensions">' . $meta['width'] . ' × ' . $meta['height'] . '</span>' 131 ); 132 ?> 133 </p> 134 <?php endif; ?> 135 <div class="imgedit-submit"> 136 137 <fieldset class="imgedit-scale"> 138 <legend><?php _e( 'New dimensions:' ); ?></legend> 139 <div class="nowrap"> 140 <label for="imgedit-scale-width-<?php echo $post_id; ?>" class="screen-reader-text"> 141 <?php 142 /* translators: Hidden accessibility text. */ 143 _e( 'scale width' ); 144 ?> 145 </label> 146 <input type="number" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" min="1" max="<?php echo isset( $meta['width'] ) ? $meta['width'] : ''; ?>" step="1" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onchange="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> 147 <span class="imgedit-separator" aria-hidden="true">×</span> 148 <label for="imgedit-scale-height-<?php echo $post_id; ?>" class="screen-reader-text"> 149 <?php 150 /* translators: Hidden accessibility text. */ 151 _e( 'scale height' ); 152 ?> 153 </label> 154 <input type="number" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" min="1" max="<?php echo isset( $meta['height'] ) ? $meta['height'] : ''; ?>" step="1" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onchange="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" /> 155 <div class="imgedit-scale-button-wrapper"><input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" /></div> 156 </div> 157 <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e( 'Images cannot be scaled to a size larger than the original.' ); ?></span> 158 159 </fieldset> 160 161 </div> 162 </div> 163 </div> 164 165 <?php if ( $can_restore ) { ?> 166 167 <div class="imgedit-group"> 168 <div class="imgedit-group-top"> 169 <h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link" aria-expanded="false"><?php _e( 'Restore original image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2> 170 <div class="imgedit-help imgedit-restore"> 171 <p> 172 <?php 173 _e( 'Discard any changes and restore the original image.' ); 174 175 if ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) { 176 echo ' ' . __( 'Previously edited copies of the image will not be deleted.' ); 85 <button role="menuitem" type="button" class="imgedit-rleft button disabled" disabled></button> 86 <button role="menuitem" type="button" class="imgedit-rright button disabled" disabled></button> 87 <?php 177 88 } 178 89 ?> 179 </p> 180 <div class="imgedit-submit"> 181 <input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> /> 90 <button role="menuitem" type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><?php esc_html_e( 'Flip vertical' ); ?></button> 91 <button role="menuitem" type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><?php esc_html_e( 'Flip horizontal' ); ?></button> 92 <?php echo $note_no_rotate; ?> 93 </div> 94 <div class="imgedit-submit imgedit-menu"> 95 <button role="menuitem" type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><?php esc_html_e( 'Undo' ); ?></button> 96 <button role="menuitem" type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><?php esc_html_e( 'Redo' ); ?></button> 97 <button role="menuitem" type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn"><?php esc_html_e( 'Cancel Editing' ); ?></button> 98 <button role="menuitem" type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn"><?php esc_html_e( 'Save Edits' ); ?></button> 182 99 </div> 183 </div>184 100 </div> 185 </div>186 101 187 <?php } ?> 102 <div class="imgedit-panel-content wp-clearfix"> 103 <div class="imgedit-tools"> 104 <input type="hidden" id="imgedit-nonce-<?php echo $post_id; ?>" value="<?php echo $nonce; ?>" /> 105 <input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" /> 106 <input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" /> 107 <input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" /> 108 <input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" /> 109 <input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> 110 <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" /> 188 111 189 <div class="imgedit-group"> 190 <div class="imgedit-group-top"> 191 <h2><?php _e( 'Image Crop' ); ?></h2> 192 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 193 <?php 194 /* translators: Hidden accessibility text. */ 195 esc_html_e( 'Image Crop Help' ); 196 ?> 197 </span></button> 198 199 <div class="imgedit-help"> 200 <p><?php _e( 'To crop the image, click on it and drag to make your selection.' ); ?></p> 201 202 <p><strong><?php _e( 'Crop Aspect Ratio' ); ?></strong><br /> 203 <?php _e( 'The aspect ratio is the relationship between the width and height. You can preserve the aspect ratio by holding down the shift key while resizing your selection. Use the input box to specify the aspect ratio, e.g. 1:1 (square), 4:3, 16:9, etc.' ); ?></p> 204 205 <p><strong><?php _e( 'Crop Selection' ); ?></strong><br /> 206 <?php _e( 'Once you have made your selection, you can adjust it by entering the size in pixels. The minimum selection size is the thumbnail size as set in the Media settings.' ); ?></p> 112 <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap"> 113 <div class="imgedit-crop-grid"></div> 114 <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" 115 src="<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=imgedit-preview&_ajax_nonce=' . $nonce . '&postid=' . $post_id . '&rand=' . rand( 1, 99999 ); ?>" alt="" /> 116 </div> 207 117 </div> 208 </div> 118 <div class="imgedit-settings"> 119 <div class="imgedit-tool-active"> 120 <div class="imgedit-group"> 121 <div id="imgedit-scale" tabindex="-1" class="imgedit-group-controls"> 122 <div class="imgedit-group-top"> 123 <h2><?php _e( 'Scale Image' ); ?></h2> 124 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 125 <?php 126 /* translators: Hidden accessibility text. */ 127 esc_html_e( 'Scale Image Help' ); 128 ?> 129 </span></button> 130 <div class="imgedit-help"> 131 <p><?php _e( 'You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up.' ); ?></p> 132 </div> 133 <?php if ( isset( $meta['width'], $meta['height'] ) ) : ?> 134 <p> 135 <?php 136 printf( 137 /* translators: %s: Image width and height in pixels. */ 138 __( 'Original dimensions %s' ), 139 '<span class="imgedit-original-dimensions">' . $meta['width'] . ' × ' . $meta['height'] . '</span>' 140 ); 141 ?> 142 </p> 143 <?php endif; ?> 144 <div class="imgedit-submit"> 145 <fieldset class="imgedit-scale-controls"> 146 <legend><?php _e( 'New dimensions:' ); ?></legend> 147 <div class="nowrap"> 148 <label for="imgedit-scale-width-<?php echo $post_id; ?>" class="screen-reader-text"> 149 <?php 150 /* translators: Hidden accessibility text. */ 151 _e( 'scale height' ); 152 ?> 153 </label> 154 <input type="number" step="1" min="0" max="<?php echo isset( $meta['width'] ) ? $meta['width'] : ''; ?>" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> 155 <span class="imgedit-separator" aria-hidden="true">×</span> 156 <label for="imgedit-scale-height-<?php echo $post_id; ?>" class="screen-reader-text"><?php _e( 'scale height' ); ?></label> 157 <input type="number" step="1" min="0" max="<?php echo isset( $meta['height'] ) ? $meta['width'] : ''; ?>" aria-describedby="imgedit-scale-warn-<?php echo $post_id; ?>" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" /> 158 <button id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary"><?php esc_html_e( 'Scale' ); ?></button> 159 <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>"><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e( 'Images cannot be scaled to a size larger than the original.' ); ?></span> 160 </div> 161 </fieldset> 162 </div> 163 </div> 164 </div> 165 </div> 209 166 210 <fieldset class="imgedit-crop-ratio"> 211 <legend><?php _e( 'Aspect ratio:' ); ?></legend> 212 <div class="nowrap"> 213 <label for="imgedit-crop-width-<?php echo $post_id; ?>" class="screen-reader-text"> 214 <?php 215 /* translators: Hidden accessibility text. */ 216 _e( 'crop ratio width' ); 217 ?> 218 </label> 219 <input type="text" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" /> 220 <span class="imgedit-separator" aria-hidden="true">:</span> 221 <label for="imgedit-crop-height-<?php echo $post_id; ?>" class="screen-reader-text"> 222 <?php 223 /* translators: Hidden accessibility text. */ 224 _e( 'crop ratio height' ); 225 ?> 226 </label> 227 <input type="text" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" /> 228 </div> 229 </fieldset> 167 <?php if ( $can_restore ) { ?> 168 <div class="imgedit-group"> 169 <div class="imgedit-group-top"> 170 <h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link" aria-expanded="false"><?php _e( 'Restore original image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2> 171 <div class="imgedit-help imgedit-restore"> 172 <p> 173 <?php 174 _e( 'Discard any changes and restore the original image.' ); 175 if ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) { 176 echo ' ' . __( 'Previously edited copies of the image will not be deleted.' ); 177 } 178 ?> 179 </p> 180 <div class="imgedit-submit"> 181 <input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> /> 182 </div> 183 </div> 184 </div> 185 </div> 186 <?php } ?> 187 <div class="imgedit-group"> 188 <div id="imgedit-crop" tabindex="-1" class="imgedit-group-controls"> 189 <div class="imgedit-group-top"> 190 <h2><?php _e( 'Crop Image' ); ?></h2> 191 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 192 <?php 193 /* translators: Hidden accessibility text. */ 194 _e( 'Image Crop Help' ); 195 ?> 196 </span></button> 197 <div class="imgedit-help"> 198 <p><?php _e( 'To crop the image, click on it and drag to make your selection.' ); ?></p> 199 <p><strong><?php _e( 'Crop Aspect Ratio' ); ?></strong><br /> 200 <?php _e( 'The aspect ratio is the relationship between the width and height. You can preserve the aspect ratio by holding down the shift key while resizing your selection. Use the input box to specify the aspect ratio, e.g. 1:1 (square), 4:3, 16:9, etc.' ); ?></p> 230 201 231 <fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel"> 232 <legend><?php _e( 'Selection:' ); ?></legend> 233 <div class="nowrap"> 234 <label for="imgedit-sel-width-<?php echo $post_id; ?>" class="screen-reader-text"> 235 <?php 236 /* translators: Hidden accessibility text. */ 237 _e( 'selection width' ); 238 ?> 239 </label> 240 <input type="text" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" /> 241 <span class="imgedit-separator" aria-hidden="true">×</span> 242 <label for="imgedit-sel-height-<?php echo $post_id; ?>" class="screen-reader-text"> 243 <?php 244 /* translators: Hidden accessibility text. */ 245 _e( 'selection height' ); 246 ?> 247 </label> 248 <input type="text" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" /> 202 <p><strong><?php _e( 'Crop Selection' ); ?></strong><br /> 203 <?php _e( 'Once you have made your selection, you can adjust it by entering the size in pixels. The minimum selection size is the thumbnail size as set in the Media settings.' ); ?></p> 204 </div> 205 </div> 206 <fieldset class="imgedit-crop-ratio"> 207 <legend><?php _e( 'Aspect ratio:' ); ?></legend> 208 <div class="nowrap"> 209 <label for="imgedit-crop-width-<?php echo $post_id; ?>" class="screen-reader-text"> 210 <?php 211 /* translators: Hidden accessibility text. */ 212 _e( 'crop ratio width' ); 213 ?> 214 </label> 215 <input type="number" step="1" min="1" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" /> 216 <span class="imgedit-separator" aria-hidden="true">:</span> 217 <label for="imgedit-crop-height-<?php echo $post_id; ?>" class="screen-reader-text"> 218 <?php 219 /* translators: Hidden accessibility text. */ 220 _e( 'crop ratio height' ); 221 ?> 222 </label> 223 <input type="number" step="1" min="0" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" /> 224 </div> 225 </fieldset> 226 <fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel"> 227 <legend><?php _e( 'Selection:' ); ?></legend> 228 <div class="nowrap"> 229 <label for="imgedit-sel-width-<?php echo $post_id; ?>" class="screen-reader-text"> 230 <?php 231 /* translators: Hidden accessibility text. */ 232 _e( 'selection width' ); 233 ?> 234 </label> 235 <input type="number" step="1" min="0" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" /> 236 <span class="imgedit-separator" aria-hidden="true">×</span> 237 <label for="imgedit-sel-height-<?php echo $post_id; ?>" class="screen-reader-text"> 238 <?php 239 /* translators: Hidden accessibility text. */ 240 _e( 'selection height' ); 241 ?> 242 </label> 243 <input type="number" step="1" min="0" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" /> 244 </div> 245 </fieldset> 246 <fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel"> 247 <legend><?php _e( 'Starting Coordinates:' ); ?></legend> 248 <div class="nowrap"> 249 <label for="imgedit-start-x-<?php echo $post_id; ?>" class="screen-reader-text"> 250 <?php 251 /* translators: Hidden accessibility text. */ 252 _e( 'horizontal start position' ); 253 ?> 254 </label> 255 <input type="number" step="1" min="0" id="imgedit-start-x-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" value="0" /> 256 <span class="imgedit-separator" aria-hidden="true">×</span> 257 <label for="imgedit-start-y-<?php echo $post_id; ?>" class="screen-reader-text"> 258 <?php 259 /* translators: Hidden accessibility text. */ 260 _e( 'vertical start position' ); 261 ?> 262 </label> 263 <input type="number" step="1" min="0" id="imgedit-start-y-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" value="0" /> 264 </div> 265 </fieldset> 266 <div class="imgedit-crop-apply imgedit-menu container"> 267 <button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this );" class="imgedit-crop-apply button"><?php esc_html_e( 'Apply Crop' ); ?></button> <button type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this );" class="imgedit-crop-clear button" disabled="disabled"><?php esc_html_e( 'Clear Crop' ); ?></button> 268 </div> 269 </div> 249 270 </div> 250 </fieldset>251 252 271 </div> 253 272 254 273 <?php … … 257 276 ?> 258 277 259 278 <div class="imgedit-group imgedit-applyto"> 260 <div class="imgedit-group-top">261 <h2><?php _e( 'Thumbnail Settings' ); ?></h2>262 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">279 <div class="imgedit-group-top"> 280 <h2><?php _e( 'Thumbnail Settings' ); ?></h2> 281 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 263 282 <?php 264 283 /* translators: Hidden accessibility text. */ 265 284 esc_html_e( 'Thumbnail Settings Help' ); 266 285 ?> 267 </span></button> 268 <div class="imgedit-help"> 269 <p><?php _e( 'You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.' ); ?></p> 286 </span></button> 287 <div class="imgedit-help"> 288 <p><?php _e( 'You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.' ); ?></p> 289 </div> 270 290 </div> 271 </div> 291 <div class="imgedit-thumbnail-preview-group"> 292 <figure class="imgedit-thumbnail-preview"> 293 <img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" /> 294 <figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption> 295 </figure> 296 <div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target"> 297 <fieldset> 298 <legend><?php _e( 'Apply changes to:' ); ?></legend> 272 299 273 <figure class="imgedit-thumbnail-preview">274 <img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />275 <figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>276 </figure>300 <span class="imgedit-label"> 301 <input type="radio" id="imgedit-target-all" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" /> 302 <label for="imgedit-target-all"><?php _e( 'All image sizes' ); ?></label> 303 </span> 277 304 278 <div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target"> 279 <fieldset> 280 <legend><?php _e( 'Apply changes to:' ); ?></legend> 305 <span class="imgedit-label"> 306 <input type="radio" id="imgedit-target-thumbnail" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" /> 307 <label for="imgedit-target-thumbnail"><?php _e( 'Thumbnail' ); ?></label> 308 </span> 309 310 <span class="imgedit-label"> 311 <input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> 312 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> 313 </span> 281 314 282 <span class="imgedit-label"> 283 <input type="radio" id="imgedit-target-all" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" /> 284 <label for="imgedit-target-all"><?php _e( 'All image sizes' ); ?></label> 285 </span> 286 287 <span class="imgedit-label"> 288 <input type="radio" id="imgedit-target-thumbnail" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" /> 289 <label for="imgedit-target-thumbnail"><?php _e( 'Thumbnail' ); ?></label> 290 </span> 291 292 <span class="imgedit-label"> 293 <input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> 294 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> 295 </span> 296 <?php 297 if ( $edit_custom_sizes ) { 298 if ( ! is_array( $edit_custom_sizes ) ) { 299 $edit_custom_sizes = get_intermediate_image_sizes(); 300 } 301 foreach ( array_unique( $edit_custom_sizes ) as $key => $size ) { 302 if ( array_key_exists( $size, $meta['sizes'] ) ) { 303 if ( 'thumbnail' === $size ) { 304 continue; 315 <?php 316 if ( $edit_custom_sizes ) { 317 if ( ! is_array( $edit_custom_sizes ) ) { 318 $edit_custom_sizes = get_intermediate_image_sizes(); 305 319 } 306 ?> 307 <span class="imgedit-label"> 308 <input type="radio" id="imgedit-target-custom<?php echo esc_attr( $key ); ?>" name="imgedit-target-<?php echo $post_id; ?>" value="<?php echo esc_attr( $size ); ?>" /> 309 <label for="imgedit-target-custom<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $size ); ?></label> 310 </span> 311 <?php 320 foreach ( array_unique( $edit_custom_sizes ) as $key => $size ) { 321 if ( array_key_exists( $size, $meta['sizes'] ) ) { 322 if ( 'thumbnail' === $size ) { 323 continue; 324 } 325 ?> 326 <span class="imgedit-label"> 327 <input type="radio" id="imgedit-target-custom<?php echo esc_attr( $key ); ?>" name="imgedit-target-<?php echo $post_id; ?>" value="<?php echo esc_attr( $size ); ?>" /> 328 <label for="imgedit-target-custom<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $size ); ?></label> 329 </span> 330 <?php 331 } 332 } 312 333 } 313 }314 }315 ?>316 </fieldset>334 ?> 335 </fieldset> 336 </div> 337 </div> 317 338 </div> 339 <?php } ?> 340 </div> 318 341 </div> 319 342 320 <?php } ?>321 322 343 </div> 344 <div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div> 345 <div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>"><?php _e( "There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor." ); ?></div> 323 346 324 347 </div> 325 348 <div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div> … … 509 532 */ 510 533 function _image_get_preview_ratio( $w, $h ) { 511 534 $max = max( $w, $h ); 512 return $max > 400 ? ( 400 / $max ) : 1;535 return $max > 600 ? ( 600 / $max ) : 1; 513 536 } 514 537 515 538 /** -
src/wp-includes/css/media-views.css
1959 1959 1960 1960 .media-modal .imgedit-wrap .imgedit-panel-content { 1961 1961 padding: 16px 16px 0; 1962 position: absolute;1963 top: 0;1964 right: 282px;1965 bottom: 0;1966 left: 0;1967 1962 overflow: auto; 1968 1963 } 1969 1964 … … 1971 1966 * Implementation of bottom padding in overflow content differs across browsers. 1972 1967 * We need a different method. See https://github.com/w3c/csswg-drafts/issues/129 1973 1968 */ 1974 .media-modal .imgedit-wrap .imgedit-submit {1975 margin-bottom: 16px;1976 }1977 1978 .media-modal .imgedit-wrap .imgedit-settings {1979 background: #f6f7f7;1980 border-left: 1px solid #dcdcde;1981 padding: 20px 16px 0;1982 position: absolute;1983 top: 0;1984 right: 0;1985 bottom: 0;1986 width: 250px;1987 overflow: auto;1988 }1989 1990 /*1991 * Implementation of bottom padding in overflow content differs across browsers.1992 * We need a different method. See https://github.com/w3c/csswg-drafts/issues/1291993 */1994 1969 .media-modal .imgedit-wrap .imgedit-save-target { 1995 1970 margin: 8px 0 24px; 1996 1971 } … … 1998 1973 .media-modal .imgedit-group { 1999 1974 background: none; 2000 1975 border: none; 2001 border-bottom: 1px solid #dcdcde;2002 1976 box-shadow: none; 2003 1977 margin: 0; 2004 margin-bottom: 16px;2005 1978 padding: 0; 2006 padding-bottom: 16px;2007 1979 position: relative; /* RTL fix, #WP29352 */ 2008 1980 } 2009 1981 2010 .media-modal .imgedit-group:last-of-type { 2011 border: none; 2012 margin: 0; 2013 padding: 0; 1982 .media-modal .imgedit-group.imgedit-panel-active { 1983 margin-bottom: 16px; 1984 padding-bottom: 16px; 2014 1985 } 2015 1986 2016 1987 .media-modal .imgedit-group-top { … … 2079 2050 2080 2051 .media-modal .imgedit-wrap div.updated, /* Back-compat for pre-5.5 */ 2081 2052 .media-modal .imgedit-wrap .notice { 2082 margin: 0; 2083 margin-bottom: 16px; 2053 margin: 0 16px; 2084 2054 } 2085 2055 2086 2056 /** … … 2819 2789 } 2820 2790 2821 2791 @media screen and (max-width: 782px) { 2792 .imgedit-panel-content { 2793 grid-template-columns: auto; 2794 } 2795 2822 2796 .attachments-browser .media-toolbar { 2823 2797 height: 82px; 2824 2798 }