-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync settings from editor store to block-editor store #47287
Changes from all commits
c2c22b7
8673a94
047c1b7
8943ba3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,4 @@ export const EDITOR_SETTINGS_DEFAULTS = { | |
richEditingEnabled: true, | ||
codeEditingEnabled: true, | ||
enableCustomFields: undefined, | ||
supportsLayout: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reasons for the changes to the "default" values? What impact this could have? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This value is wrong for the mobile editor. It should be inherited from default block editor settings (the Until now it didn't matter because nobody read the |
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this has been removed, where's the filtering happening now? (Sorry I missed the ping earlier)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no filtering now, the entire editor settings object will be propagated to block editor settings. Technically it causes no harm, or does it? I can see one good reason for filtering, and that is a reliable and well-defined public API, but that's all.
I removed the filtering because it was standing in the way of synchronizing settings in the mobile
EditorProvider
. Before this PR, it calleddispatch( 'core/block-editor').updateSettings
directly, and circumvented the filter. But now it callsdispatch( 'core/editor' ).updateEditorSettings
and relies on the settings to be synced to block editor. Here the updates go through the filter.I found it hard to figure out the set of supported mobile block editor settings, see e.g. the
capabilities
confusion solved in #47417. Once all this is sorted out, I'll be happy to add the filter back.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no filtering now, the entire editor settings object will be propagated to block editor settings. Technically it causes no harm, or does it?
Well now, folks will be able to access settings using `select( 'core/block-editor' ).getSettings() that were specific to the edit-post package and it creates wrong expectations. Ideally only block-editor specific settings should be passed down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the important thing here is that the filtering is going to be needed for 6.2 (so before next Gutenberg RC) if we don't backward compatibility issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I'll add it back ASAP. Note that it's possible to circumvent this filter and set an arbitrary block-editor setting with
dispatch( 'core/block-editor').updateSettings()
. Mobile editor does that withcapabilities
and other settings:capabilities
is read by theeditor
package, by specific blocks ("image" and "missing") and byrich-text
(to implement support for mentions and xposts, which seems Jetpack or A8c-specific to me?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I mean folks might ask us why
enableCustomFields
for instance is not available anymore in the "site editor" or something while it's an edit-post specific flag...Granted that it's not perfect, I guess I'm just leaning towards a defensive mode here in terms of what's exposed and where.