External Libraries: Further fix jQuery deprecations in WordPress core.

This addresses `JQMIGRATE` warnings in the `image-edit.js` library and the `imgAreaSelect` jQuery plugin

Follow-up to [50001].

Props Clorith, poena, dariak, jeroenrotty.
See #51812.
Built from https://develop.svn.wordpress.org/trunk@50270


git-svn-id: http://core.svn.wordpress.org/trunk@49915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-02-09 16:45:06 +00:00
parent 34987fe903
commit 4fd440cd5c
5 changed files with 21 additions and 20 deletions

View File

@ -122,7 +122,7 @@
t.postid = postid;
$('#imgedit-response-' + postid).empty();
$('input[type="text"]', '#imgedit-panel-' + postid).keypress(function(e) {
$('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) {
var k = e.keyCode;
// Key codes 37 through 40 are the arrow keys.
@ -384,7 +384,7 @@
*/
t.setDisabled( $( '#image-undo-' + postid) , true );
// Move focus to the undo button to avoid a focus loss.
$( '#image-undo-' + postid ).focus();
$( '#image-undo-' + postid ).trigger( 'focus' );
}
}
@ -402,7 +402,7 @@
}
if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) {
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled');
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false);
} else {
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
}
@ -458,10 +458,10 @@
fh = t.intval(h.val());
if ( fw < 1 ) {
w.focus();
w.trigger( 'focus' );
return false;
} else if ( fh < 1 ) {
h.focus();
h.trigger( 'focus' );
return false;
}
@ -689,7 +689,7 @@
elementToSetFocusTo = $( '.imgedit-wrap' ).find( ':tabbable:first' );
}
elementToSetFocusTo.focus();
elementToSetFocusTo.trigger( 'focus' );
}, 100 );
},
@ -867,7 +867,7 @@
$('#image-editor-' + postid).fadeOut('fast', function() {
$( '#media-head-' + postid ).fadeIn( 'fast', function() {
// Move focus back to the Edit Image button. Runs also when saving.
$( '#imgedit-open-btn-' + postid ).focus();
$( '#imgedit-open-btn-' + postid ).trigger( 'focus' );
});
$(this).empty();
});
@ -1042,7 +1042,7 @@
t.setDisabled(button, pop < history.length);
// When undo gets disabled, move focus to the redo button to avoid a focus loss.
if ( history.length === pop ) {
$( '#image-redo-' + postid ).focus();
$( '#image-redo-' + postid ).trigger( 'focus' );
}
});
},
@ -1073,7 +1073,7 @@
t.setDisabled(button, pop > 0);
// When redo gets disabled, move focus to the undo button to avoid a focus loss.
if ( 0 === pop ) {
$( '#image-undo-' + postid ).focus();
$( '#image-undo-' + postid ).trigger( 'focus' );
}
});
},

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*
* imgAreaSelect jQuery plugin
* version 0.9.10-monkey
* version 0.9.10-wp
*
* Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
*
@ -388,7 +388,7 @@ $.imgAreaSelect = function (img, options) {
* current handler
*/
if ($.imgAreaSelect.onKeyPress != docKeyPress)
$(document).unbind($.imgAreaSelect.keyPress,
$(document).off($.imgAreaSelect.keyPress,
$.imgAreaSelect.onKeyPress);
if (options.keys)
@ -396,8 +396,9 @@ $.imgAreaSelect = function (img, options) {
* Set the document keypress event handler to this instance's
* docKeyPress() function
*/
$(document)[$.imgAreaSelect.keyPress](
$.imgAreaSelect.onKeyPress = docKeyPress);
$(document).on( $.imgAreaSelect.keyPress, function() {
$.imgAreaSelect.onKeyPress = docKeyPress;
});
}
/*
@ -931,7 +932,7 @@ $.imgAreaSelect = function (img, options) {
* The font-size property needs to be set to zero, otherwise
* Internet Explorer makes the handles too large
*/
fontSize: 0,
fontSize: '0',
zIndex: zIndex + 1 || 1
});
@ -1010,7 +1011,7 @@ $.imgAreaSelect = function (img, options) {
/* Calculate the aspect ratio factor */
aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1];
$img.add($outer).unbind('mousedown', imgMouseDown);
$img.add($outer).off('mousedown', imgMouseDown);
if (options.disable || options.enable === false) {
/* Disable the plugin */
@ -1025,7 +1026,7 @@ $.imgAreaSelect = function (img, options) {
$box.on({ 'mousemove touchmove': areaMouseMove,
'mousedown touchstart': areaMouseDown });
$(window).resize(windowResize);
$(window).on( 'resize', windowResize);
}
if (!options.persistent)
@ -1162,7 +1163,7 @@ $.imgAreaSelect = function (img, options) {
$box.add($outer).css({ visibility: 'hidden', position: position,
overflow: 'hidden', zIndex: zIndex || '0' });
$box.css({ zIndex: zIndex + 2 || 2 });
$area.add($border).css({ position: 'absolute', fontSize: 0 });
$area.add($border).css({ position: 'absolute', fontSize: '0' });
/*
* If the image has been fully loaded, or if it is not really an image (eg.

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-beta1-50269';
$wp_version = '5.7-beta1-50270';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.