Restyle the image editor so it looks way less hideous.

props avryl.
see #27544.

Built from https://develop.svn.wordpress.org/trunk@27842


git-svn-id: http://core.svn.wordpress.org/trunk@27676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-29 08:51:14 +00:00
parent e87e153126
commit 3c1cdaa362
11 changed files with 284 additions and 118 deletions

View File

@ -457,28 +457,34 @@ border color while dragging a file over the uploader drop area */
}
.imgedit-settings p {
margin: 8px 0;
margin: 8px 0 0;
}
.post-php .imgedit-wrap table {
width: 100%;
}
.describe .imgedit-wrap table td,
.wp_attachment_holder .imgedit-wrap table td {
vertical-align: top;
padding-top: 0;
}
.describe .imgedit-wrap table td.imgedit-settings {
.describe .imgedit-wrap .imgedit-settings {
padding: 0 5px;
}
.wp_attachment_holder .imgedit-wrap table td.imgedit-settings {
.wp_attachment_holder div.updated {
margin-top: 0;
}
.wp_attachment_holder .imgedit-wrap > div {
height: auto;
overflow: hidden;
}
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content {
padding-left: 16px;
width: auto;
overflow: hidden;
}
.wp_attachment_holder .imgedit-wrap .imgedit-settings {
float: left;
width: 250px;
}
td.imgedit-settings input {
.imgedit-settings input {
margin-top: 0;
vertical-align: middle;
}
@ -486,7 +492,7 @@ td.imgedit-settings input {
.imgedit-wait {
position: absolute;
top: 0;
background: #fff url(../images/spinner.gif) no-repeat scroll 22px 10px;
background: #fff url(../images/spinner.gif) no-repeat center;
-webkit-background-size: 20px 20px;
background-size: 20px 20px;
opacity: 0.7;
@ -561,6 +567,7 @@ td.imgedit-settings input {
.imgedit-menu div.disabled {
border-color: #ccc;
background-color: #ddd;
color: #777;
filter: alpha(opacity=50);
opacity: 0.5;
cursor: default;
@ -634,6 +641,14 @@ td.imgedit-settings input {
margin: 5px 0;
}
#poststuff .imgedit-group-top h3 {
padding: 0;
}
.imgedit-group-top h3 a {
text-decoration: none;
}
.imgedit-applyto .imgedit-label {
padding: 2px 0 0;
display: block;
@ -642,7 +657,6 @@ td.imgedit-settings input {
.imgedit-help {
display: none;
font-style: italic;
margin-bottom: 8px;
}
a.imgedit-help-toggle {

View File

@ -457,28 +457,34 @@ border color while dragging a file over the uploader drop area */
}
.imgedit-settings p {
margin: 8px 0;
margin: 8px 0 0;
}
.post-php .imgedit-wrap table {
width: 100%;
}
.describe .imgedit-wrap table td,
.wp_attachment_holder .imgedit-wrap table td {
vertical-align: top;
padding-top: 0;
}
.describe .imgedit-wrap table td.imgedit-settings {
.describe .imgedit-wrap .imgedit-settings {
padding: 0 5px;
}
.wp_attachment_holder .imgedit-wrap table td.imgedit-settings {
.wp_attachment_holder div.updated {
margin-top: 0;
}
.wp_attachment_holder .imgedit-wrap > div {
height: auto;
overflow: hidden;
}
.wp_attachment_holder .imgedit-wrap .imgedit-panel-content {
padding-right: 16px;
width: auto;
overflow: hidden;
}
.wp_attachment_holder .imgedit-wrap .imgedit-settings {
float: right;
width: 250px;
}
td.imgedit-settings input {
.imgedit-settings input {
margin-top: 0;
vertical-align: middle;
}
@ -486,7 +492,7 @@ td.imgedit-settings input {
.imgedit-wait {
position: absolute;
top: 0;
background: #fff url(../images/spinner.gif) no-repeat scroll 22px 10px;
background: #fff url(../images/spinner.gif) no-repeat center;
-webkit-background-size: 20px 20px;
background-size: 20px 20px;
opacity: 0.7;
@ -561,6 +567,7 @@ td.imgedit-settings input {
.imgedit-menu div.disabled {
border-color: #ccc;
background-color: #ddd;
color: #777;
filter: alpha(opacity=50);
opacity: 0.5;
cursor: default;
@ -634,6 +641,14 @@ td.imgedit-settings input {
margin: 5px 0;
}
#poststuff .imgedit-group-top h3 {
padding: 0;
}
.imgedit-group-top h3 a {
text-decoration: none;
}
.imgedit-applyto .imgedit-label {
padding: 2px 0 0;
display: block;
@ -642,7 +657,6 @@ td.imgedit-settings input {
.imgedit-help {
display: none;
font-style: italic;
margin-bottom: 8px;
}
a.imgedit-help-toggle {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -34,70 +34,31 @@ function wp_image_editor($post_id, $msg = false) {
?>
<div class="imgedit-wrap">
<?php echo $note; ?>
<table id="imgedit-panel-<?php echo $post_id; ?>"><tbody>
<tr><td>
<div class="imgedit-menu">
<div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
<div id="imgedit-panel-<?php echo $post_id; ?>">
// On some setups GD library does not provide imagerotate() - Ticket #11536
if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) { ?>
<div class="imgedit-rleft" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
<div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
<?php } else {
$note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
?>
<div class="imgedit-rleft disabled" title="<?php echo $note_no_rotate; ?>"></div>
<div class="imgedit-rright disabled" title="<?php echo $note_no_rotate; ?>"></div>
<?php } ?>
<div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv" title="<?php esc_attr_e( 'Flip vertically' ); ?>"></div>
<div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph" title="<?php esc_attr_e( 'Flip horizontally' ); ?>"></div>
<div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo disabled" title="<?php esc_attr_e( 'Undo' ); ?>"></div>
<div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo disabled" title="<?php esc_attr_e( 'Redo' ); ?>"></div>
<br class="clear" />
</div>
<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
<input type="hidden" id="imgedit-minthumb-<?php echo $post_id; ?>" value="<?php echo ( get_option('thumbnail_size_w') . ':' . get_option('thumbnail_size_h') ); ?>" />
<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
</div>
<div class="imgedit-submit">
<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button" value="<?php esc_attr_e( 'Cancel' ); ?>" />
<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
</div>
</td>
<td class="imgedit-settings">
<div class="imgedit-settings">
<div class="imgedit-group">
<div class="imgedit-group-top">
<a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><strong><?php _e('Scale Image'); ?></strong></a>
<h3><?php _e( 'Scale Image' ); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
<div class="imgedit-help">
<p><?php _e('You can proportionally scale the original image. For best results the scaling should be done before performing any other operations on it like crop, rotate, etc. Note that images can only be scaled down, not up.'); ?></p>
</div>
<?php if ( isset( $meta['width'], $meta['height'] ) ): ?>
<p><?php printf( __('Original dimensions %s'), $meta['width'] . '&times;' . $meta['height'] ); ?></p>
<p><?php printf( __('Original dimensions %s'), $meta['width'] . ' &times; ' . $meta['height'] ); ?></p>
<?php endif ?>
<div class="imgedit-submit">
<span class="nowrap"><input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" style="width:4em;" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />&times;<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" style="width:4em;" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
<span class="nowrap"><input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" style="width:4em;" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> &times; <input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" style="width:4em;" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span></span>
<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" />
</div>
<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" />
</div>
</div>
</div>
<?php if ( $can_restore ) { ?>
<div class="imgedit-group">
<div class="imgedit-group-top">
<a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><strong><?php _e('Restore Original Image'); ?></strong></a>
<h3><a onclick="imageEdit.toggleHelp(this);return false;" href="#"><?php _e('Restore Original Image'); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></a></h3>
<div class="imgedit-help">
<p><?php _e('Discard any changes and restore the original image.');
@ -106,19 +67,18 @@ function wp_image_editor($post_id, $msg = false) {
?></p>
<div class="imgedit-submit">
<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> />
<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; ?> />
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<div class="imgedit-group">
<div class="imgedit-group-top">
<strong><?php _e('Image Crop'); ?></strong>
<a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><?php _e('(help)'); ?></a>
<h3><?php _e('Image Crop'); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
<div class="imgedit-help">
<p><?php _e('The image can be cropped by clicking on it and dragging to select the desired part. While dragging the dimensions of the selection are displayed below.'); ?></p>
@ -155,8 +115,7 @@ function wp_image_editor($post_id, $msg = false) {
<div class="imgedit-group imgedit-applyto">
<div class="imgedit-group-top">
<strong><?php _e('Thumbnail Settings'); ?></strong>
<a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><?php _e('(help)'); ?></a>
<h3><?php _e('Thumbnail Settings'); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
<p class="imgedit-help"><?php _e('The thumbnail image can be cropped differently. For example it can be square or contain only a portion of the original image to showcase it better. Here you can select whether to apply changes to all image sizes or make the thumbnail different.'); ?></p>
</div>
@ -184,8 +143,51 @@ function wp_image_editor($post_id, $msg = false) {
<?php } ?>
</td></tr>
</tbody></table>
</div>
<div class="imgedit-panel-content">
<?php echo $note; ?>
<div class="imgedit-menu">
<div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
// On some setups GD library does not provide imagerotate() - Ticket #11536
if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) { ?>
<div class="imgedit-rleft" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
<div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
<?php } else {
$note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
?>
<div class="imgedit-rleft disabled" title="<?php echo $note_no_rotate; ?>"></div>
<div class="imgedit-rright disabled" title="<?php echo $note_no_rotate; ?>"></div>
<?php } ?>
<div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv" title="<?php esc_attr_e( 'Flip vertically' ); ?>"></div>
<div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph" title="<?php esc_attr_e( 'Flip horizontally' ); ?>"></div>
<div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo disabled" title="<?php esc_attr_e( 'Undo' ); ?>"></div>
<div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo disabled" title="<?php esc_attr_e( 'Redo' ); ?>"></div>
<br class="clear" />
</div>
<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
<input type="hidden" id="imgedit-minthumb-<?php echo $post_id; ?>" value="<?php echo ( get_option('thumbnail_size_w') . ':' . get_option('thumbnail_size_h') ); ?>" />
<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
</div>
<div class="imgedit-submit">
<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button" value="<?php esc_attr_e( 'Cancel' ); ?>" />
<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' ); ?>" />
</div>
</div>
</div>
<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
<script type="text/javascript">jQuery( function() { imageEdit.init(<?php echo $post_id; ?>); });</script>
<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>

View File

@ -63,7 +63,7 @@ var imageEdit = window.imageEdit = {
},
toggleHelp : function(el) {
$(el).siblings('.imgedit-help').slideToggle('fast');
$( el ).parents( '.imgedit-group-top' ).toggleClass( 'imgedit-help-toggled' ).find( '.imgedit-help' ).slideToggle( 'fast' );
return false;
},

File diff suppressed because one or more lines are too long

View File

@ -1458,22 +1458,90 @@
* Image Editor
*/
.media-frame .image-editor {
.media-frame .imgedit-wrap {
position: static;
}
.media-frame .imgedit-wait {
height: auto !important;
left: 0;
bottom: 0;
right: 0;
}
.media-frame .imgedit-wrap .imgedit-panel-content {
padding: 16px;
position: absolute;
top: 0;
left: 282px;
bottom: 0;
right: 0;
overflow: auto;
}
.media-frame .imgedit-wrap table {
width: 100%;
}
.media-frame .imgedit-wrap table td {
vertical-align: top;
padding-top: 0;
}
.media-frame .imgedit-wrap table td.imgedit-settings {
.media-frame .imgedit-wrap .imgedit-settings {
background: #f3f3f3;
border-right: 1px solid #ddd;
padding: 0 16px 16px;
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 250px;
overflow: auto;
}
.media-frame .imgedit-group {
background: none;
border: none;
border-bottom: 1px solid #ddd;
-webkit-box-shadow: none;
box-shadow: none;
margin: 0;
margin-bottom: 16px;
padding: 0;
padding-bottom: 16px;
}
.media-frame .imgedit-group:last-of-type {
border: none;
margin: 0;
padding: 0;
}
.media-frame .imgedit-group-top h3 {
text-transform: uppercase;
font-size: 12px;
color: #666;
margin: 0;
margin-top: 24px;
}
.media-frame .imgedit-group-top h3 a {
text-decoration: none;
color: #666;
}
.media-frame .imgedit-help-toggle {
margin-top: -2px;
cursor: pointer;
color: #666;
}
.media-frame .imgedit-help-toggled span.dashicons:before {
content: '\f142';
}
.media-frame .imgedit-group img {
margin-top: 5px;
}
.media-frame .imgedit-wrap div.updated {
margin: 0;
margin-bottom: 16px;
}
/**
* Embed from URL and Image Details
*/

File diff suppressed because one or more lines are too long

View File

@ -1458,22 +1458,90 @@
* Image Editor
*/
.media-frame .image-editor {
.media-frame .imgedit-wrap {
position: static;
}
.media-frame .imgedit-wait {
height: auto !important;
right: 0;
bottom: 0;
left: 0;
}
.media-frame .imgedit-wrap .imgedit-panel-content {
padding: 16px;
position: absolute;
top: 0;
right: 282px;
bottom: 0;
left: 0;
overflow: auto;
}
.media-frame .imgedit-wrap table {
width: 100%;
}
.media-frame .imgedit-wrap table td {
vertical-align: top;
padding-top: 0;
}
.media-frame .imgedit-wrap table td.imgedit-settings {
.media-frame .imgedit-wrap .imgedit-settings {
background: #f3f3f3;
border-left: 1px solid #ddd;
padding: 0 16px 16px;
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 250px;
overflow: auto;
}
.media-frame .imgedit-group {
background: none;
border: none;
border-bottom: 1px solid #ddd;
-webkit-box-shadow: none;
box-shadow: none;
margin: 0;
margin-bottom: 16px;
padding: 0;
padding-bottom: 16px;
}
.media-frame .imgedit-group:last-of-type {
border: none;
margin: 0;
padding: 0;
}
.media-frame .imgedit-group-top h3 {
text-transform: uppercase;
font-size: 12px;
color: #666;
margin: 0;
margin-top: 24px;
}
.media-frame .imgedit-group-top h3 a {
text-decoration: none;
color: #666;
}
.media-frame .imgedit-help-toggle {
margin-top: -2px;
cursor: pointer;
color: #666;
}
.media-frame .imgedit-help-toggled span.dashicons:before {
content: '\f142';
}
.media-frame .imgedit-group img {
margin-top: 5px;
}
.media-frame .imgedit-wrap div.updated {
margin: 0;
margin-bottom: 16px;
}
/**
* Embed from URL and Image Details
*/

File diff suppressed because one or more lines are too long