WordPress.org

Make WordPress Core

Changeset 28775


Ignore:
Timestamp:
06/18/2014 11:02:10 PM (7 years ago)
Author:
wonderboymusic
Message:

Diambiguate type and shortcode in TinyMCE view classes and their attached view.View class. Has the added feature of not causing JS errors.

See #28532.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r28754 r28775  
    125125        register: function( type, constructor ) {
    126126            var defaultConstructor = {
    127                     shortcode: type,
     127                    type: type,
    128128                    View: {},
    129129                    toView: function( content ) {
    130                         var match = wp.shortcode.next( this.shortcode, content );
     130                        var match = wp.shortcode.next( this.type, content );
    131131
    132132                        if ( ! match ) {
     
    489489         */
    490490        edit: function( node ) {
    491             var media = wp.media[ this.shortcode ],
     491            var media = wp.media[ this.type ],
    492492                self = this,
    493493                frame, data, callback;
     
    502502
    503503            callback = function( selection ) {
    504                 var shortcode = wp.media[ self.shortcode ].shortcode( selection ).string();
     504                var shortcode = wp.media[ self.type ].shortcode( selection ).string();
    505505                $( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
    506506                wp.mce.views.refreshView( self, shortcode );
     
    820820                frame,
    821821                data,
    822                 isURL = 'embedURL' === this.shortcode;
     822                isURL = 'embedURL' === this.type;
    823823
    824824            $( document ).trigger( 'media:edit' );
Note: See TracChangeset for help on using the changeset viewer.