Final round of media UX improvements.

Props koopersmith
fixes #21390 #22502


git-svn-id: http://core.svn.wordpress.org/trunk@23006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-12-04 01:26:03 +00:00
parent 987c35a790
commit 61a9471024
7 changed files with 930 additions and 720 deletions

View File

@ -37,8 +37,8 @@
} }
}); });
frame.toolbar.on( 'activate:select', function() { frame.on( 'toolbar:render:select', function( view ) {
frame.toolbar.view().set({ view.set({
select: { select: {
style: 'primary', style: 'primary',
text: $el.data('update'), text: $el.data('update'),

View File

@ -24,8 +24,8 @@
} }
}); });
frame.toolbar.on( 'activate:select', function() { frame.on( 'toolbar:render:select', function( view ) {
frame.toolbar.view().set({ view.set({
select: { select: {
style: 'primary', style: 'primary',
text: $el.data('update'), text: $el.data('update'),

View File

@ -1,25 +1,14 @@
/** /**
* Modal * Modal
*/ */
.media-modal-title {
left: auto;
right: 0;
}
.media-modal-close { .media-modal-close {
right: auto; right: auto;
left: 0; left: 7px;
} }
/** /**
* Toolbar * Toolbar
*/ */
.media-frame-toolbar > .media-toolbar {
left: 0;
right: 200px;
}
.media-toolbar-primary { .media-toolbar-primary {
float: left; float: left;
} }
@ -93,21 +82,51 @@
* Menu * Menu
*/ */
.media-menu { .media-menu {
left: auto;
right: 0;
border-right: 0; border-right: 0;
border-left: 1px solid #d9d9d9; border-left: 1px solid #d9d9d9;
box-shadow: inset 6px 0 6px -6px rgba( 0, 0, 0, 0.2 ) box-shadow: inset 6px 0 6px -6px rgba( 0, 0, 0, 0.2 )
} }
/**
* Router
*/
.media-router > a {
float: right;
border-right: 0;
border-left: 1px solid #dfdfdf;
}
.media-router > a:last-child {
border-left: 0;
}
/** /**
* Frame * Frame
*/ */
.media-frame .region-content { .media-frame-menu {
left: auto;
right: 0;
}
.media-frame-title,
.media-frame-router,
.media-frame-content,
.media-frame-toolbar {
left: 0; left: 0;
right: 200px; right: 200px;
} }
.media-frame.hide-menu .media-frame-title,
.media-frame.hide-menu .media-frame-router,
.media-frame.hide-menu .media-frame-toolbar,
.media-frame.hide-menu .media-frame-content {
right: 0;
}
.media-frame.hide-menu .media-frame-menu {
left: auto;
right: -200px;
}
/** /**
* Attachment Browser Filters * Attachment Browser Filters
*/ */
@ -225,30 +244,6 @@
background-image: linear-gradient(to right, rgba( 255, 255, 255, 1 ) , rgba( 255, 255, 255, 0 ) ); background-image: linear-gradient(to right, rgba( 255, 255, 255, 1 ) , rgba( 255, 255, 255, 0 ) );
} }
/**
* Selection Preview
*/
.selected-img {
float: right;
margin-right: 0;
margin-left: 14px;
}
.selection-preview img {
float: right;
margin-left: 0;
margin-right: 1px;
}
.selection-preview .count {
right: auto;
left: 0;
}
.selection-preview .clear-selection {
float: right;
}
/** /**
* Attachment Details * Attachment Details
*/ */
@ -289,8 +284,10 @@
* Responsive layout * Responsive layout
*/ */
@media only screen and (max-width: 900px) { @media only screen and (max-width: 900px) {
.media-frame .region-content, .media-frame-title,
.media-frame-toolbar > .media-toolbar { .media-frame-router,
.media-frame-content,
.media-frame-toolbar {
left: 0; left: 0;
right: 140px; right: 140px;
} }

View File

@ -80,10 +80,10 @@
*/ */
.media-modal { .media-modal {
position: fixed; position: fixed;
top: 60px; top: 30px;
left: 40px; left: 30px;
right: 40px; right: 30px;
bottom: 40px; bottom: 30px;
z-index: 160000; z-index: 160000;
} }
@ -94,42 +94,24 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
background: #000; background: #000;
opacity: 0.8; opacity: 0.7;
z-index: 159900; z-index: 159900;
} }
.media-modal-backdrop div,
.uploader-window-content {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
border: 1px dashed rgba( 255, 255, 255, 0.5 );
}
.media-modal-title {
position: absolute;
top: -40px;
left: 0;
height: 40px;
padding: 0;
margin: 0;
line-height: 40px;
color: #fff;
font-size: 16px;
font-weight: 200;
text-shadow: 0 0 16px rgba( 0, 0, 0, 0.6 );
}
.media-modal-close { .media-modal-close {
position: absolute; position: absolute;
top: -27px; top: 7px;
right: 0; right: 7px;
height: 15px; width: 30px;
height: 30px;
z-index: 1000;
}
.media-modal-close span {
display: block;
margin: 8px auto 0;
width: 15px; width: 15px;
background-position: -80px 0; height: 15px;
background-position: -100px 0;
} }
.media-modal-close:active { .media-modal-close:active {
@ -165,18 +147,6 @@
border: 0 solid #dfdfdf; border: 0 solid #dfdfdf;
} }
.media-frame-toolbar > .media-toolbar {
top: auto;
left: 200px;
bottom: 0;
border-width: 1px 0 0 0;
box-shadow: 0 -4px 4px -4px rgba( 0, 0, 0, 0.1 );
}
.hide-toolbar .media-frame-toolbar > .media-toolbar {
bottom: -61px;
}
.media-toolbar-primary { .media-toolbar-primary {
float: right; float: right;
} }
@ -238,11 +208,6 @@
width: 100%; width: 100%;
} }
.media-sidebar .selection-preview {
display: block;
padding-top: 5px;
}
.media-sidebar h3 { .media-sidebar h3 {
position: relative; position: relative;
font-weight: bold; font-weight: bold;
@ -361,11 +326,10 @@
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0;
bottom: 0; bottom: 0;
width: 199px;
margin: 0; margin: 0;
padding: 16px 0; padding: 16px 0;
z-index: 200;
border-right: 1px solid #d9d9d9; border-right: 1px solid #d9d9d9;
box-shadow: inset -6px 0 6px -6px rgba( 0, 0, 0, 0.2 ); box-shadow: inset -6px 0 6px -6px rgba( 0, 0, 0, 0.2 );
-webkit-user-select: none; -webkit-user-select: none;
@ -374,7 +338,8 @@
user-select: none; user-select: none;
} }
.media-menu li { .media-menu > a {
display: block;
position: relative; position: relative;
padding: 4px 20px; padding: 4px 20px;
margin: 0; margin: 0;
@ -382,16 +347,18 @@
font-size: 14px; font-size: 14px;
color: #21759B; color: #21759B;
text-shadow: 0 1px 0 #fff; text-shadow: 0 1px 0 #fff;
text-decoration: none;
} }
.media-menu-item { .media-menu > a:hover {
cursor: pointer; color: #21759B;
}
.media-menu li:hover {
background: rgba( 0, 0, 0, 0.04 ); background: rgba( 0, 0, 0, 0.04 );
} }
.media-menu > a:active {
outline: none;
}
.media-menu .active, .media-menu .active,
.media-menu .active:hover { .media-menu .active:hover {
color: #333; color: #333;
@ -406,6 +373,64 @@
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
} }
/**
* Menu
*/
.media-router {
position: relative;
padding: 0 6px;
margin: 0;
clear: both;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.media-router > a {
position: relative;
float: left;
padding: 2px 10px;
margin: 0;
height: 18px;
line-height: 18px;
font-size: 14px;
border-right: 1px solid #dfdfdf;
text-shadow: 0 1px 0 #fff;
text-decoration: none;
}
.media-router > a:last-child {
border-right: 0;
}
.media-router > a:active,
.media-router > a:focus {
outline: none;
}
.media-router .active,
.media-router .active:hover {
color: #333;
}
.media-router .active:after {
content: '';
display: block;
margin: -100px auto 0;
width: 7px;
height: 7px;
background: #fff;
box-shadow: 1px 1px 1px rgba( 0, 0, 0, 0.2 );
z-index: 300;
-webkit-transform: rotate( 45deg ) translate( 75px, 75px );
-moz-transform: rotate( 45deg ) translate( 75px, 75px );
-ms-transform: rotate( 45deg ) translate( 75px, 75px );
-o-transform: rotate( 45deg ) translate( 75px, 75px );
transform: rotate( 45deg ) translate( 75px, 75px );
}
/** /**
* Frame * Frame
*/ */
@ -418,9 +443,38 @@
bottom: 0; bottom: 0;
} }
.media-frame .region-content { .media-frame-menu {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0;
bottom: 0;
width: 199px;
z-index: 150;
}
.media-frame-title {
position: absolute;
top: 0;
left: 200px;
right: 0;
height: 45px;
z-index: 200;
}
.media-frame-router {
position: absolute;
top: 45px;
left: 200px;
right: 0;
height: 30px;
z-index: 200;
border-bottom: 1px solid #dfdfdf;
box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 );
}
.media-frame-content {
position: absolute;
top: 75px;
left: 200px; left: 200px;
right: 0; right: 0;
bottom: 61px; bottom: 61px;
@ -430,14 +484,62 @@
overflow: auto; overflow: auto;
} }
.media-frame.hide-toolbar .region-content { .media-frame-toolbar {
position: absolute;
left: 200px;
right: 0;
bottom: 0; bottom: 0;
height: 60px;
z-index: 100;
border: 0 solid #dfdfdf;
border-width: 1px 0 0 0;
box-shadow: 0 -4px 4px -4px rgba( 0, 0, 0, 0.1 );
}
.media-frame.hide-menu .media-frame-title,
.media-frame.hide-menu .media-frame-router,
.media-frame.hide-menu .media-frame-toolbar,
.media-frame.hide-menu .media-frame-content {
left: 0;
}
.media-frame.hide-menu .media-frame-menu {
left: -200px;
}
.media-frame.hide-toolbar .media-frame-content {
bottom: 0;
}
.media-frame.hide-toolbar .media-frame-toolbar {
bottom: -61px;
}
.media-frame.hide-router .media-frame-content {
top: 45px;
}
.media-frame.hide-router .media-frame-router {
display: none;
}
.media-frame.hide-router .media-frame-title {
border-bottom: 1px solid #dfdfdf;
box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 );
} }
.media-frame .media-toolbar .add-to-gallery { .media-frame .media-toolbar .add-to-gallery {
display: none; display: none;
} }
.media-frame-title h1 {
padding: 0 16px;
font-size: 22px;
font-weight: 200;
line-height: 45px;
margin: 0;
}
/** /**
* Iframes * Iframes
*/ */
@ -721,6 +823,9 @@
* Attachments Browser * Attachments Browser
*/ */
.media-frame .attachments-browser { .media-frame .attachments-browser {
position: relative;
width: 100%;
height: 100%;
overflow: hidden; overflow: hidden;
} }
@ -903,7 +1008,12 @@
} }
.uploader-window-content { .uploader-window-content {
border-color: #fff; position: absolute;
top: 10px;
left: 10px;
right: 10px;
bottom: 10px;
border: 1px dashed #fff;
} }
.uploader-window h3 { .uploader-window h3 {
@ -956,6 +1066,10 @@
margin: 4em 0; margin: 4em 0;
} }
.uploader-inline .has-upload-message .upload-ui {
margin: 0 0 4em;
}
.uploader-inline h3 { .uploader-inline h3 {
font-size: 20px; font-size: 20px;
line-height: 28px; line-height: 28px;
@ -963,6 +1077,12 @@
margin-bottom: 1.6em; margin-bottom: 1.6em;
} }
.uploader-inline .has-upload-message .upload-instructions {
font-size: 14px;
color: #464646;
font-weight: normal;
}
.uploader-inline .drop-instructions { .uploader-inline .drop-instructions {
display: none; display: none;
} }
@ -1058,7 +1178,7 @@
vertical-align: top; vertical-align: top;
} }
.media-selection .attachment img { .media-selection .attachment .icon {
width: 50%; width: 50%;
} }
@ -1097,69 +1217,6 @@
display: none; display: none;
} }
/**
* Selection Preview
*/
.selection-preview {
position: relative;
height: 60px;
overflow: hidden;
}
.selected-img {
float: left;
position: relative;
margin-right: 14px;
}
.selection-preview img {
max-width: 40px;
max-height: 40px;
float: left;
margin-top: 6px;
margin-left: 1px;
border: 2px solid white;
box-shadow:
0 0 0 1px #ccc,
3px 3px 0 0 #fff,
3px 3px 0 1px #ccc,
6px 6px 0 0 #fff,
6px 6px 0 1px #ccc;
}
.selection-preview .selected-count-1 img {
margin-top: 8px;
box-shadow: 0 0 0 1px #ccc;
}
.selection-preview .selected-count-2 img {
margin-top: 7px;
box-shadow:
0 0 0 1px #ccc,
3px 3px 0 0 #fff,
3px 3px 0 1px #ccc;
}
.selection-preview .count {
position: absolute;
bottom: 0;
right: 0;
height: 16px;
min-width: 8px;
padding: 0 4px;
font-size: 12px;
text-align: center;
font-weight: bold;
color: #999;
background: #fff;
box-shadow: -1px -1px 2px -1px rgba( 0, 0, 0, 0.2 );
}
.selection-preview .clear-selection {
float: left;
line-height: 60px;
}
/** /**
* Spinner * Spinner
*/ */
@ -1297,21 +1354,17 @@
.embed-url { .embed-url {
display: block; display: block;
position: relative; position: relative;
height: 75px; height: 40px;
padding: 16px 16px; padding: 0 16px 16px;
margin: 0; margin: 0;
z-index: 50; z-index: 250;
background: #fff;
border-bottom: 1px solid #dfdfdf; border-bottom: 1px solid #dfdfdf;
box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 ); box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 );
font-size: 18px; font-size: 18px;
font-weight: 200; font-weight: 200;
} }
.embed-url span {
display: block;
padding: 4px 0 6px 2px;
}
.media-frame .embed-url input { .media-frame .embed-url input {
font-size: 18px; font-size: 18px;
padding: 12px 14px; padding: 12px 14px;
@ -1324,7 +1377,7 @@
.embed-image-settings { .embed-image-settings {
position: absolute; position: absolute;
background: #f5f5f5; background: #f5f5f5;
top: 108px; top: 57px;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
@ -1388,41 +1441,18 @@
* Responsive layout * Responsive layout
*/ */
@media only screen and (max-width: 900px) { @media only screen and (max-width: 900px) {
.media-modal { .media-frame-menu {
bottom: 20px;
left: 20px;
right: 20px;
top: 40px;
}
.media-modal-title {
height: 30px;
line-height: 30px;
top: -30px;
}
.media-modal-close {
top: -23px;
}
.media-modal-backdrop div,
.uploader-window-content {
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
}
.media-menu {
width: 139px; width: 139px;
} }
.media-menu li { .media-menu > a {
padding: 4px 10px; padding: 4px 10px;
} }
.media-frame .region-content, .media-frame-title,
.media-frame-toolbar > .media-toolbar { .media-frame-router,
.media-frame-content,
.media-frame-toolbar {
left: 140px; left: 140px;
} }

View File

@ -384,7 +384,7 @@
workflow = workflows[ id ] = wp.media( _.defaults( options || {}, { workflow = workflows[ id ] = wp.media( _.defaults( options || {}, {
frame: 'post', frame: 'post',
state: 'upload', state: 'insert',
title: wp.media.view.l10n.addMedia, title: wp.media.view.l10n.addMedia,
multiple: true multiple: true
} ) ); } ) );
@ -408,11 +408,13 @@
}, this ); }, this );
workflow.state('embed').on( 'select', function() { workflow.state('embed').on( 'select', function() {
var embed = workflow.state().toJSON(); var state = workflow.state(),
type = state.get('type'),
embed = state.props.toJSON();
embed.url = embed.url || ''; embed.url = embed.url || '';
if ( 'link' === embed.type ) { if ( 'link' === type ) {
_.defaults( embed, { _.defaults( embed, {
title: embed.url, title: embed.url,
linkUrl: embed.url linkUrl: embed.url
@ -420,7 +422,7 @@
this.send.link( embed ); this.send.link( embed );
} else if ( 'image' === embed.type ) { } else if ( 'image' === type ) {
_.defaults( embed, { _.defaults( embed, {
title: embed.url, title: embed.url,
linkUrl: '', linkUrl: '',

File diff suppressed because it is too large Load Diff

View File

@ -1467,9 +1467,11 @@ function wp_enqueue_media( $args = array() ) {
// Library // Library
'mediaLibraryTitle' => __( 'Media Library' ), 'mediaLibraryTitle' => __( 'Media Library' ),
'insertMediaTitle' => __( 'Insert Media' ),
'createNewGallery' => __( 'Create a new gallery' ), 'createNewGallery' => __( 'Create a new gallery' ),
'returnToLibrary' => __( '← Return to library' ), 'returnToLibrary' => __( '← Return to library' ),
'allMediaItems' => __( 'All media items' ), 'allMediaItems' => __( 'All media items' ),
'noItemsFound' => __( 'No items found.' ),
'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ), 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ), 'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ), 'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ),
@ -1489,6 +1491,7 @@ function wp_enqueue_media( $args = array() ) {
'updateGallery' => __( 'Update gallery' ), 'updateGallery' => __( 'Update gallery' ),
'continueEditing' => __( 'Continue editing' ), 'continueEditing' => __( 'Continue editing' ),
'addToGallery' => __( 'Add to gallery' ), 'addToGallery' => __( 'Add to gallery' ),
'addToGalleryTitle' => __( 'Add to Gallery' ),
'reverseOrder' => __( 'Reverse order' ), 'reverseOrder' => __( 'Reverse order' ),
); );
@ -1517,6 +1520,8 @@ function wp_print_media_templates() {
?> ?>
<script type="text/html" id="tmpl-media-frame"> <script type="text/html" id="tmpl-media-frame">
<div class="media-frame-menu"></div> <div class="media-frame-menu"></div>
<div class="media-frame-title"></div>
<div class="media-frame-router"></div>
<div class="media-frame-content"></div> <div class="media-frame-content"></div>
<div class="media-frame-toolbar"></div> <div class="media-frame-toolbar"></div>
<div class="media-frame-uploader"></div> <div class="media-frame-uploader"></div>
@ -1524,13 +1529,10 @@ function wp_print_media_templates() {
<script type="text/html" id="tmpl-media-modal"> <script type="text/html" id="tmpl-media-modal">
<div class="media-modal wp-core-ui"> <div class="media-modal wp-core-ui">
<h3 class="media-modal-title">{{ data.title }}</h3> <a class="media-modal-close" href="#" title="<?php esc_attr_e('Close'); ?>"><span class="media-modal-icon"></span></a>
<a class="media-modal-close media-modal-icon" href="#" title="<?php esc_attr_e('Close'); ?>"></a>
<div class="media-modal-content"></div> <div class="media-modal-content"></div>
</div> </div>
<div class="media-modal-backdrop"> <div class="media-modal-backdrop"></div>
<div></div>
</div>
</script> </script>
<script type="text/html" id="tmpl-uploader-window"> <script type="text/html" id="tmpl-uploader-window">
@ -1540,16 +1542,20 @@ function wp_print_media_templates() {
</script> </script>
<script type="text/html" id="tmpl-uploader-inline"> <script type="text/html" id="tmpl-uploader-inline">
<div class="uploader-inline-content"> <# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
<div class="uploader-inline-content {{ messageClass }}">
<# if ( data.message ) { #>
<h3 class="upload-message">{{ data.message }}</h3>
<# } #>
<?php if ( ! _device_can_upload() ) : ?> <?php if ( ! _device_can_upload() ) : ?>
<h3><?php _e('The web browser on your device cannot be used to upload files. You may be able to use the <a href="http://wordpress.org/extend/mobile/">native app for your device</a> instead.'); ?></h3> <h3 class="upload-instructions"><?php _e('The web browser on your device cannot be used to upload files. You may be able to use the <a href="http://wordpress.org/extend/mobile/">native app for your device</a> instead.'); ?></h3>
<?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?> <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
<h3><?php _e( 'Upload Limit Exceeded' ); ?></h3> <h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
<?php do_action( 'upload_ui_over_quota' ); ?> <?php do_action( 'upload_ui_over_quota' ); ?>
<?php else : ?> <?php else : ?>
<div class="upload-ui"> <div class="upload-ui">
<h3 class="drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3> <h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
<a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a> <a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>
</div> </div>
@ -1744,19 +1750,6 @@ function wp_print_media_templates() {
<div class="selection-view"></div> <div class="selection-view"></div>
</script> </script>
<script type="text/html" id="tmpl-media-selection-preview">
<div class="selected-img selected-count-{{ data.count }}">
<# if ( data.thumbnail ) { #>
<img src="{{ data.thumbnail }}" draggable="false" />
<# } #>
<span class="count">{{ data.count }}</span>
</div>
<# if ( data.clearable ) { #>
<a class="clear-selection" href="#"><?php _e('Clear selection'); ?></a>
<# } #>
</script>
<script type="text/html" id="tmpl-attachment-display-settings"> <script type="text/html" id="tmpl-attachment-display-settings">
<h3><?php _e('Attachment Display Settings'); ?></h3> <h3><?php _e('Attachment Display Settings'); ?></h3>