Skip to content

Commit

Permalink
ClipboardButton make onFinishCopy optional attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Jun 12, 2020
1 parent 60825bf commit dcd525a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export default function BlockActions( { clientIds, children } ) {
}
replaceBlocks( clientIds, newBlocks );
},

onUngroup() {
if ( ! blocks.length ) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export function BlockSettingsDropdown( { clientIds, ...props } ) {
role="menuitem"
className="components-menu-item__button"
onCopy={ onCopy }
onFinishCopy={ onClose }
>
{ __( 'Copy' ) }
</ClipboardButton>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/clipboard-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default function ClipboardButton( {
return;
}

if ( hasCopied ) {
if ( hasCopied && typeof onCopy === 'function' ) {
onCopy();
} else {
} else if ( typeof onFinishCopy === 'function' ) {
onFinishCopy();
}

Expand Down

0 comments on commit dcd525a

Please sign in to comment.