-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Move the post title selection state to the store and update PostTitle #16704
Changes from 1 commit
630d474
4c7ca6a
e1cc965
e787c58
cc71382
6b38663
1e248f1
243cd5d
5424076
db39db5
b58b35a
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 |
---|---|---|
|
@@ -97,14 +97,15 @@ export default compose( | |
isSelected: isPostTitleSelected(), | ||
}; | ||
} ), | ||
withDispatch( ( dispatch, ownProps ) => { | ||
withDispatch( ( dispatch ) => { | ||
const { | ||
undo, | ||
redo, | ||
togglePostTitleSelection, | ||
} = dispatch( 'core/editor' ); | ||
|
||
const { | ||
clearSelectedBlock, | ||
insertDefaultBlock, | ||
} = dispatch( 'core/block-editor' ); | ||
|
||
|
@@ -116,11 +117,10 @@ export default compose( | |
onRedo: redo, | ||
onSelect() { | ||
togglePostTitleSelection( true ); | ||
ownProps.onSelect(); | ||
clearSelectedBlock(); | ||
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. Asking more for my understanding: is it worth considering handling the 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. A reducer should only ever update the state so I don't think it would be appropriate. An action could be calling another action but I think it's more explicit to have it here, especially since it's a different store! 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. Good point about the reducer just updating the store, and I totally overlooked the different store. Thanks! 👍 |
||
}, | ||
onUnselect() { | ||
togglePostTitleSelection( false ); | ||
ownProps.onUnselect(); | ||
}, | ||
}; | ||
} ), | ||
|
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.
Just curious, is there a reason to use the
isPostTitleSelected
selector here in visual-editor and pass the resulting value down to theBlockList
as a prop instead of just using theisPostTitleSelected
selector directly inside ofBlockList
itself?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 simply wanted to minimize the changes to the native part here. #16677 will be responsible of refactoring the VisualEditor and moving the block picker out of BlockList into an
Inserter
component.