Skip to content

Commit

Permalink
More robust check for isGutenbergEditorLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
pglewis committed Dec 6, 2018
1 parent 594b00e commit 80642ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ui/js/pods-dfv/_src/pods-dfv.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const PodsDFV = {
},

isGutenbergEditorLoaded: function () {
return ( wp.data !== undefined && wp.data.subscribe !== undefined );
return ( wp.data !== undefined && wp.data.select( 'core/editor' ) !== undefined );
}
};
export default PodsDFV;
Expand All @@ -99,7 +99,7 @@ document.addEventListener( 'DOMContentLoaded', () => {
*
* @todo Delete this when WP 5.0.1 comes out
*/
if ( wp.data && window.tinymce ) {
if ( PodsDFV.isGutenbergEditorLoaded() && window.tinymce ) {
wp.data.subscribe( function() {
if ( wp.data.select( 'core/editor' ).isSavingPost() && window.tinymce.editors) {
for ( let i = 0; i < tinymce.editors.length; i++ ) {
Expand Down
Loading

0 comments on commit 80642ec

Please sign in to comment.