-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MetaBoxes: compare meta boxes HTML while leaving the editor to warn a…
…bout unsaved changes
- Loading branch information
1 parent
9eff87c
commit 35276f0
Showing
5 changed files
with
38 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Function returning the current Meta Boxes HTML 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 | ||
* | ||
* @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` ); | ||
if ( area ) { | ||
return area.innerHTML; | ||
} | ||
|
||
return document.querySelector( '.metabox-location-' + location ).innerHTML; | ||
}; |
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