Skip to content

Commit

Permalink
Editor: Correctly select post title support in 'DocumentOutline' (#67109
Browse files Browse the repository at this point in the history
)


Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
Mamaduka and Mamaduka authored Nov 19, 2024
1 parent c772226 commit 89b47b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ Renders a document outline component.
_Parameters_

- _props_ `Object`: Props.
- _props.onSelect_ `Function`: Function to be called when an outline item is selected.
- _props.isTitleSupported_ `boolean`: Indicates whether the title is supported.
- _props.onSelect_ `Function`: Function to be called when an outline item is selected
- _props.hasOutlineItemsDisabled_ `boolean`: Indicates whether the outline items are disabled.

_Returns_
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/document-outline/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function DocumentOutlineCheck( { children } ) {
return getGlobalBlockCount( 'core/heading' ) > 0;
} );

if ( hasHeadings ) {
if ( ! hasHeadings ) {
return null;
}

Expand Down
6 changes: 2 additions & 4 deletions packages/editor/src/components/document-outline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,17 @@ const isEmptyHeading = ( heading ) =>
* Renders a document outline component.
*
* @param {Object} props Props.
* @param {Function} props.onSelect Function to be called when an outline item is selected.
* @param {boolean} props.isTitleSupported Indicates whether the title is supported.
* @param {Function} props.onSelect Function to be called when an outline item is selected
* @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
*
* @return {Component} The component to be rendered.
*/
export default function DocumentOutline( {
onSelect,
isTitleSupported,
hasOutlineItemsDisabled,
} ) {
const { selectBlock } = useDispatch( blockEditorStore );
const { blocks, title } = useSelect( ( select ) => {
const { blocks, title, isTitleSupported } = useSelect( ( select ) => {
const { getBlocks } = select( blockEditorStore );
const { getEditedPostAttribute } = select( editorStore );
const { getPostType } = select( coreStore );
Expand Down

0 comments on commit 89b47b4

Please sign in to comment.