Make WordPress Core

Ticket #27423: 27423.6.patch

File 27423.6.patch, 9.5 KB (added by iseulde, 11 years ago)
  • src/wp-includes/css/media-views.css

     
    529529        z-index: 150;
    530530}
    531531
     532.media-frame .media-frame-menu-toggle {
     533        position: absolute;
     534        top: 0;
     535        left: 0;
     536        z-index: 200;
     537        display: none;
     538        text-decoration: none;
     539        font-size: 16px;
     540        padding: 16px;
     541}
     542
     543.media-frame .media-frame-menu-toggle:hover {
     544        position: absolute;
     545}
     546
    532547.media-frame-title {
    533548        position: absolute;
    534549        top: 0;
     
    683698 */
    684699.attachments {
    685700        margin: 0;
    686         padding-right: 16px;
     701        padding: 8px;
    687702        -webkit-overflow-scrolling: touch;
    688703}
    689704
     
    705720}
    706721
    707722.attachment:focus {
     723        outline: none;
     724}
     725
     726.attachment:focus .attachment-preview {
    708727        -webkit-box-shadow:
    709728                0 0 0 1px #5b9dd9,
    710729                0 0 2px 2px #5b9dd9;
    711730        box-shadow:
    712731                0 0 0 1px #5b9dd9,
    713732                0 0 2px 2px #5b9dd9;
    714         outline: none;
    715733}
    716734
    717 .selected.attachment {
     735.selected.attachment .attachment-preview {
    718736        -webkit-box-shadow:
    719737                0 0 0 1px #fff,
    720738                0 0 0 3px #ccc;
     
    725743
    726744.attachment-preview {
    727745        position: relative;
    728         width: 199px;
    729         height: 199px;
    730746        -webkit-box-shadow:
    731747                inset 0 0 15px rgba( 0, 0, 0, 0.1 ),
    732748                inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
     
    904920        display: block;
    905921}
    906922
    907 .attachment.details,
     923.attachment.details .attachment-preview,
    908924.media-grid-view .selected.attachment {
    909925        -webkit-box-shadow: 0 0 0 1px #fff,
    910926                                0 0 0 5px #1e8cbe;
     
    14561472.media-selection .attachments {
    14571473        display: inline-block;
    14581474        height: 48px;
    1459         margin-top: 5px;
    14601475        overflow: hidden;
    14611476        vertical-align: top;
    14621477}
     
    23102325@media only screen and (max-width: 640px), screen and (max-height: 400px) {
    23112326
    23122327        /* Media tabs on the top */
    2313         .media-frame-content .media-toolbar .instructions {
     2328        .media-frame-content .media-toolbar .instructions,
     2329        .media-sidebar,
     2330        .media-frame-router {
    23142331                display: none;
    23152332        }
    23162333
    23172334        .media-frame-menu {
    2318                 width: auto;
    2319                 bottom: auto;
    2320                 right: 0;
    2321                 height: 60px;
     2335                top: 30px;
     2336                left: 0;
     2337                z-index: inherit;
     2338        }
     2339
     2340        .media-frame .media-frame-menu-toggle {
     2341                display: block;
    23222342        }
    23232343
    23242344        .media-menu {
    2325                 border-right: none;
     2345                z-index: inherit;
     2346                width: 200px;
    23262347                position: relative;
    2327                 border-bottom: 1px solid #dddddd;
    2328                 overflow: hidden;
    23292348                padding: 10px 0 10px 10px;
     2349                display: none;
     2350                border: 1px solid #ccc;
    23302351        }
    23312352
    2332         .media-menu a {
    2333                 float: left;
    2334                 width: 42%;
    2335                 white-space: nowrap;
    2336                 text-overflow: ellipsis;
    2337                 overflow: hidden;
     2353        .media-menu.visible {
     2354                z-index: 2000;
     2355                display: block;
     2356                position: fixed;
     2357                top: 0;
     2358                bottom: 0;
     2359                left: 0;
     2360                right: 0;
     2361                width: auto;
     2362                border: none;
     2363                padding: 10px 0;
     2364        }
     2365       
     2366        .media-menu > a {
     2367                padding: 20px;
     2368                width: auto !important;
     2369                text-align: center;
     2370                font-size: 20px;
    23382371        }
    23392372
    23402373        .media-frame-title {
     
    23472380                font-size: 14px;
    23482381        }
    23492382
     2383        .image-details .media-frame-menu-toggle {
     2384                display: none;
     2385        }
     2386
    23502387        .media-frame-toolbar {
    23512388                position: absolute;
    23522389                bottom: 0px;
    23532390                left: 0;
    23542391                right: 0;
    2355                 background: #FFF;
    2356                 border-top: 1px solid #DEDEDE;
     2392                background: #fff;
    23572393        }
    23582394
    23592395        .media-toolbar {
     
    23652401        }
    23662402
    23672403        .attachments-browser .attachments {
    2368                 top: 42px;
     2404                top: 50px;
     2405                right: 0;
    23692406        }
    23702407
    23712408        .attachment-details h3 {
     
    23822419                display: none;
    23832420        }
    23842421
    2385         .media-frame-title {
     2422        .image-details .media-frame-title {
    23862423                top: 72px;
    2387                 left: auto;
    2388                 height: auto;
    23892424        }
    23902425
    23912426        .media-frame-title h1 {
     
    23932428                font-size: 18px;
    23942429        }
    23952430
    2396         .media-frame-router {
    2397                 top: 84px;
    2398                 left: 0;
    2399         }
    2400 
    24012431        .media-frame-content {
    24022432                left: 0;
    2403                 top: 118px;
     2433                top: 48px;
    24042434        }
    24052435
    24062436        .image-details .media-frame.hide-router .media-frame-content {
    24072437                top: 40px;
    24082438        }
    24092439
    2410         .media-frame .attachments-browser {
    2411                 padding-bottom: 300px;
    2412         }
    2413 
    2414         .media-sidebar {
    2415                 border-bottom: 1px solid #dddddd;
    2416         }
    2417 
    24182440        .media-modal {
    24192441                width: auto;
    24202442        }
     
    24352457                margin: 0;
    24362458        }
    24372459
    2438         .attachments-browser .attachments, .attachments-browser .uploader-inline {
    2439                 position: relative;
    2440                 margin-right: 180px;
    2441         }
    2442 
    24432460        /* Full-bleed modal */
    24442461        .media-modal,
    24452462        .image-details .media-modal {
     
    25322549                top: 78px;
    25332550        }
    25342551
    2535         .attachments-browser .attachments {
    2536                 top: 2px;
    2537         }
    2538 
    25392552        /* Prevent unnecessary scrolling on title input */
    25402553        .embed-link-settings {
    25412554                overflow: visible;
     
    28792892        }
    28802893}
    28812894
     2895/**/
     2896
     2897.attachments-browser .attachment {
     2898        position: relative;
     2899        width: 20%;
     2900        margin: 0;
     2901}
     2902
     2903.attachments-browser .attachment:before {
     2904        content: '';
     2905        display: block;
     2906        padding-top: 100%;
     2907}
     2908
     2909.attachments-browser .attachment .attachment-preview {
     2910        position: absolute;
     2911        top: 8px;
     2912        right: 8px;
     2913        bottom: 8px;
     2914        left: 8px;
     2915}
     2916
     2917.attachments-browser .portrait img {
     2918        max-width: 100%;
     2919}
     2920
     2921.attachments-browser .landscape img {
     2922        max-height: 100%;
     2923}
     2924
     2925/**/
     2926
     2927.media-selection .attachments {
     2928        padding: 5px;
     2929}
     2930
     2931.media-selection .attachment {
     2932        margin: 5px;
     2933        width: 40px;
     2934}
     2935
     2936.media-selection .attachment-preview,
     2937.media-selection .attachment-preview .thumbnail {
     2938        width: 40px;
     2939        height: 40px;
     2940}
     2941
     2942.media-selection .portrait .thumbnail img {
     2943        max-width: 40px;
     2944        height: auto;
     2945}
     2946
     2947.media-selection .landscape .thumbnail img {
     2948        width: auto;
     2949        max-height: 40px;
     2950}
     2951
     2952/*@media only screen and ( max-width: 640px ) {
     2953        .attachments-browser .attachment {
     2954                width: 25%;
     2955        }
     2956}*/
     2957
     2958@media only screen and ( max-width: 960px ) {
     2959        .attachments-browser .attachment {
     2960                width: 33.3%%;
     2961        }
     2962}
     2963
     2964@media only screen and ( min-width: 960px ) and ( max-width: 1200px ) {
     2965        .attachments-browser .attachment {
     2966                width: 25%;
     2967        }
     2968}
     2969
     2970@media only screen and ( min-width: 1200px ) {
     2971        .attachments-browser .attachment {
     2972                width: 20%;
     2973        }
     2974}
  • src/wp-includes/js/media-views.js

     
    17471747                template:  media.template('media-frame'),
    17481748                regions:   ['menu','title','content','toolbar','router'],
    17491749
     1750                events: {
     1751                        'click a.media-frame-menu-toggle': 'toggleMenu'
     1752                },
     1753
    17501754                /**
    17511755                 * @global wp.Uploader
    17521756                 */
     
    18401844                                controller: this
    18411845                        });
    18421846                },
     1847
     1848                toggleMenu: function( event ) {
     1849                        console.log( 'clicked' );
     1850                        event.preventDefault();
     1851                        this.$el.find( '.media-menu' ).toggleClass( 'visible' );
     1852
     1853                },
    18431854                /**
    18441855                 * @param {Object} toolbar
    18451856                 * @this wp.media.controller.Region
     
    44294440        });
    44304441
    44314442        /**
    4432          * wp.media.view.Menu
    4433          *
    4434          * @constructor
    4435          * @augments wp.media.view.PriorityList
    4436          * @augments wp.media.View
    4437          * @augments wp.Backbone.View
    4438          * @augments Backbone.View
    4439          */
     4443        * wp.media.view.Menu
     4444        *
     4445        * @constructor
     4446        * @augments wp.media.view.PriorityList
     4447        * @augments wp.media.View
     4448        * @augments wp.Backbone.View
     4449        * @augments Backbone.View
     4450        */
    44404451        media.view.Menu = media.view.PriorityList.extend({
    44414452                tagName:   'div',
    44424453                className: 'media-menu',
    44434454                property:  'state',
    44444455                ItemView:  media.view.MenuItem,
    44454456                region:    'menu',
     4457
     4458                initialize: function( options ) {
     4459                        media.view.PriorityList.prototype.initialize.apply( this, arguments );
     4460                        this.controller = options.controller;
     4461                        this.listenTo( this.controller, 'deactivate', function() {
     4462                                this.$el.removeClass( 'visible' );
     4463                        } );
     4464                },
     4465
    44464466                /**
    44474467                 * @param {Object} options
    44484468                 * @param {string} id
     
    46064626                tagName:   'li',
    46074627                className: 'attachment',
    46084628                template:  media.template('attachment'),
     4629                isTouch: false,
    46094630
    46104631                attributes: {
    46114632                        tabIndex: 0,
     
    46144635
    46154636                events: {
    46164637                        'click .js--select-attachment':   'toggleSelectionHandler',
     4638                        'touchend .attachment-preview':   'setTouch',
    46174639                        'change [data-setting]':          'updateSetting',
    46184640                        'change [data-setting] input':    'updateSetting',
    46194641                        'change [data-setting] select':   'updateSetting',
     
    47304752                                this.$bar.width( this.model.get('percent') + '%' );
    47314753                        }
    47324754                },
     4755
     4756                setTouch: function() {
     4757                        this.isTouch = true;
     4758                },
     4759
    47334760                /**
    47344761                 * @param {Object} event
    47354762                 */
     
    47524779                                method = 'toggle';
    47534780                        }
    47544781
     4782                        if ( this.isTouch ) {
     4783                                this.isTouch = false;
     4784                                method = 'add';
     4785                        }
     4786
    47554787                        this.toggleSelection({
    47564788                                method: method
    47574789                        });
     
    48004832                                selection[ this.selected() ? 'remove' : 'add' ]( model );
    48014833                                selection.single( model );
    48024834                                return;
     4835                        } else if ( 'add' === method ) {
     4836                                selection.add( model );
     4837                                selection.single( model );
     4838                                return;
     4839
    48034840                        }
    48044841
    48054842                        // Fixes bug that loses focus when selecting a featured image
     
    51495186
    51505187                        this.initSortable();
    51515188
    5152                         _.bindAll( this, 'css' );
     5189                        /*_.bindAll( this, 'css' );
    51535190                        this.model.on( 'change:edge change:gutter', this.css, this );
    51545191                        this._resizeCss = _.debounce( _.bind( this.css, this ), this.refreshSensitivity );
    51555192                        if ( this.options.resize ) {
     
    51585195
    51595196                        // Call this.css() after this view has been rendered in the DOM so
    51605197                        // attachments get proper width applied.
    5161                         _.defer( this.css, this );
     5198                        _.defer( this.css, this );*/
    51625199                },
    51635200
    51645201                dispose: function() {
  • src/wp-includes/media-template.php

     
    130130        </style>
    131131        <![endif]-->
    132132        <script type="text/html" id="tmpl-media-frame">
     133                <a class="media-frame-menu-toggle" href="#">Insert Media<!-- Change this dynamically. --><div class="dashicons dashicons-arrow-down"></div></a>
    133134                <div class="media-frame-menu"></div>
    134135                <div class="media-frame-title"></div>
    135136                <div class="media-frame-router"></div>