Ticket #27423: 27423.11.patch
File 27423.11.patch, 23.1 KB (added by , 11 years ago) |
---|
-
src/wp-includes/css/media-views.css
89 89 display: none; 90 90 } 91 91 92 body.modal-open { 93 overflow: hidden; 94 } 95 92 96 /* Enable draggable on IE10 touch events until it's rolled into jQuery UI core */ 93 97 .ui-sortable, 94 98 .ui-draggable { … … 145 149 right: 10px; 146 150 width: 30px; 147 151 height: 30px; 148 z-index: 1000;152 z-index: 200; 149 153 } 150 154 151 155 .media-modal-close span.media-modal-icon { … … 535 539 left: 200px; 536 540 right: 0; 537 541 height: 56px; 538 z-index: 200;542 z-index: 199; 539 543 } 540 544 541 545 .media-frame-router { … … 683 687 */ 684 688 .attachments { 685 689 margin: 0; 686 padding -right: 16px;690 padding: 8px; 687 691 -webkit-overflow-scrolling: touch; 688 692 } 689 693 … … 705 709 } 706 710 707 711 .attachment:focus { 712 outline: none; 713 } 714 715 .attachment:focus .thumbnail { 708 716 -webkit-box-shadow: 709 717 0 0 0 1px #5b9dd9, 710 718 0 0 2px 2px #5b9dd9; 711 719 box-shadow: 712 720 0 0 0 1px #5b9dd9, 713 721 0 0 2px 2px #5b9dd9; 714 outline: none;715 722 } 716 723 717 .selected.attachment {724 .selected.attachment .thumbnail { 718 725 -webkit-box-shadow: 719 726 0 0 0 1px #fff, 720 727 0 0 0 3px #ccc; … … 723 730 0 0 0 3px #ccc; 724 731 } 725 732 726 . attachment-preview{733 .thumbnail { 727 734 position: relative; 728 width: 199px;729 height: 199px;730 735 -webkit-box-shadow: 731 736 inset 0 0 15px rgba( 0, 0, 0, 0.1 ), 732 737 inset 0 0 0 1px rgba( 0, 0, 0, 0.05 ); … … 740 745 .attachment .icon { 741 746 margin: 0 auto; 742 747 overflow: hidden; 743 padding-top: 20%;744 748 } 745 749 746 750 .attachment .thumbnail { … … 762 766 max-height: 98%; 763 767 } 764 768 765 .media-frame-content .attachment-preview.type-audio .icon,766 .media-frame-content .attachment-preview.type-video .icon {767 z-index: 2;768 background: #f1f1f1;769 position: relative;770 padding: 0;771 top: 15%;772 left: auto;773 right: auto;774 }775 776 769 .attachment-preview.type-audio .filename, 777 770 .attachment-preview.type-video .filename { 778 771 z-index: 3; … … 835 828 padding: 5px 10px; 836 829 } 837 830 838 .attachment-preview .thumbnail {839 width: 199px;840 height: 199px;841 }842 843 831 .attachment .thumbnail img { 844 832 position: absolute; 845 833 } … … 881 869 width: 24px; 882 870 position: absolute; 883 871 z-index: 10; 884 top: -6px;885 right: -6px;872 top: 0; 873 right: 0; 886 874 outline: none; 887 875 background: #eee; 888 876 -webkit-box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba( 0, 0, 0, 0.4 ); … … 904 892 display: block; 905 893 } 906 894 907 .attachment.details ,908 .media-grid-view .selected .attachment{895 .attachment.details .thumbnail, 896 .media-grid-view .selected .thumbnail { 909 897 -webkit-box-shadow: 0 0 0 1px #fff, 910 898 0 0 0 5px #1e8cbe; 911 899 box-shadow: 0 0 0 1px #fff, … … 1464 1452 .media-selection .attachments { 1465 1453 display: inline-block; 1466 1454 height: 48px; 1467 margin-top: 5px;1468 1455 overflow: hidden; 1469 1456 vertical-align: top; 1470 1457 } … … 1473 1460 width: 50%; 1474 1461 } 1475 1462 1463 .wp-core-ui .show-image-details { 1464 display: none; 1465 } 1466 1476 1467 .attachment.selection.selected { 1477 1468 -webkit-box-shadow: none; 1478 1469 box-shadow: none; … … 1533 1524 margin-top: 14px; 1534 1525 } 1535 1526 1536 /** 1537 * Attachment Details 1538 */ 1539 .attachment-details { 1540 position: relative; 1541 overflow: auto; 1542 } 1543 1544 .attachment-details .settings-save-status { 1527 .media-sidebar .settings-save-status { 1528 background: #f5f5f5; 1545 1529 float: right; 1546 1530 text-transform: none; 1547 1531 z-index: 10; 1548 1532 } 1549 1533 1550 . attachment-details.settings-save-status .spinner {1534 .media-sidebar .settings-save-status .spinner { 1551 1535 margin: 0 5px 0; 1552 1536 } 1553 1537 1554 . attachment-details.settings-save-status .saved {1538 .media-sidebar .settings-save-status .saved { 1555 1539 float: right; 1556 1540 display: none; 1557 1541 } 1558 1542 1559 . attachment-details.save-waiting .settings-save-status .spinner,1560 . attachment-details.save-complete .settings-save-status .saved {1543 .media-sidebar .save-waiting .settings-save-status .spinner, 1544 .media-sidebar .save-complete .settings-save-status .saved { 1561 1545 display: block; 1562 1546 } 1563 1547 1548 /** 1549 * Attachment Details 1550 */ 1551 .attachment-details { 1552 position: relative; 1553 overflow: auto; 1554 } 1555 1564 1556 .attachment-info { 1565 1557 overflow: hidden; 1566 1558 min-height: 60px; … … 1652 1644 display: block; 1653 1645 } 1654 1646 1655 . media-modal.delete-attachment,1656 . media-modal.trash-attachment {1647 .attachment-info .delete-attachment, 1648 .attachment-info .trash-attachment { 1657 1649 color: #bc0b0b; 1658 1650 } 1659 1651 1660 . media-modal.delete-attachment:hover,1661 . media-modal.trash-attachment:hover {1652 .attachment-info .delete-attachment:hover, 1653 .attachment-info .trash-attachment:hover { 1662 1654 color: red; 1663 1655 } 1664 1656 … … 2249 2241 padding: 3px 6px; 2250 2242 } 2251 2243 2252 .media-frame-content .attachment .icon {2253 top: 40%;2254 }2255 2256 2244 .image-details .media-modal { 2257 2245 left: 30px; 2258 2246 right: 30px; … … 2284 2272 min-width: 120px; 2285 2273 } 2286 2274 2287 .media-selection:after { 2288 background: none; 2289 } 2290 2275 .media-selection:after, 2291 2276 .media-selection .attachments { 2292 2277 display: none; 2293 2278 } … … 2313 2298 } 2314 2299 } 2315 2300 2301 .switch-to-uploader, 2302 .wp-core-ui .back-to-library { 2303 display: none; 2304 } 2305 2316 2306 /* Responsive on portrait and landscape */ 2317 2307 @media only screen and (max-width: 640px), screen and (max-height: 400px) { 2318 2308 2319 2309 /* Media tabs on the top */ 2320 .media-frame-content .media-toolbar .instructions { 2310 .media-frame-content .media-toolbar .instructions, 2311 .media-frame-router, 2312 .media-selection .selection-info { 2321 2313 display: none; 2322 2314 } 2323 2315 2316 .wp-core-ui .show-image-details { 2317 display: inline-block; 2318 margin-top: 14px; 2319 } 2320 2324 2321 .media-frame-menu { 2325 width: auto; 2326 bottom: auto; 2327 right: 0; 2328 height: 60px; 2322 top: 30px; 2323 left: 0; 2324 z-index: inherit; 2329 2325 } 2330 2326 2331 2327 .media-menu { 2332 border-right: none; 2328 z-index: inherit; 2329 width: 200px; 2333 2330 position: relative; 2334 border-bottom: 1px solid #dddddd;2335 overflow: hidden;2336 2331 padding: 10px 0 10px 10px; 2332 display: none; 2333 border: 1px solid #ccc; 2337 2334 } 2338 2335 2339 .media-menu a { 2340 float: left; 2341 width: 42%; 2342 white-space: nowrap; 2343 text-overflow: ellipsis; 2344 overflow: hidden; 2336 .media-menu.visible { 2337 z-index: 2000; 2338 display: block; 2339 position: fixed; 2340 top: 0; 2341 bottom: 0; 2342 left: 0; 2343 right: 0; 2344 width: auto; 2345 border: none; 2346 padding: 10px 0; 2347 overflow: auto; 2348 } 2349 2350 .media-menu > a { 2351 padding: 20px; 2352 width: auto !important; 2353 text-align: center; 2354 font-size: 20px; 2345 2355 } 2346 2356 2347 2357 .media-frame-title { 2348 display: none; 2358 left: 0; 2359 } 2360 2361 .media-frame-title h1 { 2362 display: inline-block; 2363 cursor: pointer; 2364 } 2365 2366 .media-frame-title h1:after { 2367 display: inline-block; 2368 width: 54px; 2369 height: 54px; 2370 font: normal 20px/54px dashicons; 2371 content: '\f140'; 2372 -webkit-font-smoothing: antialiased; 2373 -moz-osx-font-smoothing: grayscale; 2374 vertical-align: bottom; 2375 z-index: 100; 2349 2376 } 2350 2377 2351 2378 .image-details .media-frame-title { … … 2359 2386 bottom: 0px; 2360 2387 left: 0; 2361 2388 right: 0; 2362 background: #FFF; 2363 border-top: 1px solid #DEDEDE; 2389 background: #fff; 2364 2390 } 2365 2391 2366 2392 .media-toolbar { 2367 2393 position: relative; 2368 2394 } 2369 2395 2396 .media-toolbar .spinner { 2397 margin-right: 6px; 2398 } 2399 2370 2400 .media-frame { 2371 2401 overflow: hidden; 2372 2402 } 2373 2403 2374 2404 .attachments-browser .attachments { 2375 top: 42px; 2376 } 2377 2378 .attachment-details h3 { 2379 margin-top: 45px; 2405 right: 0; 2380 2406 } 2381 2407 2382 2408 /* Shorten right-side links so they don't overlap the close button */ … … 2389 2415 display: none; 2390 2416 } 2391 2417 2392 .media-frame-title { 2418 .attachment-details { 2419 padding: 0 20px; 2420 } 2421 2422 .attachment-display-settings { 2423 padding: 0 20px 20px 20px; 2424 width: -webkit-calc(100% - 40px); 2425 width: calc(100% - 40px); 2426 } 2427 2428 .attachment-info .thumbnail img { 2429 max-width: 100%; /* Display the image bigger, since the screen's smaller. */ 2430 max-height: 50%; 2431 } 2432 2433 .image-details .media-frame-title { 2393 2434 top: 72px; 2394 left: auto;2395 height: auto;2396 2435 } 2397 2436 2398 2437 .media-frame-title h1 { … … 2400 2439 font-size: 18px; 2401 2440 } 2402 2441 2403 .media-frame-router {2404 top: 84px;2405 left: 0;2406 }2407 2408 2442 .media-frame-content { 2409 2443 left: 0; 2410 top: 118px;2444 top: 54px; 2411 2445 } 2412 2446 2413 2447 .image-details .media-frame.hide-router .media-frame-content { 2414 2448 top: 40px; 2415 2449 } 2416 2450 2417 .media-frame .attachments-browser { 2418 padding-bottom: 300px; 2451 .media-sidebar { 2452 position: fixed; 2453 top: 0; 2454 right: -100%; 2455 width: 100%; 2456 padding: 0; 2457 margin: 0 0 62px 0; 2458 z-index: 201; 2419 2459 } 2420 2460 2421 .media-sidebar {2422 border-bottom: 1px solid #dddddd;2461 .media-sidebar.active { 2462 right: 0; 2423 2463 } 2424 2464 2425 2465 .media-modal { 2426 2466 width: auto; 2427 2467 } 2428 2468 2429 .media-toolbar-primary, .media-toolbar-secondary { 2469 .media-toolbar-primary, 2470 .media-toolbar-secondary { 2430 2471 height: auto; 2431 2472 } 2432 2473 2474 .attachments-browser .media-toolbar-primary, 2475 .attachments-browser .media-toolbar-secondary { 2476 width: 50%; 2477 } 2478 2479 .media-frame .media-frame-content .media-toolbar .search, 2480 .media-frame .media-frame-content .media-toolbar .attachment-filters { 2481 max-width: 200px; 2482 width: -webkit-calc(100% - 16px); 2483 width: calc(100% - 16px); 2484 margin: 11px 0 0 0; 2485 height: 28px; 2486 } 2487 2488 .media-frame .media-frame-content .media-toolbar .search { 2489 float: right; 2490 } 2491 2433 2492 .uploader-inline h3 { 2434 2493 margin: 0 0 .8em 0; 2435 2494 } … … 2442 2501 margin: 0; 2443 2502 } 2444 2503 2445 .attachments-browser .attachments, .attachments-browser .uploader-inline {2446 position: relative;2447 margin-right: 180px;2448 }2449 2450 2504 /* Full-bleed modal */ 2451 2505 .media-modal, 2452 2506 .image-details .media-modal { … … 2466 2520 max-width: 100%; 2467 2521 } 2468 2522 2469 .attachments-browser .media-toolbar-primary input.search {2470 max-width: 150px;2471 }2472 2473 2523 .uploader-inline-content { 2474 2524 position: relative; 2475 2525 } … … 2505 2555 margin-top: 45px; 2506 2556 } 2507 2557 2508 } 2558 /* Edit-selection mode */ 2559 .close.media-modal-icon { 2560 display: block; 2561 height: 100%; 2562 width: 100%; 2563 margin: 0; 2564 padding: 0; 2565 position: absolute; 2566 top: 0; 2567 right: 0; 2568 border: none; 2569 -webkit-box-shadow: none; 2570 box-shadow: none; 2571 background: transparent; 2572 } 2509 2573 2510 /* Landscape specific header override */ 2511 @media screen and (max-height: 400px) { 2512 .media-menu { 2513 padding: 0 0 0 10px; 2574 .close.media-modal-icon:before { 2575 font: normal 60px/1 dashicons; 2576 content: "\f335"; 2577 position: absolute; 2578 top: 50%; 2579 left: 50%; 2580 margin: -30px; 2581 color: #000; 2582 text-shadow: 0px 0px 5px #fff; 2514 2583 } 2515 2584 2516 .media-menu a { 2517 float: left; 2518 width: 21%; 2519 white-space: nowrap; 2520 text-overflow: ellipsis; 2521 overflow: hidden; 2522 padding: 10px inherit; 2585 .close.media-modal-icon:hover:before { 2586 color: #1e8cbe; 2587 text-shadow: 0px 0px 5px #000; 2523 2588 } 2524 2589 2525 .media-menu a:nth-child(2), 2526 .media-menu a:last-child { 2527 width: 21%; 2590 .switch-to-uploader { 2591 display: list-item; 2592 float: none; 2593 top: 0; 2594 } 2595 2596 .switch-to-uploader .thumbnail { 2597 border: 5px dashed #ddd; 2598 -webkit-box-shadow: none; 2599 box-shadow: none; 2600 background: none; 2528 2601 } 2529 2602 2603 .switch-to-uploader .thumbnail:after { 2604 -webkit-box-shadow: none; 2605 box-shadow: none; 2606 } 2607 2608 .switch-to-uploader .thumbnail:before { 2609 display: block; 2610 height: 40px; 2611 color: #ccc; 2612 font: normal 40px/1 dashicons; 2613 content: '\f132'; 2614 -webkit-font-smoothing: antialiased; 2615 -moz-osx-font-smoothing: grayscale; 2616 position: absolute; 2617 padding-top: 50%; 2618 top: -20px; 2619 right: 0; 2620 left: 0; 2621 } 2622 2623 .wp-core-ui .back-to-library { 2624 display: inline-block; 2625 } 2626 } 2627 2628 /* Landscape specific header override */ 2629 @media screen and (max-height: 400px) { 2530 2630 .media-modal-close { 2531 2631 top: 2px; 2532 2632 } … … 2536 2636 } 2537 2637 2538 2638 .media-frame-content { 2539 top: 78px; 2540 } 2541 2542 .attachments-browser .attachments { 2543 top: 2px; 2639 top: 54px; 2544 2640 } 2545 2641 2546 2642 /* Prevent unnecessary scrolling on title input */ … … 2572 2668 2573 2669 .media-frame .spinner { 2574 2670 background-image: url(../images/spinner-2x.gif); 2575 2671 } 2576 2672 } 2577 2673 2674 .attachments-browser .attachment { 2675 position: relative; 2676 width: 33.3%; 2677 margin: 0; 2678 } 2679 2680 .attachments-browser .attachment .attachment-preview { 2681 position: relative; 2682 } 2683 2684 .attachments-browser .attachment .attachment-preview:before { 2685 content: ''; 2686 display: block; 2687 padding-top: 100%; 2688 } 2689 2690 .attachments-browser .attachment .attachment-preview .thumbnail { 2691 position: absolute; 2692 top: 8px; 2693 right: 8px; 2694 bottom: 8px; 2695 left: 8px; 2696 } 2697 2698 .attachments-browser .portrait img { 2699 max-width: 100%; 2700 } 2701 2702 .attachments-browser .landscape img { 2703 max-height: 100%; 2704 } 2705 2706 .media-selection .attachments { 2707 padding: 5px; 2708 } 2709 2710 .media-selection .attachment { 2711 margin: 5px; 2712 width: 40px; 2713 } 2714 2715 .media-selection .attachment-preview, 2716 .media-selection .attachment-preview .thumbnail { 2717 width: 40px; 2718 height: 40px; 2719 } 2720 2721 .media-selection .portrait .thumbnail img { 2722 max-width: 40px; 2723 height: auto; 2724 } 2725 2726 .media-selection .landscape .thumbnail img { 2727 width: auto; 2728 max-height: 40px; 2729 } 2730 2731 @media only screen and ( max-width: 520px ) { 2732 .attachments-browser .attachment:first-of-type { 2733 margin-left: 33.3%; 2734 } 2735 } 2736 2737 @media only screen and ( min-width: 520px ) and ( max-width: 640px ) { 2738 .attachments-browser .attachment { 2739 width: 25%; 2740 } 2741 2742 .attachments-browser .attachment:first-of-type { 2743 margin-left: 25%; 2744 } 2745 } 2746 2747 .media-grid-view .attachments-browser .attachment:first-of-type { 2748 margin-left: 0; 2749 } 2750 2751 @media only screen and ( min-width: 640px ) { 2752 .attachments-browser .attachment { 2753 width: 33.3%; 2754 } 2755 } 2756 2757 @media only screen and ( min-width: 960px ) { 2758 .attachments-browser .attachment { 2759 width: 25%; 2760 } 2761 } 2762 2763 @media only screen and ( min-width: 1200px ) { 2764 .attachments-browser .attachment { 2765 width: 20%; 2766 } 2767 } 2578 2768 2579 2769 /** 2580 2770 * Media Grid … … 2587 2777 } 2588 2778 2589 2779 /* Regions we don't use at all */ 2780 .media-grid-view .switch-to-uploader, 2590 2781 .media-grid-view .media-frame-title, 2591 2782 .media-grid-view .media-frame-toolbar, 2592 2783 .media-grid-view .media-frame-menu { -
src/wp-includes/js/media-views.js
1747 1747 template: media.template('media-frame'), 1748 1748 regions: ['menu','title','content','toolbar','router'], 1749 1749 1750 events: { 1751 'click h1': 'toggleMenu' 1752 }, 1753 1750 1754 /** 1751 1755 * @global wp.Uploader 1752 1756 */ … … 1840 1844 controller: this 1841 1845 }); 1842 1846 }, 1847 1848 toggleMenu: function( event ) { 1849 event.preventDefault(); 1850 this.$el.find( '.media-menu' ).toggleClass( 'visible' ); 1851 1852 }, 1843 1853 /** 1844 1854 * @param {Object} toolbar 1845 1855 * @this wp.media.controller.Region … … 3221 3231 }; 3222 3232 } 3223 3233 3234 $( 'body' ).addClass( 'modal-open' ); 3235 3224 3236 $el.show().focus(); 3225 3237 return this.propagate('open'); 3226 3238 }, … … 3236 3248 return this; 3237 3249 } 3238 3250 3251 $( 'body' ).removeClass( 'modal-open' ); 3252 3239 3253 // Hide modal and remove restricted media modal tab focus once it's closed 3240 3254 this.$el.hide().undelegate( 'keydown' ); 3241 3255 … … 3655 3669 template: media.template('uploader-inline'), 3656 3670 3657 3671 events: { 3658 'click .close': 'hide' 3672 'click .close': 'hide', 3673 'click .back-to-library': 'back' 3659 3674 }, 3660 3675 3661 3676 initialize: function() { … … 3758 3773 }, 3759 3774 hide: function() { 3760 3775 this.$el.addClass( 'hidden' ); 3776 }, 3777 back: function( event ) { 3778 event.preventDefault(); 3779 this.controller.content.mode( 'browse' ); 3761 3780 } 3762 3763 3781 }); 3764 3782 3765 3783 /** … … 4408 4426 4409 4427 click: function() { 4410 4428 var state = this.options.state; 4429 4411 4430 if ( state ) { 4412 4431 this.controller.setState( state ); 4413 4432 } … … 4443 4462 property: 'state', 4444 4463 ItemView: media.view.MenuItem, 4445 4464 region: 'menu', 4465 4466 events: { 4467 'click': '_hide' 4468 }, 4469 4470 initialize: function( options ) { 4471 media.view.PriorityList.prototype.initialize.apply( this, arguments ); 4472 this.controller = options.controller; 4473 this.listenTo( this.controller, 'deactivate', function() { 4474 this.$el.removeClass( 'visible' ); 4475 } ); 4476 }, 4477 4446 4478 /** 4447 4479 * @param {Object} options 4448 4480 * @param {string} id … … 4524 4556 } 4525 4557 4526 4558 view.$el.removeClass('hidden'); 4559 }, 4560 4561 _hide: function() { 4562 this.$el.removeClass( 'visible' ); 4527 4563 } 4528 4564 }); 4529 4565 … … 4606 4642 tagName: 'li', 4607 4643 className: 'attachment', 4608 4644 template: media.template('attachment'), 4645 isTouch: false, 4609 4646 4610 4647 attributes: { 4611 4648 tabIndex: 0, … … 4614 4651 4615 4652 events: { 4616 4653 'click .js--select-attachment': 'toggleSelectionHandler', 4654 'touchend .attachment-preview': 'setTouch', 4617 4655 'change [data-setting]': 'updateSetting', 4618 4656 'change [data-setting] input': 'updateSetting', 4619 4657 'change [data-setting] select': 'updateSetting', … … 4730 4768 this.$bar.width( this.model.get('percent') + '%' ); 4731 4769 } 4732 4770 }, 4771 4772 setTouch: function() { 4773 this.isTouch = true; 4774 }, 4775 4733 4776 /** 4734 4777 * @param {Object} event 4735 4778 */ … … 4752 4795 method = 'toggle'; 4753 4796 } 4754 4797 4798 if ( this.isTouch ) { 4799 this.isTouch = false; 4800 method = 'add'; 4801 } 4802 4755 4803 this.toggleSelection({ 4756 4804 method: method 4757 4805 }); … … 4800 4848 selection[ this.selected() ? 'remove' : 'add' ]( model ); 4801 4849 selection.single( model ); 4802 4850 return; 4851 } else if ( 'add' === method ) { 4852 selection.add( model ); 4853 selection.single( model ); 4854 return; 4855 4803 4856 } 4804 4857 4805 4858 // Fixes bug that loses focus when selecting a featured image … … 5110 5163 tabIndex: -1 5111 5164 }, 5112 5165 5113 cssTemplate: media.template('attachments-css'),5114 5115 5166 events: { 5116 'scroll': 'scroll' 5167 'scroll': 'scroll', 5168 'click .switch-to-uploader': 'upload' 5117 5169 }, 5118 5170 5119 5171 initialize: function() { … … 5123 5175 refreshSensitivity: 200, 5124 5176 refreshThreshold: 3, 5125 5177 AttachmentView: media.view.Attachment, 5126 sortable: false, 5127 resize: true 5178 sortable: false 5128 5179 }); 5129 5180 5130 5181 this._viewsByCid = {}; … … 5150 5201 this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value(); 5151 5202 5152 5203 this.initSortable(); 5153 5154 _.bindAll( this, 'css' );5155 this.model.on( 'change:edge change:gutter', this.css, this );5156 this._resizeCss = _.debounce( _.bind( this.css, this ), this.refreshSensitivity );5157 if ( this.options.resize ) {5158 $(window).on( 'resize.attachments', this._resizeCss );5159 }5160 5161 // Call this.css() after this view has been rendered in the DOM so5162 // attachments get proper width applied.5163 _.defer( this.css, this );5164 5204 }, 5165 5205 5166 5206 dispose: function() { 5167 5207 this.collection.props.off( null, null, this ); 5168 $(window).off( 'resize.attachments', this._resizeCss ); 5208 5169 5209 /** 5170 5210 * call 'dispose' directly on the parent class 5171 5211 */ 5172 5212 media.View.prototype.dispose.apply( this, arguments ); 5173 5213 }, 5174 5214 5175 css: function() {5176 var $css = $( '#' + this.el.id + '-css' );5177 5178 if ( $css.length ) {5179 $css.remove();5180 }5181 5182 media.view.Attachments.$head().append( this.cssTemplate({5183 id: this.el.id,5184 edge: this.edge(),5185 gutter: this.model.get('gutter')5186 }) );5187 },5188 /**5189 * @returns {Number}5190 */5191 edge: function() {5192 var edge = this.model.get('edge'),5193 gutter, width, columns;5194 5195 if ( ! this.$el.is(':visible') ) {5196 return edge;5197 }5198 5199 gutter = this.model.get('gutter') * 2;5200 width = this.$el.width() - gutter;5201 columns = Math.ceil( width / ( edge + gutter ) );5202 edge = Math.floor( ( width - ( columns * gutter ) ) / columns );5203 return edge;5204 },5205 5206 5215 initSortable: function() { 5207 5216 var collection = this.collection; 5208 5217 … … 5313 5322 // Trigger the scroll event to check if we're within the 5314 5323 // threshold to query for additional attachments. 5315 5324 this.scroll(); 5325 5326 if ( ! this.$( '.switch-to-uploader' ).length ) { 5327 this.$el.append( '<li tabindex="0" role="checkbox" class="attachment save-ready switch-to-uploader"><div class="attachment-preview"><div class="thumbnail"></div></div></li>' ); 5328 } 5316 5329 }, 5317 5330 5318 5331 scroll: function() { … … 5336 5349 toolbar.get('spinner').hide(); 5337 5350 }); 5338 5351 } 5352 }, 5353 5354 upload: function( event ) { 5355 event.preventDefault(); 5356 this.controller.content.mode( 'upload' ); 5339 5357 } 5340 }, {5341 $head: (function() {5342 var $head;5343 return function() {5344 return $head = $head || $('head');5345 };5346 }())5347 5358 }); 5348 5359 5349 5360 /** … … 5775 5786 this.attachmentsNoResults.$el.html( l10n.noMedia ); 5776 5787 5777 5788 this.views.add( this.attachmentsNoResults ); 5778 5779 5780 5789 }, 5781 5790 5782 5791 createSidebar: function() { … … 5853 5862 5854 5863 events: { 5855 5864 'click .edit-selection': 'edit', 5856 'click .clear-selection': 'clear' 5865 'click .clear-selection': 'clear', 5866 'click .show-image-details': 'show' 5857 5867 }, 5858 5868 5859 5869 initialize: function() { … … 5917 5927 new media.view.FocusManager({ 5918 5928 el: this.el 5919 5929 }).focus(); 5930 }, 5931 5932 show: function( event ) { 5933 event.preventDefault(); 5934 this.$el.parents( '.media-frame' ).find( '.media-sidebar' ).add( $( event.target ) ).toggleClass( 'active' ); 5920 5935 } 5921 5936 }); 5922 5937 -
src/wp-includes/media-template.php
219 219 /** This action is documented in wp-admin/includes/media.php */ 220 220 do_action( 'post-upload-ui' ); ?> 221 221 </div> 222 <a href="#" class="button back-to-library"><?php _e( 'Back' ); ?></a> 222 223 <?php endif; ?> 223 224 </div> 224 225 </script> … … 398 399 399 400 <script type="text/html" id="tmpl-attachment"> 400 401 <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}"> 401 < # if ( data.uploading ) { #>402 < div class="media-progress-bar"><div></div></div>403 <# } else if ( 'image' === data.type ) { #>404 < div class="thumbnail">402 <div class="thumbnail"> 403 <# if ( data.uploading ) { #> 404 <div class="media-progress-bar"><div> 405 <# } else if ( 'image' === data.type ) { #> 405 406 <div class="centered"> 406 407 <img src="{{ data.size.url }}" draggable="false" alt="" /> 407 408 </div> 408 </div> 409 <# } else { 410 if ( data.thumb && data.thumb.src && data.thumb.src !== data.icon ) { 411 #><img src="{{ data.thumb.src }}" class="thumbnail" draggable="false" /><# 412 } else { 413 #><img src="{{ data.icon }}" class="icon" draggable="false" /><# 414 } #> 415 <div class="filename"> 416 <div>{{ data.filename }}</div> 417 </div> 418 <# } #> 409 <# } else { #> 410 <div class="centered"> 411 <# if ( data.thumb && data.thumb.src && data.thumb.src !== data.icon ) { #> 412 <img src="{{ data.thumb.src }}" class="thumbnail" draggable="false" /> 413 <# } else { #> 414 <img src="{{ data.icon }}" class="icon" draggable="false" /> 415 <# } #> 416 </div> 417 <div class="filename"> 418 <div>{{ data.filename }}</div> 419 </div> 420 - <# } #> 421 </div> 419 422 <# if ( data.buttons.close ) { #> 420 423 <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a> 421 424 <# } #> … … 589 592 <# } #> 590 593 </div> 591 594 <div class="selection-view"></div> 595 <a href="#" class="button show-image-details">Edit</a> 592 596 </script> 593 597 594 598 <script type="text/html" id="tmpl-attachment-display-settings"> … … 837 841 </div> 838 842 </script> 839 843 840 <script type="text/html" id="tmpl-attachments-css">841 <style type="text/css" id="{{ data.id }}-css">842 #{{ data.id }} {843 padding: 0 {{ data.gutter }}px;844 }845 846 #{{ data.id }} .attachment {847 margin: {{ data.gutter }}px;848 width: {{ data.edge }}px;849 }850 851 #{{ data.id }} .attachment-preview,852 #{{ data.id }} .attachment-preview .thumbnail {853 width: {{ data.edge }}px;854 height: {{ data.edge }}px;855 }856 857 #{{ data.id }} .portrait .thumbnail img {858 max-width: {{ data.edge }}px;859 height: auto;860 }861 862 #{{ data.id }} .landscape .thumbnail img {863 width: auto;864 max-height: {{ data.edge }}px;865 }866 </style>867 </script>868 869 844 <script type="text/html" id="tmpl-image-details"> 870 845 <div class="media-embed"> 871 846 <div class="embed-media-settings">