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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47229 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2020-02-10 02:52:12 +00:00
parent b39db8c898
commit 6fd606d236
1 changed files with 7 additions and 1 deletions

View File

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