WordPress.org

Make WordPress Core

Changeset 27625


Ignore:
Timestamp:
03/19/2014 09:15:50 PM (6 years ago)
Author:
nacin
Message:

Only enqueue the image editor in the media modal in the admin.

props gcorne.
see #21811.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-views.js

    r27621 r27625  
    55955595        editAttachment: function( event ) {
    55965596            var editState = this.controller.state( 'edit-image' );
    5597             event.preventDefault();
    5598 
    5599             editState.set( 'image', this.model );
    5600             this.controller.setState( 'edit-image' );
     5597            if ( window.imageEdit ) {
     5598                event.preventDefault();
     5599
     5600                editState.set( 'image', this.model );
     5601                this.controller.setState( 'edit-image' );
     5602            } else {
     5603                this.$el.addClass('needs-refresh');
     5604            }
    56015605        },
    56025606        /**
     
    59455949        editAttachment: function( event ) {
    59465950            var editState = this.controller.state( 'edit-image' );
    5947             event.preventDefault();
    5948 
    5949             editState.set( 'image', this.model.attachment );
    5950             this.controller.setState( 'edit-image' );
     5951
     5952            if ( window.imageEdit ) {
     5953                event.preventDefault();
     5954                editState.set( 'image', this.model.attachment );
     5955                this.controller.setState( 'edit-image' );
     5956            }
    59515957        }
    59525958    });
  • trunk/src/wp-includes/media-template.php

    r27620 r27625  
    667667                    <img src="{{ data.model.url }}" draggable="false" />
    668668                </div>
    669                 <# if ( data.attachment ) { #>
     669                <# if ( data.attachment && window.imageEdit ) { #>
    670670                    <input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Image' ); ?>" />
    671671                <# } #>
  • trunk/src/wp-includes/media.php

    r27620 r27625  
    25372537    wp_enqueue_script( 'media-audiovideo' );
    25382538    wp_enqueue_style( 'media-views' );
     2539    if ( is_admin() ) {
     2540        wp_enqueue_script( 'image-edit' );
     2541    }
    25392542    wp_enqueue_style( 'imgareaselect' );
    25402543    wp_plupload_default_settings();
  • trunk/src/wp-includes/script-loader.php

    r27620 r27625  
    395395    // To enqueue media-views or media-editor, call wp_enqueue_media().
    396396    // Both rely on numerous settings, styles, and templates to operate correctly.
    397     $scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js",  array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'image-edit' ), false, 1 );
     397    $scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js",  array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 );
    398398    $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
    399399    $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor', 'mce-view' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.