Fix FM module loader in Gutenberg context#818
Merged
Conversation
dlh01
approved these changes
Dec 8, 2021
js/fieldmanager-loader.js
Outdated
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(); | ||
| } | ||
| }); |
Member
There was a problem hiding this comment.
I know it's too late now, but there's some inconsistent spacing in parentheses in this block.
Contributor
Author
There was a problem hiding this comment.
Ugh. You're right. That's annoying. What standard are you generally using in this plugin—Nacin spacin' or Sans Nacin Spacin?
7e7470c to
e6442ac
Compare
Contributor
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This backports the fix in 0bf49fb to the 1.3 branch.
See #815.