Closed turtlepod closed 5 months ago
@dkotter I think it's because of this line of code: https://github.com/10up/safe-svg/blob/f8f90d483a9ed83c8c322ee31c40ea54cec4395b/includes/optimizer.php#L43
The JS need gutenberg, so, technically, this need to be updated from admin_enqueue_scripts
to enqueue_block_editor_assets
?
@turtlepod That makes sense to me but I've been unable to reproduce this.
That JS file is only loaded if the optimizer feature is enabled (do this by returning true
in the safe_svg_optimizer_enabled
filter). I've set this up and I see the file loading but I'm not getting any errors in the console when testing in the Classic Editor. Are there other steps I need to take?
And I guess one other thing in thinking through this more, I believe this was set up to fire not only in the editor but when media is directly uploaded, so I think loading the script on enqueue_block_editor_assets
would break that functionality
@dkotter I tested and I can reproduce. Yes, this issue is only if we use the safe_svg_optimizer_enabled filter. Apparently the issue is probably a conflict with Yoast SEO. Can you confirm this and simply enable Yoast to check? Thanks
@turtlepod Thanks for the additional information. I had originally tested with Yoast but couldn't reproduce the issue. Turns out I had another plugin installed that was loading the proper dependencies which fixed the issue. I've opened #187 to address this, if you have time to test that and ensure it fixes things for you.
@dkotter I tested and the fix is working as expected! Thank you!
Describe the bug
JS fatal error. Uncaught TypeError: Cannot read properties of undefined (reading 'isSavingPost')
Steps to Reproduce
Enable Safe SVG in Classic Editor Edit Post
Screenshots, screen recording, code snippet
Environment information
WPEngine
WordPress information
WordPress 6.4.x
Code of Conduct