From 636dcf94f15b4f02d5a917065effe37d98a9c59b Mon Sep 17 00:00:00 2001 From: SohamPatel46 Date: Thu, 9 Jan 2025 17:54:02 +0530 Subject: [PATCH] Add copy handler story --- packages/block-editor/README.md | 8 +++- .../src/components/copy-handler/index.js | 6 ++- .../copy-handler/stories/index.story.js | 42 +++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 packages/block-editor/src/components/copy-handler/stories/index.story.js diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 13dffce114f59..334b411d019de 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -347,9 +347,15 @@ _Related_ > **Deprecated** +'The CopyHandler component catches copy/cut and paste events coming from its props.children. + _Parameters_ -- _props_ `Object`: +- _props_ `Object`: The props for the component. + +_Returns_ + +- `Element`: The block type item element. ### createCustomColorsHOC diff --git a/packages/block-editor/src/components/copy-handler/index.js b/packages/block-editor/src/components/copy-handler/index.js index 0b0318c387fab..e2236b31e8fed 100644 --- a/packages/block-editor/src/components/copy-handler/index.js +++ b/packages/block-editor/src/components/copy-handler/index.js @@ -21,8 +21,12 @@ export const __unstableUseClipboardHandler = () => { }; /** + * 'The CopyHandler component catches copy/cut and paste events coming from its props.children. + * * @deprecated - * @param {Object} props + * + * @param {Object} props The props for the component. + * @return {Element} The block type item element. */ export default function CopyHandler( props ) { deprecated( 'CopyHandler', { diff --git a/packages/block-editor/src/components/copy-handler/stories/index.story.js b/packages/block-editor/src/components/copy-handler/stories/index.story.js new file mode 100644 index 0000000000000..8c512df53e5db --- /dev/null +++ b/packages/block-editor/src/components/copy-handler/stories/index.story.js @@ -0,0 +1,42 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import CopyHandler from '../'; + +export default { + title: 'BlockEditor/CopyHandler', + component: CopyHandler, + parameters: { + docs: { + canvas: { sourceState: 'shown' }, + description: { + component: + 'The `CopyHandler` component catches copy/cut and paste events coming from its props.children.', + }, + }, + }, + argTypes: { + props: { + control: false, + description: 'The props for the component.', + table: { + type: { summary: 'object' }, + }, + }, + }, +}; + +export const Default = { + render: function Template( args ) { + return ( + + + + ); + }, +};