From 81a246b7a52f0e520c25f1ce93787d863def44ea Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 08:50:46 -0500 Subject: [PATCH 1/8] Add stub WithBlockXrayPanel HOC --- src/hocs/WithBlockXrayPanel/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/hocs/WithBlockXrayPanel/index.js diff --git a/src/hocs/WithBlockXrayPanel/index.js b/src/hocs/WithBlockXrayPanel/index.js new file mode 100644 index 0000000..7b0f8d8 --- /dev/null +++ b/src/hocs/WithBlockXrayPanel/index.js @@ -0,0 +1,9 @@ +export default function WithBlockXrayPanel(WrappedComponent) { + return props => { + return ( + + ); + }; +} From 8058bee0b991f8a69b3449ea0ff439ca353be74f Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 09:01:36 -0500 Subject: [PATCH 2/8] Add sidebar panel to WithBlockXrayPanel HOC --- src/hocs/WithBlockXrayPanel/index.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/hocs/WithBlockXrayPanel/index.js b/src/hocs/WithBlockXrayPanel/index.js index 7b0f8d8..b7fb52d 100644 --- a/src/hocs/WithBlockXrayPanel/index.js +++ b/src/hocs/WithBlockXrayPanel/index.js @@ -1,9 +1,30 @@ +/* global wp */ + +const { + components: { + PanelBody, + }, + editor: { + InspectorControls, + }, + i18n: { + __, + }, +} = wp; + export default function WithBlockXrayPanel(WrappedComponent) { return props => { return ( - + <> + + + +

salcode

+
+
+ ); }; } From 3c58a9c132c4a7622a984b112d3536ed0da8b26c Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 09:03:21 -0500 Subject: [PATCH 3/8] Use import instead of destructure --- src/hocs/WithBlockXrayPanel/index.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/hocs/WithBlockXrayPanel/index.js b/src/hocs/WithBlockXrayPanel/index.js index b7fb52d..8ce1cc6 100644 --- a/src/hocs/WithBlockXrayPanel/index.js +++ b/src/hocs/WithBlockXrayPanel/index.js @@ -1,16 +1,6 @@ -/* global wp */ - -const { - components: { - PanelBody, - }, - editor: { - InspectorControls, - }, - i18n: { - __, - }, -} = wp; +import { PanelBody } from '@wordpress/components'; +import { InspectorControls } from '@wordpress/editor'; +import { __ } from '@wordpress/i18n'; export default function WithBlockXrayPanel(WrappedComponent) { return props => { From 474df4c2c51d21a6defba75abdabdff9aeb2635a Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 09:05:15 -0500 Subject: [PATCH 4/8] Update PanelBody attributes --- src/hocs/WithBlockXrayPanel/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hocs/WithBlockXrayPanel/index.js b/src/hocs/WithBlockXrayPanel/index.js index 8ce1cc6..35de5f2 100644 --- a/src/hocs/WithBlockXrayPanel/index.js +++ b/src/hocs/WithBlockXrayPanel/index.js @@ -10,7 +10,10 @@ export default function WithBlockXrayPanel(WrappedComponent) { {...props} /> - +

salcode

From 5f2e4d9234313ec157db6e7fa522e916536d6fcb Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 09:09:02 -0500 Subject: [PATCH 5/8] Add BlockXrayWithSelectedBlock --- src/hocs/WithBlockXrayPanel/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/hocs/WithBlockXrayPanel/index.js b/src/hocs/WithBlockXrayPanel/index.js index 35de5f2..b991d6e 100644 --- a/src/hocs/WithBlockXrayPanel/index.js +++ b/src/hocs/WithBlockXrayPanel/index.js @@ -2,6 +2,13 @@ import { PanelBody } from '@wordpress/components'; import { InspectorControls } from '@wordpress/editor'; import { __ } from '@wordpress/i18n'; +import BlockXray from '../../components/BlockXray'; +import WithSelectedBlock from '../WithSelectedBlock'; + +const BlockXrayWithSelectedBlock = WithSelectedBlock( + BlockXray, +); + export default function WithBlockXrayPanel(WrappedComponent) { return props => { return ( @@ -14,7 +21,7 @@ export default function WithBlockXrayPanel(WrappedComponent) { icon="code-standards" title={__('Block X-ray', 'block-xray-attributes')} > -

salcode

+ From e253c5b09c739e82c662b22bf5545a25121f80a3 Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 09:11:27 -0500 Subject: [PATCH 6/8] Load via editor.BlockEdit filter Load via editor.BlockEdit filter instead of as a plugin --- src/index.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 9a6f249..f28bbdb 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,7 @@ -import { registerPlugin } from '@wordpress/plugins'; +import WithBlockXrayPanel from './hocs/WithBlockXrayPanel'; -import BlockXrayPanel from './components/BlockXrayPanel'; - -registerPlugin( +wp.hooks.addFilter( + 'editor.BlockEdit', 'block-xray-attributes', - { - render: () => - }, + WithBlockXrayPanel ); From fc111340f5201275d2c20cd17d502445902bf5d5 Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Sun, 16 Feb 2025 09:17:31 -0500 Subject: [PATCH 7/8] Remove unused BlockXrayPanel component --- src/components/BlockXrayPanel/index.js | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 src/components/BlockXrayPanel/index.js diff --git a/src/components/BlockXrayPanel/index.js b/src/components/BlockXrayPanel/index.js deleted file mode 100644 index 2714af3..0000000 --- a/src/components/BlockXrayPanel/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; -import { __ } from '@wordpress/i18n'; - -import BlockXray from '../BlockXray'; -import WithSelectedBlock from '../../hocs/WithSelectedBlock'; - -const BlockXrayWithSelectedBlock = WithSelectedBlock( - BlockXray, -); - -export default function BlockXrayPanel() { - return ( - - - - ); -} From cea3d36344d1aafdc58f53aefd2b5e7741dd67a7 Mon Sep 17 00:00:00 2001 From: Sal Ferrarello <5194588+salcode@users.noreply.github.com> Date: Tue, 1 Apr 2025 08:23:53 -0400 Subject: [PATCH 8/8] Add changelog entry See #33 --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a14407c..ca4eb5e 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ The banner and icon assets were created from the [Medical Xray SVG Vector](https ## Changelog +### Unreleased + +* Render block information in "Block" settings rather than "Post" settings ([#33 Render block information in "Block" settings](https://github.com/salcode/block-xray-attributes/issues/33)) + ### 1.2.1 * Add Banner and Icon assets (see [How Your Plugin Assets Work](https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/) from the WordPress Plugin Handbook)