UNPKG

595 BJavaScriptView Raw
1/**
2 * Function returning the current Meta Boxes DOM Node in the editor
3 * whether the meta box area is opened or not.
4 * If the MetaBox Area is visible returns it, and returns the original container instead.
5 *
6 * @param {string} location Meta Box location.
7 * @return {string} HTML content.
8 */
9export const getMetaBoxContainer = ( location ) => {
10 const area = document.querySelector( `.edit-post-meta-boxes-area.is-${ location } .metabox-location-${ location }` );
11 if ( area ) {
12 return area;
13 }
14
15 return document.querySelector( '#metaboxes .metabox-location-' + location );
16};