TinyMCE: fix selecting an image on touch in iOS Safari for TinyMCE 4.4.1.

Fixes #37427.
Built from https://develop.svn.wordpress.org/trunk@38156


git-svn-id: http://core.svn.wordpress.org/trunk@38097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2016-07-26 21:51:27 +00:00
parent fd29d3e3a3
commit b86015e78b
4 changed files with 12 additions and 9 deletions

View File

@ -79,24 +79,27 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
}
} );
function isNonEditable( node ) {
var parent = editor.$( node ).parents( '[contenteditable]' );
return parent && parent.attr( 'contenteditable' ) === 'false';
}
// Safari on iOS fails to select images in contentEditoble mode on touch.
// Select them again.
if ( iOS ) {
editor.on( 'init', function() {
editor.on( 'touchstart', function( event ) {
if ( event.target.nodeName === 'IMG' ) {
if ( event.target.nodeName === 'IMG' && ! isNonEditable( event.target ) ) {
touchOnImage = true;
}
});
editor.dom.bind( editor.getDoc(), 'touchmove', function( event ) {
if ( event.target.nodeName === 'IMG' ) {
touchOnImage = false;
}
editor.dom.bind( editor.getDoc(), 'touchmove', function() {
touchOnImage = false;
});
editor.on( 'touchend', function( event ) {
if ( touchOnImage && event.target.nodeName === 'IMG' ) {
if ( touchOnImage && event.target.nodeName === 'IMG' && ! isNonEditable( event.target ) ) {
var node = event.target;
touchOnImage = false;
@ -104,7 +107,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
window.setTimeout( function() {
editor.selection.select( node );
editor.nodeChanged();
}, 200 );
}, 100 );
} else if ( toolbar ) {
toolbar.hide();
}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-beta4-38155';
$wp_version = '4.6-beta4-38156';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.