-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: Avoid private useBlockEditorSettings API #108
base: trunk
Are you sure you want to change the base?
Changes from 4 commits
e8d1fa9
f7bea62
e74ad30
a8fd55f
7e1a6aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,11 @@ function initializeEditor() { | |
dispatch( editorStore ).updateEditorSettings( editorSettings ); | ||
} ); | ||
|
||
dispatch( preferencesStore ).setDefaults( 'core/edit-post', { | ||
const preferenceDispatch = dispatch( preferencesStore ); | ||
preferenceDispatch.setDefaults( 'core', { | ||
fixedToolbar: true, | ||
} ); | ||
Comment on lines
+43
to
+45
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. Since we can no longer set |
||
preferenceDispatch.setDefaults( 'core/edit-post', { | ||
themeStyles, | ||
} ); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,18 +165,21 @@ export function getPost() { | |
if ( post ) { | ||
return { | ||
id: post.id, | ||
type: post.type || 'post', | ||
status: post.status, | ||
title: { raw: decodeURIComponent( post.title ) }, | ||
content: { raw: decodeURIComponent( post.content ) }, | ||
type: post.type || 'post', | ||
}; | ||
} | ||
|
||
// Since we don't use the auto-save functionality, draft posts need to have an ID. | ||
// We assign a temporary ID of -1. | ||
return { | ||
id: -1, | ||
type: 'post', | ||
status: 'auto-draft', | ||
id: -1, | ||
title: { raw: '' }, | ||
content: { raw: '' }, | ||
Comment on lines
+181
to
+182
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. Ensures draft posts do not throw exceptions when referencing values on undefined objects—this only occurred in development environments. |
||
}; | ||
} | ||
|
||
|
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.
Patch manually enables populating the Patterns and Media tabs within the inserter. As outlined in the PR description, this is a workaround that works for the local editor, but not the remote editor.
Ideally, we seek the Gutenberg project exposing the APIs we need to avoid this patch.