Make WordPress Core

Changeset 29521


Ignore:
Timestamp:
08/17/2014 08:10:16 PM (11 years ago)
Author:
azaozz
Message:

TinyMCE: fix the edit image and wpview buttons on touch screen PCs, fixes #29235.

Location:
trunk/src/wp-includes/js/tinymce/plugins
Files:
2 edited

Legend:

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

    r29471 r29521  
    550550
    551551    if ( 'ontouchend' in document ) {
    552         editor.on( 'touchend', edit );
    553 
    554552        editor.on( 'click', function( event ) {
    555553            var target = event.target;
     
    564562            }
    565563        });
    566     } else {
    567         editor.on( 'mouseup', edit );
    568     }
     564    }
     565
     566    editor.on( 'mouseup touchend', edit );
    569567
    570568    editor.on( 'init', function() {
  • trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js

    r29463 r29521  
    1212        firstFocus = true,
    1313        _noop = function() { return false; },
    14         isTouchDevice = ( 'ontouchend' in document ),
     14        isios = /iPad|iPod|iPhone/.test( navigator.userAgent ),
    1515        cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView;
    1616
     
    142142
    143143        // select the hidden div
    144         if ( isTouchDevice ) {
     144        if ( isios ) {
    145145            editor.selection.select( clipboard );
    146146        } else {
     
    299299
    300300        editor.on( 'mousedown mouseup click touchend', function( event ) {
    301             var view = getView( event.target ),
    302                 type = isTouchDevice ? 'touchend' : 'mousedown';
     301            var view = getView( event.target );
    303302
    304303            firstFocus = false;
     
    309308                event.preventDefault();
    310309
    311                 if ( event.type === type && ! event.metaKey && ! event.ctrlKey ) {
     310                if ( ( event.type === 'touchend' || event.type === 'mousedown' ) && ! event.metaKey && ! event.ctrlKey ) {
    312311                    if ( editor.dom.hasClass( event.target, 'edit' ) ) {
    313312                        wp.mce.views.edit( view );
     
    330329                return false;
    331330            } else {
    332                 if ( event.type === type ) {
     331                if ( event.type === 'touchend' || event.type === 'mousedown' ) {
    333332                    deselect();
    334333                }
Note: See TracChangeset for help on using the changeset viewer.