WordPress.org

Make WordPress Core

Changeset 46461


Ignore:
Timestamp:
10/11/2019 08:41:51 PM (5 weeks ago)
Author:
antpb
Message:

Media: Adds Edit Image controller to Media Library select frame.

This adds the necessary state for EditImage views in the select frame and listeners for setting that view.

Props fblaser, w3rkjana, afercia, antpb.
See #48028.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/views/frame/select.js

    r46355 r46461  
    5959    },
    6060
     61    editImageContent: function() {
     62        var image = this.state().get('image'),
     63            view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
     64
     65        this.content.set( view );
     66
     67        // after creating the wrapper view, load the actual editor via an ajax call
     68        view.loadEditor();
     69    },
     70
    6171    /**
    6272     * Create the default states on the frame.
     
    7787                title:     options.title,
    7888                priority:  20
    79             })
     89            }),
     90            new wp.media.controller.EditImage( { model: options.editImage } )
    8091        ]);
    8192    },
     
    92103        this.on( 'content:render:upload', this.uploadContent, this );
    93104        this.on( 'toolbar:create:select', this.createSelectToolbar, this );
     105        this.on( 'content:render:edit-image', this.editImageContent, this );
    94106    },
    95107
Note: See TracChangeset for help on using the changeset viewer.