<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29446] trunk/src/wp-includes: Media: improve the media modal at small screen sizes and make it usable on phones, first run.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29446">29446</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-08-08 03:45:55 +0000 (Fri, 08 Aug 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Media: improve the media modal at small screen sizes and make it usable on phones, first run. Part-props gcorne, see <a href="http://core.trac.wordpress.org/ticket/27423">#27423</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescsseditorcss">trunk/src/wp-includes/css/editor.css</a></li>
<li><a href="#trunksrcwpincludescssmediaviewscss">trunk/src/wp-includes/css/media-views.css</a></li>
<li><a href="#trunksrcwpincludesjsmediaeditorjs">trunk/src/wp-includes/js/media-editor.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsjs">trunk/src/wp-includes/js/media-views.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescsseditorcss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/css/editor.css (29445 => 29446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/css/editor.css 2014-08-08 01:43:45 UTC (rev 29445)
+++ trunk/src/wp-includes/css/editor.css 2014-08-08 03:45:55 UTC (rev 29446)
</span><span class="lines">@@ -176,12 +176,12 @@
</span><span class="cx"> margin: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.mce-path,
-.mce-path-item,
-.mce-path .mce-divider {
- font-size: 12px;
- line-height: 18px;
-}
</del><ins>+.mce-path,
+.mce-path-item,
+.mce-path .mce-divider {
+ font-size: 12px;
+ line-height: 18px;
+}
</ins><span class="cx">
</span><span class="cx"> .mce-toolbar .mce-btn,
</span><span class="cx"> .qt-fullscreen {
</span><span class="lines">@@ -934,32 +934,41 @@
</span><span class="cx"> position: absolute;
</span><span class="cx"> top: 0;
</span><span class="cx"> right: 0;
</span><del>- margin-top: 5px;
- margin-right: 5px;
</del><ins>+ margin: 5px 5px 0 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @media screen and ( max-width: 782px ) {
</span><span class="cx"> .mce-toolbar .mce-btn button,
</span><span class="cx"> .qt-fullscreen {
</span><del>- padding: 7px 8px;
</del><ins>+ padding: 6px 7px;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ #wp-fullscreen-buttons .mce-btn,
+ .mce-toolbar .mce-btn-group .mce-btn {
+ margin: 1px;
+ }
+
</ins><span class="cx"> .qt-fullscreen {
</span><del>- width: 38px;
</del><ins>+ width: 36px;
</ins><span class="cx"> height: 34px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ .mce-toolbar .mce-btn-group .mce-btn.mce-wp-fullscreen {
+ margin: 4px 4px 0 0;
+ }
+
</ins><span class="cx"> .mce-toolbar .mce-colorbutton .mce-preview {
</span><del>- margin-left: -21px;
</del><ins>+ left: 8px;
+ bottom: 6px;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .mce-window .mce-btn {
</span><span class="cx"> padding: 2px 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- div.mce-toolbar-grp,
- .quicktags-toolbar {
- padding-right: 46px;
</del><ins>+ .has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first,
+ .has-dfw .quicktags-toolbar {
+ padding-right: 40px;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunksrcwpincludescssmediaviewscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/css/media-views.css (29445 => 29446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/css/media-views.css 2014-08-08 01:43:45 UTC (rev 29445)
+++ trunk/src/wp-includes/css/media-views.css 2014-08-08 03:45:55 UTC (rev 29446)
</span><span class="lines">@@ -16,7 +16,6 @@
</span><span class="cx"> .media-frame input,
</span><span class="cx"> .media-frame textarea {
</span><span class="cx"> padding: 6px 8px;
</span><del>- line-height: 16px;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .media-frame select,
</span><span class="lines">@@ -144,7 +143,7 @@
</span><span class="cx"> top: 0;
</span><span class="cx"> right: 0;
</span><span class="cx"> width: 50px;
</span><del>- height: 48px;
</del><ins>+ height: 50px;
</ins><span class="cx"> z-index: 1000;
</span><span class="cx"> color: #777;
</span><span class="cx"> -webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
</span><span class="lines">@@ -631,6 +630,10 @@
</span><span class="cx"> box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.media-frame-title .dashicons {
+ display: none;
+}
+
</ins><span class="cx"> .media-frame-title h1 {
</span><span class="cx"> padding: 0 16px;
</span><span class="cx"> font-size: 22px;
</span><span class="lines">@@ -694,7 +697,6 @@
</span><span class="cx"> .media-frame .search {
</span><span class="cx"> margin-top: 11px;
</span><span class="cx"> padding: 4px;
</span><del>- line-height: 18px;
</del><span class="cx"> font-size: 13px;
</span><span class="cx"> color: #464646;
</span><span class="cx"> font-family: "Open Sans", sans-serif;
</span><span class="lines">@@ -730,7 +732,7 @@
</span><span class="cx"> -moz-user-select: none;
</span><span class="cx"> -ms-user-select: none;
</span><span class="cx"> user-select: none;
</span><del>- width: 20%;
</del><ins>+ width: 25%;
</ins><span class="cx"> -webkit-box-sizing: border-box;
</span><span class="cx"> -moz-box-sizing: border-box;
</span><span class="cx"> box-sizing: border-box;
</span><span class="lines">@@ -1790,11 +1792,16 @@
</span><span class="cx"> padding: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.image-details .embed-media-settings,
+.image-details .embed-media-settings div {
+ box-sizing: border-box;
+}
+
</ins><span class="cx"> .image-details .column-settings {
</span><span class="cx"> background: #f3f3f3;
</span><span class="cx"> border-right: 1px solid #ddd;
</span><span class="cx"> min-height: 100%;
</span><del>- width: 52%;
</del><ins>+ width: 55%;
</ins><span class="cx"> position: absolute;
</span><span class="cx"> top: 0;
</span><span class="cx"> left: 0;
</span><span class="lines">@@ -1807,9 +1814,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .image-details .column-image {
</span><del>- width: 48%;
</del><ins>+ width: 45%;
</ins><span class="cx"> position: absolute;
</span><del>- left: 52%;
</del><ins>+ left: 55%;
</ins><span class="cx"> top: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2125,10 +2132,10 @@
</span><span class="cx"> font-family: Arial, sans-serif;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 960px) {
</del><ins>+@media only screen and (max-width: 940px) {
</ins><span class="cx"> .media-frame-content .media-toolbar-primary .search,
</span><span class="cx"> .media-frame-content .media-toolbar-secondary .attachment-filters {
</span><del>- max-width: 120px;
</del><ins>+ max-width: 134px;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2136,32 +2143,74 @@
</span><span class="cx"> * Responsive layout
</span><span class="cx"> */
</span><span class="cx"> @media only screen and (max-width: 900px) {
</span><ins>+
+ /* Drop-down menu */
+ .media-frame-title,
+ .media-frame-router,
+ .media-frame-content,
+ .media-frame-toolbar {
+ left: 0;
+ }
+
</ins><span class="cx"> .media-frame-menu {
</span><del>- width: 139px;
</del><ins>+ position: static;
+ width: 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ .media-menu {
+ display: none;
+ }
+
+ .media-menu.visible {
+ z-index: 2000;
+ display: block;
+ position: fixed;
+ top: 30px;
+ left: 30px;
+ right: 30px;
+ bottom: 30px;
+ width: 250px;
+ max-width: 100%;
+ overflow: auto;
+ }
+
</ins><span class="cx"> .media-menu > a {
</span><del>- padding: 4px 5px;
</del><ins>+ padding: 10px 20px;
+ font-size: 16px;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- .media-frame-title,
- .media-frame-router,
- .media-frame-content,
- .media-frame-toolbar {
- left: 140px;
</del><ins>+ .media-frame-title {
+ left: 0;
+ color: #21759b;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ .media-frame-title .dashicons {
+ display: inline-block;
+ line-height: 56px;
+ }
+
+ .media-frame-title h1 {
+ line-height: 3;
+ font-size: 18px;
+ float: left;
+ cursor: pointer;
+ }
+ /* End drop-down menu */
+
</ins><span class="cx"> .media-sidebar {
</span><del>- width: 159px;
- padding: 0 10px 24px;
</del><ins>+ width: 230px;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .attachments-browser .attachments,
</span><span class="cx"> .attachments-browser .uploader-inline,
</span><span class="cx"> .attachments-browser .media-toolbar {
</span><del>- right: 180px;
</del><ins>+ right: 262px;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ .media-sidebar .setting {
+ margin: 6px 0px;
+ }
+
</ins><span class="cx"> .media-sidebar .setting input,
</span><span class="cx"> .media-sidebar .setting textarea,
</span><span class="cx"> .media-sidebar .setting span,
</span><span class="lines">@@ -2172,12 +2221,16 @@
</span><span class="cx"> .media-sidebar .setting span,
</span><span class="cx"> .compat-item label span {
</span><span class="cx"> text-align: inherit;
</span><del>- display: block;
</del><span class="cx"> min-height: 16px;
</span><span class="cx"> margin: 0;
</span><span class="cx"> padding: 8px 2px 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ .media-sidebar .setting .value {
+ float: none;
+ width: auto;
+ }
+
</ins><span class="cx"> .media-sidebar .setting input[type="text"],
</span><span class="cx"> .media-sidebar .setting input[type="password"],
</span><span class="cx"> .media-sidebar .setting input[type="email"],
</span><span class="lines">@@ -2189,6 +2242,7 @@
</span><span class="cx"> .media-sidebar .setting select {
</span><span class="cx"> width: 98%;
</span><span class="cx"> max-width: none;
</span><ins>+ height: auto;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .media-sidebar .setting select.columns {
</span><span class="lines">@@ -2201,6 +2255,15 @@
</span><span class="cx"> padding: 3px 6px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ .image-details .column-image {
+ width: 30%;
+ left: 70%;
+ }
+
+ .image-details .column-settings {
+ width: 70%;
+ }
+
</ins><span class="cx"> .image-details .media-modal {
</span><span class="cx"> left: 30px;
</span><span class="cx"> right: 30px;
</span><span class="lines">@@ -2244,10 +2307,28 @@
</span><span class="cx"> margin: 12px 10px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- .media-modal-close {
- right: 10px;
</del><ins>+ .media-modal .attachments-browser .media-toolbar-primary,
+ .media-modal .attachments-browser .media-toolbar-secondary {
+ width: 50%;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ .media-modal .attachments-browser .media-toolbar .search {
+ max-width: 100%;
+ height: auto;
+ float: right;
+ }
+
+ .media-modal .attachments-browser .media-toolbar .attachment-filters {
+ margin: 11px 0 0;
+ height: auto;
+ max-width: 65%;
+ max-width: calc(100% - 38px);
+ }
+
+ .media-modal .attachments-browser .media-toolbar .spinner {
+ margin: 14px 8px 0;
+ }
+
</ins><span class="cx"> /* Text inputs need to be 16px, or they force zooming on iOS */
</span><span class="cx"> .media-frame input[type="text"],
</span><span class="cx"> .media-frame input[type="password"],
</span><span class="lines">@@ -2263,142 +2344,10 @@
</span><span class="cx">
</span><span class="cx"> /* Responsive on portrait and landscape */
</span><span class="cx"> @media only screen and (max-width: 640px), screen and (max-height: 400px) {
</span><del>-
- /* Media tabs on the top */
- .media-frame-content .media-toolbar .instructions {
- display: none;
- }
-
- .media-frame-menu {
- width: auto;
- bottom: auto;
- right: 0;
- height: 60px;
- }
-
- .media-menu {
- border-right: none;
- position: relative;
- border-bottom: 1px solid #dddddd;
- overflow: hidden;
- padding: 10px 0 10px 10px;
- }
-
- .media-menu a {
- float: left;
- width: 42%;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
-
- .media-frame-title {
- display: none;
- }
-
- .image-details .media-frame-title {
- display: block;
- top: 0;
- font-size: 14px;
- }
-
- .media-frame-toolbar {
- position: absolute;
- bottom: 0px;
- left: 0;
- right: 0;
- background: #FFF;
- border-top: 1px solid #DEDEDE;
- }
-
- .media-toolbar {
- position: relative;
- }
-
- .media-frame {
- overflow: hidden;
- }
-
- .attachments-browser .attachments {
- top: 42px;
- }
-
- .attachment-details h3 {
- margin-top: 45px;
- }
-
- /* Shorten right-side links so they don't overlap the close button */
- .media-menu a:nth-child(2),
- .media-menu a:last-child {
- width: 40%;
- }
-
- .media-menu .separator {
- display: none;
- }
-
- .media-frame-title {
- top: 72px;
- left: auto;
- height: auto;
- }
-
- .media-frame-title h1 {
- line-height: 3;
- font-size: 18px;
- }
-
- .media-frame-router {
- top: 84px;
- left: 0;
- }
-
- .media-frame-content {
- left: 0;
- top: 118px;
- }
-
- .image-details .media-frame.hide-router .media-frame-content {
- top: 40px;
- }
-
- .media-frame .attachments-browser {
- padding-bottom: 300px;
- }
-
- .media-sidebar {
- border-bottom: 1px solid #dddddd;
- }
-
- .media-modal {
- width: auto;
- }
-
- .media-toolbar-primary, .media-toolbar-secondary {
- height: auto;
- }
-
- .uploader-inline-content {
- top: auto;
- }
-
- .uploader-inline-content .upload-ui {
- margin: 1em 0;
- }
-
- .uploader-inline-content .post-upload-ui {
- margin-bottom: 1em;
- }
-
- .attachments-browser .attachments,
- .attachments-browser .uploader-inline {
- position: relative;
- margin-right: 180px;
- }
-
</del><span class="cx"> /* Full-bleed modal */
</span><span class="cx"> .media-modal,
</span><del>- .image-details .media-modal {
</del><ins>+ .image-details .media-modal,
+ .media-menu.visible {
</ins><span class="cx"> position: fixed;
</span><span class="cx"> top: 0;
</span><span class="cx"> left: 0;
</span><span class="lines">@@ -2410,71 +2359,36 @@
</span><span class="cx"> position: fixed;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- .attachments-browser .attachment,
- .attachments-browser .attachment-preview {
- max-width: 100%;
</del><ins>+ .media-sidebar {
+ display: none;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- .attachments-browser .media-toolbar-primary input.search {
- max-width: 150px;
</del><ins>+ .attachments-browser .attachments,
+ .attachments-browser .uploader-inline,
+ .attachments-browser .media-toolbar {
+ right: 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- .uploader-inline-content {
- position: relative;
- }
</del><span class="cx">
</span><del>- /* Image From Link */
- .embed-link-settings,
- .embed-media-settings {
- padding-bottom: 52px;
- }
</del><span class="cx">
</span><del>- .image-details .column-settings,
- .image-details .column-image {
- position: relative;
- padding: 10px 0 20px 0;
- left: 0;
- width: 100%;
- min-height: inherit;
</del><ins>+ .image-details .media-frame-title {
+ display: block;
+ top: 0;
+ font-size: 14px;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-
- /* Gallery */
- .media-frame.hide-router .media-frame-content {
- top: 73px;
- border-top: none;
</del><ins>+ /* Media tabs on the top */
+ .media-frame-content .media-toolbar .instructions {
+ display: none;
</ins><span class="cx"> }
</span><del>-
- .collection-settings h3 {
- margin-top: 45px;
- }
-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Landscape specific header override */
</span><span class="cx"> @media screen and (max-height: 400px) {
</span><span class="cx"> .media-menu {
</span><del>- padding: 0 0 0 10px;
</del><ins>+ padding: 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- .media-menu a {
- float: left;
- width: 21%;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- padding: 10px inherit;
- }
-
- .media-menu a:nth-child(2),
- .media-menu a:last-child {
- width: 21%;
- }
-
- .media-modal-close {
- top: 2px;
- }
-
</del><span class="cx"> .media-frame-router {
</span><span class="cx"> top: 44px;
</span><span class="cx"> }
</span><span class="lines">@@ -2484,7 +2398,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .attachments-browser .attachments {
</span><del>- top: 2px;
</del><ins>+ top: 40px;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /* Prevent unnecessary scrolling on title input */
</span><span class="lines">@@ -2493,10 +2407,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-@media only screen and (max-width: 680px) {
</del><ins>+@media only screen and (max-width: 480px) {
</ins><span class="cx"> .media-frame-content .media-toolbar .search,
</span><span class="cx"> .media-frame-content .media-toolbar .attachment-filters {
</span><del>- max-width: 85px;
</del><ins>+ max-width: 90px;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2884,7 +2798,7 @@
</span><span class="cx"> margin: 20px 0;
</span><span class="cx"> position: static;
</span><span class="cx"> width: 100%;
</span><del>- max-width: none !important;
</del><ins>+ max-width: 280px;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaeditorjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-editor.js (29445 => 29446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-editor.js 2014-08-08 01:43:45 UTC (rev 29445)
+++ trunk/src/wp-includes/js/media-editor.js 2014-08-08 03:45:55 UTC (rev 29446)
</span><span class="lines">@@ -1048,16 +1048,20 @@
</span><span class="cx"> * @returns {wp.media.view.MediaFrame}
</span><span class="cx"> */
</span><span class="cx"> open: function( id, options ) {
</span><del>- var workflow, focusTrap;
</del><ins>+ var workflow, focusTrap, scrollTop;
</ins><span class="cx">
</span><span class="cx"> if ( 'ontouchend' in document ) {
</span><span class="cx"> // Close the onscreen keyboard
</span><span class="cx"> if ( ! focusTrap ) {
</span><del>- focusTrap = $( '<input type="text" />' );
</del><ins>+ focusTrap = $( '<input type="text" style="width: 1px; height: 1px;" />' );
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Keep the scroll position
+ scrollTop = $( window ).scrollTop();
+
</ins><span class="cx"> $( document.body ).append( focusTrap );
</span><span class="cx"> focusTrap.focus().blur().remove();
</span><ins>+ $( window ).scrollTop( scrollTop );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> options = options || {};
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-views.js (29445 => 29446)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-views.js 2014-08-08 01:43:45 UTC (rev 29445)
+++ trunk/src/wp-includes/js/media-views.js 2014-08-08 03:45:55 UTC (rev 29446)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><span class="cx"> /* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */
</span><del>-(function($, _){
- var media = wp.media, l10n;
</del><ins>+( function( $, _ ) {
+ var l10n,
+ media = wp.media,
+ isTouchDevice = ( 'ontouchend' in document );
</ins><span class="cx">
</span><span class="cx"> // Link any localized strings.
</span><span class="cx"> l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
</span><span class="lines">@@ -1834,6 +1836,10 @@
</span><span class="cx"> template: media.template('media-frame'),
</span><span class="cx"> regions: ['menu','title','content','toolbar','router'],
</span><span class="cx">
</span><ins>+ events: {
+ 'click div.media-frame-title h1': 'toggleMenu'
+ },
+
</ins><span class="cx"> /**
</span><span class="cx"> * @global wp.Uploader
</span><span class="cx"> */
</span><span class="lines">@@ -1883,6 +1889,10 @@
</span><span class="cx"> this.on( 'title:create:default', this.createTitle, this );
</span><span class="cx"> this.title.mode('default');
</span><span class="cx">
</span><ins>+ this.on( 'title:render', function( view ) {
+ view.$el.append( '<span class="dashicons dashicons-arrow-down"></span>' );
+ });
+
</ins><span class="cx"> // Bind default menu.
</span><span class="cx"> this.on( 'menu:create:default', this.createMenu, this );
</span><span class="cx"> },
</span><span class="lines">@@ -1918,6 +1928,11 @@
</span><span class="cx"> controller: this
</span><span class="cx"> });
</span><span class="cx"> },
</span><ins>+
+ toggleMenu: function() {
+ this.$el.find( '.media-menu' ).toggleClass( 'visible' );
+ },
+
</ins><span class="cx"> /**
</span><span class="cx"> * @param {Object} toolbar
</span><span class="cx"> * @this wp.media.controller.Region
</span><span class="lines">@@ -2555,7 +2570,10 @@
</span><span class="cx"> }).render();
</span><span class="cx">
</span><span class="cx"> this.content.set( view );
</span><del>- view.url.focus();
</del><ins>+
+ if ( ! isTouchDevice ) {
+ view.url.focus();
+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> editSelectionContent: function() {
</span><span class="lines">@@ -4412,13 +4430,17 @@
</span><span class="cx">
</span><span class="cx"> // When selecting a tab along the left side,
</span><span class="cx"> // focus should be transferred into the main panel
</span><del>- $('.media-frame-content input').first().focus();
</del><ins>+ if ( ! isTouchDevice ) {
+ $('.media-frame-content input').first().focus();
+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> click: function() {
</span><span class="cx"> var state = this.options.state;
</span><ins>+
</ins><span class="cx"> if ( state ) {
</span><span class="cx"> this.controller.setState( state );
</span><ins>+ this.views.parent.$el.removeClass( 'visible' ); // TODO: or hide on any click, see below
</ins><span class="cx"> }
</span><span class="cx"> },
</span><span class="cx"> /**
</span><span class="lines">@@ -4452,6 +4474,17 @@
</span><span class="cx"> property: 'state',
</span><span class="cx"> ItemView: media.view.MenuItem,
</span><span class="cx"> region: 'menu',
</span><ins>+
+ /* TODO: alternatively hide on any click anywhere
+ events: {
+ 'click': 'click'
+ },
+
+ click: function() {
+ this.$el.removeClass( 'visible' );
+ },
+ */
+
</ins><span class="cx"> /**
</span><span class="cx"> * @param {Object} options
</span><span class="cx"> * @param {string} id
</span><span class="lines">@@ -4615,6 +4648,7 @@
</span><span class="cx"> tagName: 'li',
</span><span class="cx"> className: 'attachment',
</span><span class="cx"> template: media.template('attachment'),
</span><ins>+ _isTouch: false,
</ins><span class="cx">
</span><span class="cx"> attributes: {
</span><span class="cx"> tabIndex: 0,
</span><span class="lines">@@ -4623,6 +4657,7 @@
</span><span class="cx">
</span><span class="cx"> events: {
</span><span class="cx"> 'click .js--select-attachment': 'toggleSelectionHandler',
</span><ins>+ 'touchend .attachment-preview': 'setTouch',
</ins><span class="cx"> 'change [data-setting]': 'updateSetting',
</span><span class="cx"> 'change [data-setting] input': 'updateSetting',
</span><span class="cx"> 'change [data-setting] select': 'updateSetting',
</span><span class="lines">@@ -4747,6 +4782,11 @@
</span><span class="cx"> this.$bar.width( this.model.get('percent') + '%' );
</span><span class="cx"> }
</span><span class="cx"> },
</span><ins>+
+ setTouch: function() {
+ this._isTouch = true;
+ },
+
</ins><span class="cx"> /**
</span><span class="cx"> * @param {Object} event
</span><span class="cx"> */
</span><span class="lines">@@ -4785,6 +4825,11 @@
</span><span class="cx"> method = 'toggle';
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if ( this._isTouch ) {
+ this._isTouch = false;
+ method = 'add';
+ }
+
</ins><span class="cx"> this.toggleSelection({
</span><span class="cx"> method: method
</span><span class="cx"> });
</span><span class="lines">@@ -4878,7 +4923,9 @@
</span><span class="cx"> selection.single( model );
</span><span class="cx">
</span><span class="cx"> // When selecting attachments, focus should be transferred to the right details panel
</span><del>- $('.attachment-details input').first().focus();
</del><ins>+ if ( ! isTouchDevice ) {
+ $('.attachment-details input').first().focus();
+ }
</ins><span class="cx">
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -4888,12 +4935,16 @@
</span><span class="cx"> selection[ this.selected() ? 'remove' : 'add' ]( model );
</span><span class="cx"> selection.single( model );
</span><span class="cx">
</span><del>- if ( this.selected() ) {
</del><ins>+ if ( ! isTouchDevice && this.selected() ) {
</ins><span class="cx"> // When selecting an attachment, focus should be transferred to the right details panel
</span><span class="cx"> $('.attachment-details input').first().focus();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return;
</span><ins>+ } else if ( 'add' === method ) {
+ selection.add( model );
+ selection.single( model );
+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Fixes bug that loses focus when selecting a featured image
</span><span class="lines">@@ -4948,7 +4999,9 @@
</span><span class="cx"> .find( '.check' ).attr( 'tabindex', '0' );
</span><span class="cx">
</span><span class="cx"> // When selecting an attachment, focus should be transferred to the right details panel
</span><del>- $('.attachment-details input').first().focus();
</del><ins>+ if ( ! isTouchDevice ) {
+ $('.attachment-details input').first().focus();
+ }
</ins><span class="cx"> },
</span><span class="cx"> /**
</span><span class="cx"> * @param {Backbone.Model} model
</span><span class="lines">@@ -5215,12 +5268,12 @@
</span><span class="cx"> this.el.id = _.uniqueId('__attachments-view-');
</span><span class="cx">
</span><span class="cx"> _.defaults( this.options, {
</span><del>- refreshSensitivity: 200,
</del><ins>+ refreshSensitivity: isTouchDevice ? 300 : 200,
</ins><span class="cx"> refreshThreshold: 3,
</span><span class="cx"> AttachmentView: media.view.Attachment,
</span><span class="cx"> sortable: false,
</span><span class="cx"> resize: true,
</span><del>- idealColumnWidth: 150
</del><ins>+ idealColumnWidth: $( window ).width() < 640 ? 135 : 150
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> this._viewsByCid = {};
</span><span class="lines">@@ -5253,7 +5306,8 @@
</span><span class="cx"> _.bindAll( this, 'setColumns' );
</span><span class="cx">
</span><span class="cx"> if ( this.options.resize ) {
</span><del>- $( window ).on( 'resize.attachments', this.setColumns );
</del><ins>+ $( window ).on( 'resize.media-modal-columns', this.setColumns );
+ this.controller.on( 'open', this.setColumns );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Call this.setColumns() after this view has been rendered in the DOM so
</span><span class="lines">@@ -5263,7 +5317,7 @@
</span><span class="cx">
</span><span class="cx"> dispose: function() {
</span><span class="cx"> this.collection.props.off( null, null, this );
</span><del>- $( window ).off( 'resize.attachments', this.setColumns );
</del><ins>+ $( window ).off( 'resize.media-modal-columns' );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * call 'dispose' directly on the parent class
</span><span class="lines">@@ -5272,19 +5326,22 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> setColumns: function() {
</span><del>- var prev = this.columns;
</del><ins>+ var prev = this.columns,
+ width = this.$el.width();
</ins><span class="cx">
</span><del>- this.columns = Math.round( this.$el.width() / this.options.idealColumnWidth );
</del><ins>+ if ( width ) {
+ this.columns = Math.round( width / this.options.idealColumnWidth ) || 1;
</ins><span class="cx">
</span><del>- if ( prev !== this.columns ) {
- this.$el.attr( 'data-columns', this.columns );
</del><ins>+ if ( ! prev || prev !== this.columns ) {
+ this.$el.attr( 'data-columns', this.columns );
+ }
</ins><span class="cx"> }
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> initSortable: function() {
</span><span class="cx"> var collection = this.collection;
</span><span class="cx">
</span><del>- if ( ! this.options.sortable || ! $.fn.sortable ) {
</del><ins>+ if ( isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) {
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -5347,7 +5404,7 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> refreshSortable: function() {
</span><del>- if ( ! this.options.sortable || ! $.fn.sortable ) {
</del><ins>+ if ( isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) {
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -6273,7 +6330,7 @@
</span><span class="cx"> $input.removeClass( 'hidden' );
</span><span class="cx">
</span><span class="cx"> // If the input is visible, focus and select its contents.
</span><del>- if ( $input.is(':visible') ) {
</del><ins>+ if ( ! isTouchDevice && $input.is(':visible') ) {
</ins><span class="cx"> $input.focus()[0].select();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -6633,7 +6690,9 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> ready: function() {
</span><del>- this.focus();
</del><ins>+ if ( ! isTouchDevice ) {
+ this.focus();
+ }
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> url: function( event ) {
</span></span></pre>
</div>
</div>
</body>
</html>