jchristopher / attachments

[WordPress Plugin] Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
wordpress.org/extend/plugins/attachments/
GNU General Public License v2.0
239 stars 78 forks source link

when variable "tinymce" is not available, it will cause other plugins that is running javascript not working #114

Closed simongcc closed 10 years ago

simongcc commented 10 years ago

Symptoms:

Some plugins running Javacript will be broken due to undefined variable is being detected in Attachment Javascript in upload.php (or any other screen with the same situation)

Step to Reproduce:

Suppose attachment 3.5.3 is installed and activated already

  1. Download the plugins "manual image crop", install and activate it
  2. Go to Media -> click "Crop" link under image thumbnail(must have to test)
  3. The JCrop will not work and handle will not be shown because Javacript is broken
    at "undefined tinyMCE variable" according to trace console in Chrome

    Solution:

in class.field.wysiwyg.php, line 82 add a conditional test to avoid undefined tinyMCE variable break the Javascript when it is not available.

if(typeof tinyMCE !== 'undefined'){
...original code
}

Hope this can help those with the same problem and improve the Attachment.

w3b-beweb commented 10 years ago

thanks, I was having the same problem with Attachments+Ag Custom Admin. Your fix works great.