Media: Ensure imgareaselect.js is not initialized twice for the same image. May happen when uploading an image into a post and then clicking on Edit Image.

Fixes #49262.
Built from https://develop.svn.wordpress.org/trunk@47229


git-svn-id: http://core.svn.wordpress.org/trunk@47029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2020-02-10 02:54:05 +00:00
parent f13044b031
commit e4f36258f9
3 changed files with 9 additions and 3 deletions

View File

@ -642,9 +642,15 @@
var t = this, var t = this,
selW = $('#imgedit-sel-width-' + postid), selW = $('#imgedit-sel-width-' + postid),
selH = $('#imgedit-sel-height-' + postid), selH = $('#imgedit-sel-height-' + postid),
$image = $( image ),
$img; $img;
t.iasapi = $(image).imgAreaSelect({ // Already initialized?
if ( $image.data( 'imgAreaSelect' ) ) {
return;
}
t.iasapi = $image.imgAreaSelect({
parent: parent, parent: parent,
instance: true, instance: true,
handles: true, handles: true,

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-47228'; $wp_version = '5.4-alpha-47229';
/** /**
* 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.