Skip to content

Commit

Permalink
keyboard capitalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Dec 9, 2024
1 parent efe57e5 commit b2ad15f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,14 @@ function ParagraphBlock( {
tagName="p"
{ ...blockProps }
value={ content }
onChange={ ( newContent ) =>
setAttributes( { content: newContent } )
}
onChange={ ( newContent ) => {
// Capitalize the first letter only if the content is empty
const updatedContent = RichText.isEmpty( content )
? newContent.charAt( 0 ).toUpperCase() +
newContent.slice( 1 )
: newContent;
setAttributes( { content: updatedContent } );
} }
onMerge={ mergeBlocks }
onReplace={ onReplace }
onRemove={ onRemove }
Expand Down

0 comments on commit b2ad15f

Please sign in to comment.