Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix postExcerpt callback
  • Loading branch information
ntsekouras committed Apr 4, 2022
commit 8216852d2295b7ffcf9ee8c6c29e9ebd662c020d
11 changes: 6 additions & 5 deletions packages/editor/src/components/post-excerpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { __ } from '@wordpress/i18n';
import { ExternalLink, TextareaControl } from '@wordpress/components';
import { useSelect, useDispatch } from '@wordpress/data';
import { useCallback } from '@wordpress/element';
import { RichText } from '@wordpress/block-editor';

/**
Expand Down Expand Up @@ -53,13 +52,15 @@ export default function PostExcerpt( { isMinimal } ) {
( select ) => select( editorStore ).getEditedPostAttribute( 'excerpt' ),
[]
);
const onChange = useCallback( () => {
return ( newExcerpt ) => editPost( { excerpt: newExcerpt } );
}, [] );
const Component = isMinimal ? PostExcerptMinimal : PostExcerptVerbose;
return (
<div className="editor-post-excerpt">
<Component excerpt={ excerpt } onChange={ onChange } />
<Component
excerpt={ excerpt }
onChange={ ( newExcerpt ) =>
editPost( { excerpt: newExcerpt } )
}
/>
</div>
);
}