I found the cause of this issue. Video-js.php is using the mce_buttons filter to write some options to each page. ACF is also using that filter but is pulling in the echoed code in that filter to it’s javascript. (see https://cl.ly/image/28390z313i2o)
To avoid this error I simply move the line that is retrieving and echoing the options (line 287 and 288 in video-js.php) to live within the mce_external_plugins filter 6 lines below that. The options still get echoed to the DOM and ACF doesn’t rewrite it into it’s JS. Seems that all parties are happy.
So for an example…. this code at the bottom of video-js.php:
function register_video_js_button($buttons) {
array_push($buttons, "|", "videojs");
$options = get_option('videojs_options');
echo('<div style="display:none"><input type="hidden" id="videojs-autoplay-default" value="' . $options['videojs_autoplay'] . '"><input type="hidden" id="videojs-preload-default" value="' . $options['videojs_preload'] . '"></div>'); //the default values from the admin screen, to be used by our javascript
return $buttons;
}
function video_js_mce_plugin($plugin_array) {
$plugin_array['videojs'] = plugins_url( 'mce-button.js' , __FILE__ );
return $plugin_array;
}
Becomes this:
function register_video_js_button($buttons) {
array_push($buttons, "|", "videojs");
return $buttons;
}
function video_js_mce_plugin($plugin_array) {
$options = get_option('videojs_options');
echo('<div style="display:none"><input type="hidden" id="videojs-autoplay-default" value="' . $options['videojs_autoplay'] . '"><input type="hidden" id="videojs-preload-default" value="' . $options['videojs_preload'] . '"></div>'); //the default values from the admin screen, to be used by our javascript
$plugin_array['videojs'] = plugins_url( 'mce-button.js' , __FILE__ );
return $plugin_array;
}
I’m sure there is a better way to do this, but this seems to at least do the trick for now.