On normal non-beaver-builder pages/posts everything works fine. However while the Embed Any Document “Add Document” shows up on text blocks in a Beaver Builder page the modal it spawns is empty and then requires the user to refresh the entire page.
Looking into it I see that the Embed Any Document plugin calls
And removing the call to embedpopup creates the same behavior in the normal wordpress backend. So it seems to me that if I can call embedpopup (or my own duplicate of it) at the correct time on page builder pages the Add Document button should work (all it eventually does is insert a shortcode). So does the Beaver Builder plugin have a similar hook as admin_footer? Or perhaps I’m thinking about this wrong?
We don’t allow 3rd party plugin enhancements to the Text Editor module since it causes too many conflicts. One of those is the one you mentioned above, most of their scripts are only loaded on the backend.
What happens though when you use the plugin on the native WP editor? Does it render a shortcode? Maybe you can just copy the code on the native WP editor, then paste it into the Text Editor or HTML module. Have you given that a shot?
Re your question, you can add that script using the wp_enqueue_scripts hook and you can add a condition so it only loads it when the page builder is active like so…
function enqueue_my_scripts() {
if ( FLBuilderModel::is_builder_active() ) {
// Enqueue here.
}
}
add_action( 'wp_enqueue_scripts','enqueue_my_scripts' );
Thanks Ben! That’s very helpful. Although unfortunately (but perhaps unexpectedly) the popup.php file that renders the modal relies on the Embed Any Document class context so this approach doesn’t work
So I’m going to use CSS to hide the “Add Document” button and teach the user the workaround (all the plugin does is insert a shortcode).