Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.76k stars 885 forks source link

Problem with hidden visual editor still present in 3.0.3 and OptimizePress #3441

Closed codeforest closed 8 years ago

codeforest commented 8 years ago

Hi.

We have a hidden visual editor and no content div in admin, and this line is still breaking (wp-seo-post-scrapper-302.js, line 192):

var val = document.getElementById( 'content' ).value;

Could you be so kind and surround all versions of this with control if that element exists?

I can see that in some other files this is mentioned, too (wp-seo-shortcode-plugin-302.js):

document.getElementById( 'content' ).addEventListener( 'keydown', this.loadShortcodes.bind( this, this.declareReloaded.bind( this ) ) );
document.getElementById( 'content' ).addEventListener( 'change', this.loadShortcodes.bind( this, this.declareReloaded.bind( this ) ) );

Something like this would be great (just an example):

var contentElement =  document.getElementById('content');
if (typeof(contentElement) != 'undefined' && contentElement != null)
{
    var val = document.getElementById( 'content' ).value;
}

Best regards Zvonko Biskup

codeforest commented 8 years ago

I am sorry, this issue has been fixed in this pull request https://github.com/Yoast/wordpress-seo/pull/3404

Could you please merge that and close this?

Thanks Zvonko