Make WordPress Core

Changeset 29298


Ignore:
Timestamp:
07/25/2014 12:55:33 AM (12 years ago)
Author:
azaozz
Message:

TinyMCE wpView:

  • Fix opening the media modal on clicking Edit in Firefox.
  • Fix range errors when restoring the selection bookmark in IE11 after editing a view.

See #28595.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js

    r29273 r29298  
    116116
    117117                // Bail if node is already selected.
    118                 if ( viewNode === selected ) {
     118                if ( ! viewNode || viewNode === selected ) {
    119119                        return;
    120120                }
     
    296296                                event.stopPropagation();
    297297
    298                                 // Hack to try and keep the block resize handles from appearing. They will show on mousedown and then be removed on mouseup.
    299                                 if ( Env.ie <= 10 ) {
    300                                         deselect();
    301                                 }
    302 
    303                                 select( view );
    304 
    305                                 if ( event.type === 'click' && ! event.metaKey && ! event.ctrlKey ) {
     298                                if ( event.type === 'mousedown' && ! event.metaKey && ! event.ctrlKey ) {
    306299                                        if ( editor.dom.hasClass( event.target, 'edit' ) ) {
    307300                                                wp.mce.views.edit( view );
     301                                                editor.focus();
     302                                                return false;
    308303                                        } else if ( editor.dom.hasClass( event.target, 'remove' ) ) {
    309304                                                removeView( view );
    310                                         }
    311                                 }
     305                                                return false;
     306                                        }
     307                                }
     308
     309                                select( view );
    312310
    313311                                // Returning false stops the ugly bars from appearing in IE11 and stops the view being selected as a range in FF.
     
    315313                                return false;
    316314                        } else {
    317                                 // Fix issue with deselecting a view in IE8. Without this hack, clicking content above the view wouldn't actually deselect it
    318                                 // and the caret wouldn't be placed at the mouse location
    319                                 if ( Env.ie && Env.ie <= 8 ) {
    320                                         deselectEventType = 'mouseup';
    321                                 } else {
    322                                         deselectEventType = 'mousedown';
    323                                 }
    324 
    325                                 if ( event.type === deselectEventType ) {
     315                                if ( event.type === 'mousedown' ) {
    326316                                        deselect();
    327317                                }
Note: See TracChangeset for help on using the changeset viewer.