-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Meta Boxes: Changing the way we save metaboxes
Hidden metaboxes (side) were not saved before
- Loading branch information
1 parent
0cb6eae
commit 13f869e
Showing
13 changed files
with
241 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
/** | ||
* Function returning the current Meta Boxes HTML in the editor | ||
* Function returning the current Meta Boxes DOM Node in the editor | ||
* whether the meta box area is opened or not. | ||
* This is not so clear, but I believe it's the only way to have this data synchronously | ||
* If the MetaBox Area is visible returns it, and returns the original container instead. | ||
* | ||
* @param {String} location Meta Box location | ||
* @returns {String} HTML content | ||
* @param {string} location Meta Box location. | ||
* @returns {string} HTML content. | ||
*/ | ||
export const getLocationHtml = ( location ) => { | ||
const area = document.querySelector( `.editor-meta-boxes-area.is-${ location } .editor-meta-boxes-area__container` ); | ||
export const getMetaBoxContainer = ( location ) => { | ||
const area = document.querySelector( `.editor-meta-boxes-area.is-${ location } .metabox-location-${ location }` ); | ||
if ( area ) { | ||
return area.innerHTML; | ||
return area; | ||
} | ||
|
||
return document.querySelector( '.metabox-location-' + location ).innerHTML; | ||
return document.querySelector( '#metaboxes .metabox-location-' + location ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.