Ticket #50523: 50523.7.diff
| File 50523.7.diff, 89.2 KB (added by , 3 years ago) |
|---|
-
src/js/_enqueues/lib/image-edit.js
34 34 selection = this.iasapi.getSelection(); 35 35 } 36 36 37 if ( ! cropButton.classList.contains( 'imgedit-crop-clear' ) ) { 38 imageEdit.setDisabled($('.imgedit-crop-clear'), 1); 39 } else { 40 imageEdit.setDisabled($('.imgedit-crop-clear'), 0); 41 } 42 37 43 // If we don't already have a selection, select the entire image. 38 44 if ( 0 === selection.x1 && 0 === selection.y1 && 0 === selection.x2 && 0 === selection.y2 ) { 39 45 this.iasapi.setSelection( 0, 0, img.innerWidth(), img.innerHeight(), true ); … … 41 47 this.iasapi.update(); 42 48 } else { 43 49 44 // Otherwise, perform the crop. 45 imageEdit.crop( postid, nonce , cropButton ); 50 if ( cropButton.classList.contains( 'imgedit-crop-clear' ) ) { 51 this.iasapi.cancelSelection(); 52 imageEdit.setDisabled($('.imgedit-crop-apply'), 0); 53 54 $('#imgedit-sel-width-' + postid).val(''); 55 $('#imgedit-sel-height-' + postid).val(''); 56 $('#imgedit-start-x-' + postid).val('0'); 57 $('#imgedit-start-y-' + postid).val('0'); 58 $('#imgedit-selection-' + postid).val(''); 59 } else { 60 // Otherwise, perform the crop. 61 imageEdit.crop( postid, nonce , cropButton ); 62 } 46 63 } 47 64 }, 48 65 … … 122 139 t.postid = postid; 123 140 $('#imgedit-response-' + postid).empty(); 124 141 142 $('#imgedit-panel-' + postid).on( 'keypress', function(e) { 143 var nonce = $( '#imgedit-nonce-' + postid ).val(); 144 if ( e.which === 26 && e.ctrlKey ) { 145 imageEdit.undo( postid, nonce ); 146 } 147 148 if ( e.which === 25 && e.ctrlKey ) { 149 imageEdit.redo( postid, nonce ); 150 } 151 }); 152 125 153 $('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) { 126 154 var k = e.keyCode; 127 155 … … 190 218 }, 191 219 192 220 /** 221 * Shows or hides image edit input fields when enabled. 222 * 223 * @since 6.1.0 224 * 225 * @memberof imageEdit 226 * 227 * @param {HTMLElement} el The element to trigger the edit panel. 228 * 229 * @return {boolean} Always returns false. 230 */ 231 toggleControls : function(el) { 232 var $el = $( el ); 233 var $target = $( '#' + $el.attr( 'aria-controls' ) ); 234 $el 235 .attr( 'aria-expanded', 'false' === $el.attr( 'aria-expanded' ) ? 'true' : 'false' ); 236 $target 237 .parent( '.imgedit-group' ).toggleClass( 'imgedit-panel-active' ); 238 239 return false; 240 }, 241 242 /** 193 243 * Gets the value from the image edit target. 194 244 * 195 245 * The image edit target contains the image sizes where the (possible) changes … … 402 452 } 403 453 404 454 if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) { 405 $(' input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);455 $('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false); 406 456 } else { 407 $(' input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);457 $('button.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); 408 458 } 409 459 410 460 t.toggleEditor(postid, 0); … … 710 760 var t = this, 711 761 selW = $('#imgedit-sel-width-' + postid), 712 762 selH = $('#imgedit-sel-height-' + postid), 763 selX = $('#imgedit-start-x-' + postid), 764 selY = $('#imgedit-start-y-' + postid), 713 765 $image = $( image ), 714 766 $img; 715 767 … … 768 820 */ 769 821 onSelectStart: function() { 770 822 imageEdit.setDisabled($('#imgedit-crop-sel-' + postid), 1); 823 imageEdit.setDisabled($('.imgedit-crop-clear'), 1); 824 imageEdit.setDisabled($('.imgedit-crop-apply'), 1); 771 825 }, 772 826 /** 773 827 * Event triggered when the selection is ended. … … 781 835 */ 782 836 onSelectEnd: function(img, c) { 783 837 imageEdit.setCropSelection(postid, c); 838 if ( ! $('#imgedit-crop > *').is(':visible') ) { 839 imageEdit.toggleControls($('.imgedit-crop.button')); 840 } 784 841 }, 785 842 786 843 /** … … 797 854 var sizer = imageEdit.hold.sizer; 798 855 selW.val( imageEdit.round(c.width / sizer) ); 799 856 selH.val( imageEdit.round(c.height / sizer) ); 857 selX.val( imageEdit.round(c.x1 / sizer) ); 858 selY.val( imageEdit.round(c.y1 / sizer) ); 800 859 } 801 860 }); 802 861 }, … … 823 882 this.setDisabled( $( '#imgedit-crop-sel-' + postid ), 1 ); 824 883 $('#imgedit-sel-width-' + postid).val(''); 825 884 $('#imgedit-sel-height-' + postid).val(''); 885 $('#imgedit-start-x-' + postid).val('0'); 886 $('#imgedit-start-y-' + postid).val('0'); 826 887 $('#imgedit-selection-' + postid).val(''); 827 888 return false; 828 889 } … … 1011 1072 // Clear the selection fields after cropping. 1012 1073 $('#imgedit-sel-width-' + postid).val(''); 1013 1074 $('#imgedit-sel-height-' + postid).val(''); 1075 $('#imgedit-start-x-' + postid).val('0'); 1076 $('#imgedit-start-y-' + postid).val('0'); 1014 1077 }, 1015 1078 1016 1079 /** … … 1094 1157 */ 1095 1158 setNumSelection : function( postid, el ) { 1096 1159 var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid), 1160 elX1 = $('#imgedit-start-x-' + postid), elY1 = $('#imgedit-start-y-' + postid), 1161 xS = this.intval( elX1.val() ), yS = this.intval( elY1.val() ), 1097 1162 x = this.intval( elX.val() ), y = this.intval( elY.val() ), 1098 1163 img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(), 1099 1164 sizer = this.hold.sizer, x1, y1, x2, y2, ias = this.iasapi; … … 1112 1177 return false; 1113 1178 } 1114 1179 1115 if ( x && y&& ( sel = ias.getSelection() ) ) {1180 if ( ( ( x && y ) || ( xS && yS ) ) && ( sel = ias.getSelection() ) ) { 1116 1181 x2 = sel.x1 + Math.round( x * sizer ); 1117 1182 y2 = sel.y1 + Math.round( y * sizer ); 1118 x1 = sel.x1;1119 y1 = sel.y1;1183 x1 = ( xS === sel.x1 ) ? sel.x1 : Math.round( xS * sizer ); 1184 y1 = ( yS === sel.y1 ) ? sel.y1 : Math.round( yS * sizer ); 1120 1185 1121 1186 if ( x2 > imgw ) { 1122 1187 x1 = 0; … … 1202 1267 1203 1268 if ( r > h ) { 1204 1269 r = h; 1270 var errorMessage = __( 'Selected crop ratio exceeds the boundaries of the image. Try a different ratio.' ); 1271 1272 $( '#imgedit-crop-' + postid ) 1273 .prepend( '<div class="notice notice-error" tabindex="-1" role="alert"><p>' + errorMessage + '</p></div>' ); 1274 1275 wp.a11y.speak( errorMessage, 'assertive' ); 1205 1276 if ( n ) { 1206 $('#imgedit-crop-height-' + postid).val( '');1277 $('#imgedit-crop-height-' + postid).val( '' ); 1207 1278 } else { 1208 $('#imgedit-crop-width-' + postid).val( '');1279 $('#imgedit-crop-width-' + postid).val( ''); 1209 1280 } 1281 } else { 1282 var error = $( '#imgedit-crop-' + postid ).find( '.notice-error' ); 1283 if ( 'undefined' !== typeof( error ) ) { 1284 error.remove(); 1285 } 1210 1286 } 1211 1287 1212 1288 this.iasapi.setSelection( sel.x1, sel.y1, sel.x2, r ); … … 1228 1304 * void when it is. 1229 1305 */ 1230 1306 validateNumeric: function( el ) { 1231 if ( !this.intval( $( el ).val() ) ) {1307 if ( false === this.intval( $( el ).val() ) ) { 1232 1308 $( el ).val( '' ); 1233 1309 return false; 1234 1310 } -
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 } … … 1170 1196 } 1171 1197 1172 1198 .imgedit-group { 1173 margin-bottom: 8px; 1174 padding: 10px; 1199 margin-bottom: 20px; 1175 1200 } 1176 1201 1177 .im gedit-settings.imgedit-original-dimensions {1202 .image-editor .imgedit-original-dimensions { 1178 1203 display: inline-block; 1179 1204 } 1180 1205 1181 .im gedit-settings .imgedit-scaleinput[type="text"],1182 .im gedit-settings.imgedit-crop-ratio input[type="text"],1183 .im gedit-settings.imgedit-crop-sel input[type="text"] {1206 .image-editor .imgedit-scale-controls input[type="text"], 1207 .image-editor .imgedit-crop-ratio input[type="text"], 1208 .image-editor .imgedit-crop-sel input[type="text"] { 1184 1209 width: 80px; 1185 1210 font-size: 14px; 1186 1211 padding: 0 8px; … … 1194 1219 color: #3c434a; 1195 1220 } 1196 1221 1197 .im gedit-settings.imgedit-scale-button-wrapper {1222 .image-editor .imgedit-scale-button-wrapper { 1198 1223 margin-top: 0.3077em; 1199 1224 display: block; 1200 1225 } 1201 1226 1202 .im gedit-settings .imgedit-scale.button {1227 .image-editor .imgedit-scale-controls .button { 1203 1228 margin-bottom: 0; 1204 1229 } 1205 1230 … … 1268 1293 padding: 10px 0 10px 12px; 1269 1294 } 1270 1295 1271 .im gedit-settings.imgedit-scale input[type="text"],1272 .im gedit-settings.imgedit-crop-ratio input[type="text"],1273 .im gedit-settings.imgedit-crop-sel input[type="text"] {1296 .image-editor .imgedit-scale input[type="text"], 1297 .image-editor .imgedit-crop-ratio input[type="text"], 1298 .image-editor .imgedit-crop-sel input[type="text"] { 1274 1299 font-size: 16px; 1275 1300 padding: 6px 10px; 1276 1301 } 1277 1302 1278 1303 .wp_attachment_holder .imgedit-wrap .imgedit-panel-content, 1279 .wp_attachment_holder .imgedit-wrap .im gedit-settings{1304 .wp_attachment_holder .imgedit-wrap .image-editor { 1280 1305 float: none; 1281 1306 width: auto; 1282 1307 max-width: none; … … 1293 1318 } 1294 1319 1295 1320 .media-modal .imgedit-wrap .imgedit-panel-content, 1296 .media-modal .imgedit-wrap .im gedit-settings{1321 .media-modal .imgedit-wrap .image-editor { 1297 1322 position: initial !important; 1298 1323 } 1299 1324 1300 .media-modal .imgedit-wrap .im gedit-settings{1325 .media-modal .imgedit-wrap .image-editor { 1301 1326 box-sizing: border-box; 1302 1327 width: 100% !important; 1303 1328 } 1304 1329 1305 .im gedit-settings.imgedit-scale-button-wrapper {1330 .image-editor .imgedit-scale-button-wrapper { 1306 1331 display: inline-block; 1307 1332 } 1308 1333 } -
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 <div class="imgedit-panel-content wp-clearfix" role="menu" tabindex="0" aria-label=" 59 <?php 60 // translators: Hidden accessibility text. 61 esc_attr_e( 'Image Editing Tools' ); 62 ?> 63 "> 64 <div class="imgedit-menu wp-clearfix"> 65 <button role="menuitem" type="button" onclick="imageEdit.handleCropToolClick( <?php echo "$post_id, '$nonce'"; ?>, this );imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button> 66 <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 67 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 68 <?php 64 65 69 // On some setups GD library does not provide imagerotate() - Ticket #11536. 66 70 if ( wp_image_editor_supports( 67 71 array( … … 71 75 ) ) { 72 76 $note_no_rotate = ''; 73 77 ?> 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>78 <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> 79 <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 80 <?php 77 81 } else { 78 82 $note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>'; 79 83 ?> 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> 84 <button role="menuitem" type="button" class="imgedit-rleft button disabled" disabled></button> 85 <button role="menuitem" type="button" class="imgedit-rright button disabled" disabled></button> 86 <?php 87 } 88 ?> 89 <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> 90 <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> 90 91 <?php echo $note_no_rotate; ?> 91 92 </div> 93 <div class="imgedit-submit imgedit-menu"> 94 <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> 92 95 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; ?>" /> 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> 99 97 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> 98 <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> 104 99 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' ); ?>" /> 100 <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> 108 101 </div> 109 102 </div> 103 <div class="imgedit-panel-content wp-clearfix"> 104 <?php echo $note; ?> 105 <div class="imgedit-tools"> 106 <input type="hidden" id="imgedit-nonce-<?php echo $post_id; ?>" value="<?php echo $nonce; ?>" /> 107 <input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" /> 108 <input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" /> 109 <input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" /> 110 <input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" /> 111 <input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> 112 <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" /> 110 113 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> 114 <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap"> 115 <div class="imgedit-crop-grid"></div> 116 <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" 117 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="" /> 118 </div> 123 119 </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"> 120 <div class="imgedit-settings"> 121 <div class="imgedit-tool-active"> 122 <div class="imgedit-group"> 123 <div id="imgedit-scale" tabindex="-1" class="imgedit-group-controls"> 124 <div class="imgedit-group-top"> 125 <h2><?php _e( 'Scale Image' ); ?></h2> 126 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 127 <?php 128 /* translators: Hidden accessibility text. */ 129 esc_html_e( 'Scale Image Help' ); 130 ?> 131 </span></button> 132 <div class="imgedit-help"> 133 <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> 134 </div> 135 <?php if ( isset( $meta['width'], $meta['height'] ) ) : ?> 136 <p> 137 <?php 138 printf( 139 /* translators: %s: Image width and height in pixels. */ 140 __( 'Original dimensions %s' ), 141 '<span class="imgedit-original-dimensions">' . $meta['width'] . ' × ' . $meta['height'] . '</span>' 142 ); 143 ?> 144 </p> 145 <?php endif; ?> 146 <div class="imgedit-submit"> 147 <fieldset class="imgedit-scale-controls"> 148 <legend><?php _e( 'New dimensions:' ); ?></legend> 149 <div class="nowrap"> 150 <label for="imgedit-scale-width-<?php echo $post_id; ?>" class="screen-reader-text"> 151 <?php 152 /* translators: Hidden accessibility text. */ 153 _e( 'scale height' ); 154 ?> 155 </label> 156 <input type="text" 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; ?>" /> 157 <span class="imgedit-separator" aria-hidden="true">×</span> 158 <label for="imgedit-scale-height-<?php echo $post_id; ?>" class="screen-reader-text"><?php _e( 'scale height' ); ?></label> 159 <input type="text" 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; ?>" /> 160 <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span> 161 <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> 162 </div> 163 </fieldset> 164 </div> 165 </div> 166 </div> 167 </div> 136 168 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="text" 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; ?>" /> 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="text" 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; ?>" /> 155 <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span> 156 <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> 157 </div> 158 </fieldset> 169 <?php if ( $can_restore ) { ?> 170 <div class="imgedit-group"> 171 <div class="imgedit-group-top"> 172 <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> 173 <div class="imgedit-help imgedit-restore"> 174 <p> 175 <?php 176 _e( 'Discard any changes and restore the original image.' ); 177 if ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) { 178 echo ' ' . __( 'Previously edited copies of the image will not be deleted.' ); 179 } 180 ?> 181 </p> 182 <div class="imgedit-submit"> 183 <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; ?> /> 184 </div> 185 </div> 186 </div> 187 </div> 188 <?php } ?> 189 <div class="imgedit-group"> 190 <div id="imgedit-crop" tabindex="-1" class="imgedit-group-controls"> 191 <div class="imgedit-group-top"> 192 <h2><?php _e( 'Crop Image' ); ?></h2> 193 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 194 <?php 195 /* translators: Hidden accessibility text. */ 196 _e( 'Image Crop Help' ); 197 ?> 198 </span></button> 159 199 160 </div> 161 </div> 162 </div> 200 <div class="imgedit-help"> 201 <p><?php _e( 'To crop the image, click on it and drag to make your selection.' ); ?></p> 163 202 164 <?php if ( $can_restore ) { ?> 203 <p><strong><?php _e( 'Crop Aspect Ratio' ); ?></strong><br /> 204 <?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> 165 205 166 <div class="imgedit-group"> 167 <div class="imgedit-group-top"> 168 <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> 169 <div class="imgedit-help imgedit-restore"> 170 <p> 171 <?php 172 _e( 'Discard any changes and restore the original image.' ); 173 174 if ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) { 175 echo ' ' . __( 'Previously edited copies of the image will not be deleted.' ); 176 } 177 ?> 178 </p> 179 <div class="imgedit-submit"> 180 <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; ?> /> 206 <p><strong><?php _e( 'Crop Selection' ); ?></strong><br /> 207 <?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> 208 </div> 209 </div> 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> 230 <fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel"> 231 <legend><?php _e( 'Selection:' ); ?></legend> 232 <div class="nowrap"> 233 <label for="imgedit-sel-width-<?php echo $post_id; ?>" class="screen-reader-text"> 234 <?php 235 /* translators: Hidden accessibility text. */ 236 _e( 'selection width' ); 237 ?> 238 </label> 239 <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)" /> 240 <span class="imgedit-separator" aria-hidden="true">×</span> 241 <label for="imgedit-sel-height-<?php echo $post_id; ?>" class="screen-reader-text"> 242 <?php 243 /* translators: Hidden accessibility text. */ 244 _e( 'selection height' ); 245 ?> 246 </label> 247 <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)" /> 248 </div> 249 </fieldset> 250 <fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel"> 251 <legend><?php _e( 'Starting Coordinates:' ); ?></legend> 252 <div class="nowrap"> 253 <label for="imgedit-start-x-<?php echo $post_id; ?>" class="screen-reader-text"> 254 <?php 255 /* translators: Hidden accessibility text. */ 256 _e( 'horizontal start position' ); 257 ?> 258 </label> 259 <input type="text" 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" /> 260 <span class="imgedit-separator" aria-hidden="true">×</span> 261 <label for="imgedit-start-y-<?php echo $post_id; ?>" class="screen-reader-text"> 262 <?php 263 /* translators: Hidden accessibility text. */ 264 _e( 'vertical start position' ); 265 ?> 266 </label> 267 <input type="text" 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" /> 268 </div> 269 </fieldset> 270 <div class="imgedit-crop-apply imgedit-menu container"> 271 <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> 272 </div> 273 </div> 181 274 </div> 182 </div>183 275 </div> 184 </div>185 276 186 <?php } ?>187 188 <div class="imgedit-group">189 <div class="imgedit-group-top">190 <h2><?php _e( 'Image Crop' ); ?></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 <?php193 /* translators: Hidden accessibility text. */194 esc_html_e( 'Image Crop Help' );195 ?>196 </span></button>197 198 <div class="imgedit-help">199 <p><?php _e( 'To crop the image, click on it and drag to make your selection.' ); ?></p>200 201 <p><strong><?php _e( 'Crop Aspect Ratio' ); ?></strong><br />202 <?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>203 204 <p><strong><?php _e( 'Crop Selection' ); ?></strong><br />205 <?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>206 </div>207 </div>208 209 <fieldset class="imgedit-crop-ratio">210 <legend><?php _e( 'Aspect ratio:' ); ?></legend>211 <div class="nowrap">212 <label for="imgedit-crop-width-<?php echo $post_id; ?>" class="screen-reader-text">213 <?php214 /* translators: Hidden accessibility text. */215 _e( 'crop ratio width' );216 ?>217 </label>218 <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)" />219 <span class="imgedit-separator" aria-hidden="true">:</span>220 <label for="imgedit-crop-height-<?php echo $post_id; ?>" class="screen-reader-text">221 <?php222 /* translators: Hidden accessibility text. */223 _e( 'crop ratio height' );224 ?>225 </label>226 <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)" />227 </div>228 </fieldset>229 230 <fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">231 <legend><?php _e( 'Selection:' ); ?></legend>232 <div class="nowrap">233 <label for="imgedit-sel-width-<?php echo $post_id; ?>" class="screen-reader-text">234 <?php235 /* translators: Hidden accessibility text. */236 _e( 'selection width' );237 ?>238 </label>239 <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)" />240 <span class="imgedit-separator" aria-hidden="true">×</span>241 <label for="imgedit-sel-height-<?php echo $post_id; ?>" class="screen-reader-text">242 <?php243 /* translators: Hidden accessibility text. */244 _e( 'selection height' );245 ?>246 </label>247 <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)" />248 </div>249 </fieldset>250 251 </div>252 253 277 <?php 254 278 if ( $thumb && $sub_sizes ) { 255 279 $thumb_img = wp_constrain_dimensions( $thumb['width'], $thumb['height'], 160, 120 ); … … 256 280 ?> 257 281 258 282 <div class="imgedit-group imgedit-applyto"> 259 <div class="imgedit-group-top">260 <h2><?php _e( 'Thumbnail Settings' ); ?></h2>261 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text">283 <div class="imgedit-group-top"> 284 <h2><?php _e( 'Thumbnail Settings' ); ?></h2> 285 <button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);" aria-expanded="false"><span class="screen-reader-text"> 262 286 <?php 263 287 /* translators: Hidden accessibility text. */ 264 288 esc_html_e( 'Thumbnail Settings Help' ); 265 289 ?> 266 </span></button> 267 <div class="imgedit-help"> 268 <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> 290 </span></button> 291 <div class="imgedit-help"> 292 <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> 293 </div> 269 294 </div> 270 </div> 295 <div class="imgedit-thumbnail-preview-group"> 296 <figure class="imgedit-thumbnail-preview"> 297 <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" /> 298 <figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption> 299 </figure> 300 <div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target"> 301 <fieldset> 302 <legend><?php _e( 'Apply changes to:' ); ?></legend> 271 303 272 <figure class="imgedit-thumbnail-preview">273 <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" />274 <figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>275 </figure>304 <span class="imgedit-label"> 305 <input type="radio" id="imgedit-target-all" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" /> 306 <label for="imgedit-target-all"><?php _e( 'All image sizes' ); ?></label> 307 </span> 276 308 277 <div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target"> 278 <fieldset> 279 <legend><?php _e( 'Apply changes to:' ); ?></legend> 309 <span class="imgedit-label"> 310 <input type="radio" id="imgedit-target-thumbnail" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" /> 311 <label for="imgedit-target-thumbnail"><?php _e( 'Thumbnail' ); ?></label> 312 </span> 313 314 <span class="imgedit-label"> 315 <input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> 316 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> 317 </span> 280 318 281 <span class="imgedit-label"> 282 <input type="radio" id="imgedit-target-all" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" /> 283 <label for="imgedit-target-all"><?php _e( 'All image sizes' ); ?></label> 284 </span> 285 286 <span class="imgedit-label"> 287 <input type="radio" id="imgedit-target-thumbnail" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" /> 288 <label for="imgedit-target-thumbnail"><?php _e( 'Thumbnail' ); ?></label> 289 </span> 290 291 <span class="imgedit-label"> 292 <input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> 293 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> 294 </span> 295 <?php 296 if ( $edit_custom_sizes ) { 297 if ( ! is_array( $edit_custom_sizes ) ) { 298 $edit_custom_sizes = get_intermediate_image_sizes(); 299 } 300 foreach ( array_unique( $edit_custom_sizes ) as $key => $size ) { 301 if ( array_key_exists( $size, $meta['sizes'] ) ) { 302 if ( 'thumbnail' === $size ) { 303 continue; 319 <?php 320 if ( $edit_custom_sizes ) { 321 if ( ! is_array( $edit_custom_sizes ) ) { 322 $edit_custom_sizes = get_intermediate_image_sizes(); 304 323 } 305 ?> 306 <span class="imgedit-label"> 307 <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 ); ?>" /> 308 <label for="imgedit-target-custom<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $size ); ?></label> 309 </span> 310 <?php 324 foreach ( array_unique( $edit_custom_sizes ) as $key => $size ) { 325 if ( array_key_exists( $size, $meta['sizes'] ) ) { 326 if ( 'thumbnail' === $size ) { 327 continue; 328 } 329 ?> 330 <span class="imgedit-label"> 331 <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 ); ?>" /> 332 <label for="imgedit-target-custom<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $size ); ?></label> 333 </span> 334 <?php 335 } 336 } 311 337 } 312 }313 }314 ?>315 </fieldset>338 ?> 339 </fieldset> 340 </div> 341 </div> 316 342 </div> 343 <?php } ?> 344 </div> 317 345 </div> 318 346 319 <?php } ?>320 321 347 </div> 348 <div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div> 349 <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> 322 350 323 351 </div> 324 352 <div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div> … … 508 536 */ 509 537 function _image_get_preview_ratio( $w, $h ) { 510 538 $max = max( $w, $h ); 511 return $max > 400 ? ( 400 / $max ) : 1;539 return $max > 600 ? ( 600 / $max ) : 1; 512 540 } 513 541 514 542 /** -
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 { … … 2819 2790 } 2820 2791 2821 2792 @media screen and (max-width: 782px) { 2793 .imgedit-panel-content { 2794 grid-template-columns: auto; 2795 } 2796 2822 2797 .attachments-browser .media-toolbar { 2823 2798 height: 82px; 2824 2799 }