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.toolbar.view().set({
frame.on( 'toolbar:render:select', function( view ) {
view.set({
select: {
style: 'primary',
text: $el.data('update'),

View File

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

View File

@ -1,25 +1,14 @@
/**
* Modal
*/
.media-modal-title {
left: auto;
right: 0;
}
.media-modal-close {
right: auto;
left: 0;
left: 7px;
}
/**
* Toolbar
*/
.media-frame-toolbar > .media-toolbar {
left: 0;
right: 200px;
}
.media-toolbar-primary {
float: left;
}
@ -93,21 +82,51 @@
* Menu
*/
.media-menu {
left: auto;
right: 0;
border-right: 0;
border-left: 1px solid #d9d9d9;
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
*/
.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;
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
*/
@ -225,30 +244,6 @@
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
*/
@ -289,8 +284,10 @@
* Responsive layout
*/
@media only screen and (max-width: 900px) {
.media-frame .region-content,
.media-frame-toolbar > .media-toolbar {
.media-frame-title,
.media-frame-router,
.media-frame-content,
.media-frame-toolbar {
left: 0;
right: 140px;
}

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1467,9 +1467,11 @@ function wp_enqueue_media( $args = array() ) {
// Library
'mediaLibraryTitle' => __( 'Media Library' ),
'insertMediaTitle' => __( 'Insert Media' ),
'createNewGallery' => __( 'Create a new gallery' ),
'returnToLibrary' => __( '← Return to library' ),
'allMediaItems' => __( 'All media items' ),
'noItemsFound' => __( 'No items found.' ),
'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into 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." ),
@ -1489,6 +1491,7 @@ function wp_enqueue_media( $args = array() ) {
'updateGallery' => __( 'Update gallery' ),
'continueEditing' => __( 'Continue editing' ),
'addToGallery' => __( 'Add to gallery' ),
'addToGalleryTitle' => __( 'Add to Gallery' ),
'reverseOrder' => __( 'Reverse order' ),
);
@ -1517,6 +1520,8 @@ function wp_print_media_templates() {
?>
<script type="text/html" id="tmpl-media-frame">
<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-toolbar"></div>
<div class="media-frame-uploader"></div>
@ -1524,13 +1529,10 @@ function wp_print_media_templates() {
<script type="text/html" id="tmpl-media-modal">
<div class="media-modal wp-core-ui">
<h3 class="media-modal-title">{{ data.title }}</h3>
<a class="media-modal-close media-modal-icon" href="#" title="<?php esc_attr_e('Close'); ?>"></a>
<a class="media-modal-close" href="#" title="<?php esc_attr_e('Close'); ?>"><span class="media-modal-icon"></span></a>
<div class="media-modal-content"></div>
</div>
<div class="media-modal-backdrop">
<div></div>
</div>
<div class="media-modal-backdrop"></div>
</script>
<script type="text/html" id="tmpl-uploader-window">
@ -1540,16 +1542,20 @@ function wp_print_media_templates() {
</script>
<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() ) : ?>
<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() ) : ?>
<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 else : ?>
<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>
</div>
@ -1744,19 +1750,6 @@ function wp_print_media_templates() {
<div class="selection-view"></div>
</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">
<h3><?php _e('Attachment Display Settings'); ?></h3>