Skip to content

Commit

Permalink
Use attribute default value
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed May 24, 2024
1 parent 52e3144 commit 68bc508
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/block-library/src/more/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"textdomain": "default",
"attributes": {
"customText": {
"type": "string"
"type": "string",
"default": ""
},
"noTeaser": {
"type": "boolean",
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/more/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import { getDefaultBlockName, createBlock } from '@wordpress/blocks';
const DEFAULT_TEXT = __( 'Read more' );

export default function MoreEdit( {
attributes: { customText = '', noTeaser },
attributes: { customText, noTeaser },
insertBlocksAfter,
setAttributes,
} ) {
const onChangeInput = ( event ) => {
setAttributes( {
customText:
event.target.value !== '' ? event.target.value : undefined,
customText: event.target.value,
} );
};

Expand Down

0 comments on commit 68bc508

Please sign in to comment.