Skip to content

Fix FM module loader in Gutenberg context#818

Merged
joemcgill merged 1 commit into1.3from
update/backport-815-fmloader-fix
Dec 8, 2021
Merged

Fix FM module loader in Gutenberg context#818
joemcgill merged 1 commit into1.3from
update/backport-815-fmloader-fix

Conversation

@joemcgill
Copy link
Copy Markdown
Contributor

This backports the fix in 0bf49fb to the 1.3 branch.

See #815.

Copy link
Copy Markdown
Member

@dlh01 dlh01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌳

Comment on lines +14 to +34
if (document.querySelector('.block-editor-page')) {
const unsubscribeListener = wp.data.subscribe(() => {
/**
* `areMetaBoxesInitialized` is called immediately before the
* `MetaBoxesArea` component is rendered, which is where the metabox
* HTML is moved from the hidden div and into the main form element.
*
* This means we need to checks for the existence of the markup in the
* DOM before we run our callbacks and then unsubscribe our listener.
*
* @link https://github.com/WordPress/gutenberg/blob/019d0a1b1883a5c3e5c9cdecc60bd5e546b60a1b/packages/edit-post/src/components/meta-boxes/index.js#L38-L45
* @link https://github.com/WordPress/gutenberg/blob/d39949a3b9dc8e12d5f5d33b9091f14b93b37c8a/packages/edit-post/src/components/meta-boxes/meta-boxes-area/index.js#L34-L36
*/
if (
wp.data.select( 'core/edit-post' ).areMetaBoxesInitialized()
&& document.querySelector('.edit-post-meta-boxes-area__container')
) {
callback();
unsubscribeListener();
}
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's too late now, but there's some inconsistent spacing in parentheses in this block.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. You're right. That's annoying. What standard are you generally using in this plugin—Nacin spacin' or Sans Nacin Spacin?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nacin' spacin', traditionally.

This backports the fix in 0bf49fb to the 1.3 branch.

See #815, #819.
@joemcgill joemcgill force-pushed the update/backport-815-fmloader-fix branch from 7e7470c to e6442ac Compare December 8, 2021 01:55
@joemcgill
Copy link
Copy Markdown
Contributor Author

@dlh01 I created #819 to address the spacing and have force pushed an update to this branch so the backport can remain a single commit.

@joemcgill joemcgill merged commit 67f1879 into 1.3 Dec 8, 2021
@joemcgill joemcgill deleted the update/backport-815-fmloader-fix branch December 8, 2021 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants