WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/28/2012 11:29:17 PM (9 years ago)
Author:
koopersmith
Message:

Give media a heart transplant.

Revises the concept of the media controller and workspace views (i.e. two central points of control) to be more granular. The main media object is now the Frame, which is a hybrid view and state machine.

The state machine is a collection of states, which are just generic instances of Backbone.Model. This circumvents the problem of juggling global parameters when changing states. Each state contains its own event loop. All events are also forwarded to the frame itself (as is the case in all model/collection relationships).

The frame view contains several regions, each of which can be overridden without harming or re-rendering the other regions. These work well when used in conjunction with the state machine events.

This removes the upload sidebar (don't worry, visible upload UI will return). Drag and drop uploading still works. The ability to upload has been abstracted into its own view (instead of being attached to the central workspace view).

Editing galleries is temporarily broken — the gallery creation and editing experiences will be unified in a future patch.

Adds events to detect dragging changes in wp.Uploader and adds methods to detect and leverage browser support for CSS3 transitions.

see #21390, #21809.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r22044 r22320  
    10191019            $thumbnailId = $element.find('input[name="thumbnail_id"]'),
    10201020            title        = '<?php _e( "Choose a Featured Image" ); ?>',
    1021             workflow, setFeaturedImage;
     1021            workflow, selection, setFeaturedImage;
    10221022
    10231023        setFeaturedImage = function( thumbnailId ) {
     
    10381038                });
    10391039
    1040                 workflow.selection.on( 'add', function( model ) {
     1040                selection = workflow.state().get('selection');
     1041
     1042                selection.on( 'add', function( model ) {
    10411043                    var sizes = model.get('sizes'),
    10421044                        size;
     
    10521054                    size = size || model.toJSON();
    10531055
    1054                     workflow.modal.close();
    1055                     workflow.selection.clear();
     1056                    workflow.close();
     1057                    selection.clear();
    10561058
    10571059                    $( '<img />', {
     
    10621064            }
    10631065
    1064             workflow.modal.open();
     1066            workflow.open();
    10651067        });
    10661068
Note: See TracChangeset for help on using the changeset viewer.