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:
parent
34987fe903
commit
4fd440cd5c
|
@ -122,7 +122,7 @@
|
||||||
t.postid = postid;
|
t.postid = postid;
|
||||||
$('#imgedit-response-' + postid).empty();
|
$('#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;
|
var k = e.keyCode;
|
||||||
|
|
||||||
// Key codes 37 through 40 are the arrow keys.
|
// Key codes 37 through 40 are the arrow keys.
|
||||||
|
@ -384,7 +384,7 @@
|
||||||
*/
|
*/
|
||||||
t.setDisabled( $( '#image-undo-' + postid) , true );
|
t.setDisabled( $( '#image-undo-' + postid) , true );
|
||||||
// Move focus to the undo button to avoid a focus loss.
|
// 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' ) {
|
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 {
|
} else {
|
||||||
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
|
$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
|
||||||
}
|
}
|
||||||
|
@ -458,10 +458,10 @@
|
||||||
fh = t.intval(h.val());
|
fh = t.intval(h.val());
|
||||||
|
|
||||||
if ( fw < 1 ) {
|
if ( fw < 1 ) {
|
||||||
w.focus();
|
w.trigger( 'focus' );
|
||||||
return false;
|
return false;
|
||||||
} else if ( fh < 1 ) {
|
} else if ( fh < 1 ) {
|
||||||
h.focus();
|
h.trigger( 'focus' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@
|
||||||
elementToSetFocusTo = $( '.imgedit-wrap' ).find( ':tabbable:first' );
|
elementToSetFocusTo = $( '.imgedit-wrap' ).find( ':tabbable:first' );
|
||||||
}
|
}
|
||||||
|
|
||||||
elementToSetFocusTo.focus();
|
elementToSetFocusTo.trigger( 'focus' );
|
||||||
}, 100 );
|
}, 100 );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -867,7 +867,7 @@
|
||||||
$('#image-editor-' + postid).fadeOut('fast', function() {
|
$('#image-editor-' + postid).fadeOut('fast', function() {
|
||||||
$( '#media-head-' + postid ).fadeIn( 'fast', function() {
|
$( '#media-head-' + postid ).fadeIn( 'fast', function() {
|
||||||
// Move focus back to the Edit Image button. Runs also when saving.
|
// 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();
|
$(this).empty();
|
||||||
});
|
});
|
||||||
|
@ -1042,7 +1042,7 @@
|
||||||
t.setDisabled(button, pop < history.length);
|
t.setDisabled(button, pop < history.length);
|
||||||
// When undo gets disabled, move focus to the redo button to avoid a focus loss.
|
// When undo gets disabled, move focus to the redo button to avoid a focus loss.
|
||||||
if ( history.length === pop ) {
|
if ( history.length === pop ) {
|
||||||
$( '#image-redo-' + postid ).focus();
|
$( '#image-redo-' + postid ).trigger( 'focus' );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -1073,7 +1073,7 @@
|
||||||
t.setDisabled(button, pop > 0);
|
t.setDisabled(button, pop > 0);
|
||||||
// When redo gets disabled, move focus to the undo button to avoid a focus loss.
|
// When redo gets disabled, move focus to the undo button to avoid a focus loss.
|
||||||
if ( 0 === pop ) {
|
if ( 0 === pop ) {
|
||||||
$( '#image-undo-' + postid ).focus();
|
$( '#image-undo-' + postid ).trigger( 'focus' );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* imgAreaSelect jQuery plugin
|
* imgAreaSelect jQuery plugin
|
||||||
* version 0.9.10-monkey
|
* version 0.9.10-wp
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
|
* Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
|
||||||
*
|
*
|
||||||
|
@ -388,7 +388,7 @@ $.imgAreaSelect = function (img, options) {
|
||||||
* current handler
|
* current handler
|
||||||
*/
|
*/
|
||||||
if ($.imgAreaSelect.onKeyPress != docKeyPress)
|
if ($.imgAreaSelect.onKeyPress != docKeyPress)
|
||||||
$(document).unbind($.imgAreaSelect.keyPress,
|
$(document).off($.imgAreaSelect.keyPress,
|
||||||
$.imgAreaSelect.onKeyPress);
|
$.imgAreaSelect.onKeyPress);
|
||||||
|
|
||||||
if (options.keys)
|
if (options.keys)
|
||||||
|
@ -396,8 +396,9 @@ $.imgAreaSelect = function (img, options) {
|
||||||
* Set the document keypress event handler to this instance's
|
* Set the document keypress event handler to this instance's
|
||||||
* docKeyPress() function
|
* docKeyPress() function
|
||||||
*/
|
*/
|
||||||
$(document)[$.imgAreaSelect.keyPress](
|
$(document).on( $.imgAreaSelect.keyPress, function() {
|
||||||
$.imgAreaSelect.onKeyPress = docKeyPress);
|
$.imgAreaSelect.onKeyPress = docKeyPress;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -931,7 +932,7 @@ $.imgAreaSelect = function (img, options) {
|
||||||
* The font-size property needs to be set to zero, otherwise
|
* The font-size property needs to be set to zero, otherwise
|
||||||
* Internet Explorer makes the handles too large
|
* Internet Explorer makes the handles too large
|
||||||
*/
|
*/
|
||||||
fontSize: 0,
|
fontSize: '0',
|
||||||
zIndex: zIndex + 1 || 1
|
zIndex: zIndex + 1 || 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1010,7 +1011,7 @@ $.imgAreaSelect = function (img, options) {
|
||||||
/* Calculate the aspect ratio factor */
|
/* Calculate the aspect ratio factor */
|
||||||
aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1];
|
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) {
|
if (options.disable || options.enable === false) {
|
||||||
/* Disable the plugin */
|
/* Disable the plugin */
|
||||||
|
@ -1025,7 +1026,7 @@ $.imgAreaSelect = function (img, options) {
|
||||||
$box.on({ 'mousemove touchmove': areaMouseMove,
|
$box.on({ 'mousemove touchmove': areaMouseMove,
|
||||||
'mousedown touchstart': areaMouseDown });
|
'mousedown touchstart': areaMouseDown });
|
||||||
|
|
||||||
$(window).resize(windowResize);
|
$(window).on( 'resize', windowResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options.persistent)
|
if (!options.persistent)
|
||||||
|
@ -1162,7 +1163,7 @@ $.imgAreaSelect = function (img, options) {
|
||||||
$box.add($outer).css({ visibility: 'hidden', position: position,
|
$box.add($outer).css({ visibility: 'hidden', position: position,
|
||||||
overflow: 'hidden', zIndex: zIndex || '0' });
|
overflow: 'hidden', zIndex: zIndex || '0' });
|
||||||
$box.css({ zIndex: zIndex + 2 || 2 });
|
$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.
|
* 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
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue