Skip to content

Commit 46e427a

Browse files
authored
Merge pull request #20 from BeAPI/ver/1.0.6
Release 1.0.6
2 parents f52e1da + 0d24561 commit 46e427a

12 files changed

Lines changed: 72 additions & 145 deletions

File tree

.plugin-data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "1.0.5",
2+
"version": "1.0.6",
33
"slug": "blockparty-modal"
44
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ This plugin is distributed under the GPL-2.0-or-later license. See the [LICENSE]
272272

273273
See [readme.txt](readme.txt) for the full version history. Recent highlights:
274274

275+
- **1.0.6**
276+
- Fix `blueprint.json` config.
277+
275278
- **1.0.5**
276279
- Add `blueprint.json` to test the plugin on WordPress Playground.
277280
- Add `screen-reader-text` class to close button element when display icon only is selected.

blockparty-modal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: Blockparty Modal
44
* Description: Modal block for WordPress editor.
5-
* Version: 1.0.5
5+
* Version: 1.0.6
66
* Requires at least: 6.8
77
* Requires PHP: 8.1
88
* Author: Be API Technical Team
@@ -19,7 +19,7 @@
1919
exit; // Exit if accessed directly.
2020
}
2121

22-
define( 'BLOCKPARTY_MODAL_VERSION', '1.0.5' );
22+
define( 'BLOCKPARTY_MODAL_VERSION', '1.0.6' );
2323
define( 'BLOCKPARTY_MODAL_URL', plugin_dir_url( __FILE__ ) );
2424
define( 'BLOCKPARTY_MODAL_DIR', plugin_dir_path( __FILE__ ) );
2525

blueprint.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
3-
"landingPage": "/wp-admin/post.php?post=4&action=edit",
3+
"landingPage": "/blockparty-modal-demo/",
44
"preferredVersions": {
55
"php": "8.1",
66
"wp": "latest"
@@ -16,7 +16,7 @@
1616
"pluginData": {
1717
"resource": "git:directory",
1818
"url": "https://github.com/BeAPI/blockparty-modal",
19-
"ref": "1.0.5",
19+
"ref": "1.0.6",
2020
"refType": "tag"
2121
},
2222
"options": {
@@ -26,7 +26,7 @@
2626
},
2727
{
2828
"step": "runPHP",
29-
"code": "<?php require_once 'wordpress/wp-load.php'; $page_content = '<?php require_once 'wordpress/wp-load.php'; $page_content = '<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"linkedModalId\":\"m-e16de3fe79f9\"} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\">Open my modal window</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons -->\n\n<!-- wp:blockparty/modal {\"title\":\"My Modal\",\"modalId\":\"m-e16de3fe79f9\",\"displayIconOnly\":true,\"style\":{\"spacing\":{\"padding\":{\"top\":\"var:preset|spacing|40\",\"bottom\":\"var:preset|spacing|40\",\"left\":\"var:preset|spacing|40\",\"right\":\"var:preset|spacing|40\"}}}} -->\n<dialog class=\"wp-block-blockparty-modal\" style=\"padding-top:var(--wp--preset--spacing--40);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)\" id=\"modal-m-e16de3fe79f9\" aria-modal=\"true\" closedby=\"any\"><div class=\"wp-block-blockparty-modal__header\"><h2 class=\"wp-block-blockparty-modal__title\">My Modal</h2></div><div class=\"wp-block-blockparty-modal__content\"><!-- wp:paragraph -->\n<p>Blockparty Modal is a WordPress plugin that lets you add accessible modal dialogs to your content via the Gutenberg block editor. You define the modal content and behaviour in the editor; on the frontend, the modal is shown when the user activates a linked trigger (such as a button block).</p>\n<!-- /wp:paragraph --></div><button type=\"button\" class=\"wp-block-blockparty-modal__close-button\"><span class=\"sr-only\">Close this dialog window</span><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\"><path d=\"m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z\"></path></svg></button></dialog>\n<!-- /wp:blockparty/modal -->'; $page_id = wp_insert_post(array('post_title' => 'Blockparty Modal', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page')); echo 'Page created with ID: ' . $page_id; ?>'; $page_id = wp_insert_post(array('post_title' => 'Blockparty Modal', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page')); echo 'Page created with ID: ' . $page_id; ?>"
29+
"code": "<?php\nrequire_once '/wordpress/wp-load.php';\n$page_content = base64_decode( 'PCEtLSB3cDpidXR0b25zIC0tPgo8ZGl2IGNsYXNzPSJ3cC1ibG9jay1idXR0b25zIj48IS0tIHdwOmJ1dHRvbiB7ImxpbmtlZE1vZGFsSWQiOiJtLWUxNmRlM2ZlNzlmOSJ9IC0tPgo8ZGl2IGNsYXNzPSJ3cC1ibG9jay1idXR0b24iPjxhIGNsYXNzPSJ3cC1ibG9jay1idXR0b25fX2xpbmsgd3AtZWxlbWVudC1idXR0b24iPk9wZW4gbXkgbW9kYWwgd2luZG93PC9hPjwvZGl2Pgo8IS0tIC93cDpidXR0b24gLS0+PC9kaXY+CjwhLS0gL3dwOmJ1dHRvbnMgLS0+Cgo8IS0tIHdwOmJsb2NrcGFydHkvbW9kYWwgeyJ0aXRsZSI6Ik15IE1vZGFsIiwibW9kYWxJZCI6Im0tZTE2ZGUzZmU3OWY5IiwiZGlzcGxheUljb25Pbmx5Ijp0cnVlLCJzdHlsZSI6eyJzcGFjaW5nIjp7InBhZGRpbmciOnsidG9wIjoidmFyOnByZXNldHxzcGFjaW5nfDQwIiwiYm90dG9tIjoidmFyOnByZXNldHxzcGFjaW5nfDQwIiwibGVmdCI6InZhcjpwcmVzZXR8c3BhY2luZ3w0MCIsInJpZ2h0IjoidmFyOnByZXNldHxzcGFjaW5nfDQwIn19f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Y+PGJ1dHRvbiB0eXBlPSJidXR0b24iIGNsYXNzPSJ3cC1ibG9jay1ibG9ja3BhcnR5LW1vZGFsX19jbG9zZS1idXR0b24iPjxzcGFuIGNsYXNzPSJzci1vbmx5Ij5DbG9zZSB0aGlzIGRpYWxvZyB3aW5kb3c8L3NwYW4+PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBhcmlhLWhpZGRlbj0idHJ1ZSI+PHBhdGggZD0ibTEzLjA2IDEyIDYuNDctNi40Ny0xLjA2LTEuMDZMMTIgMTAuOTQgNS41MyA0LjQ3IDQuNDcgNS41MyAxMC45NCAxMmwtNi40NyA2LjQ3IDEuMDYgMS4wNkwxMiAxMy4wNmw2LjQ3IDYuNDcgMS4wNi0xLjA2TDEzLjA2IDEyWiI+PC9wYXRoPjwvc3ZnPjwvYnV0dG9uPjwvZGlhbG9nPgo8IS0tIC93cDpibG9ja3BhcnR5L21vZGFsIC0tPg==' );\n$page_id = wp_insert_post( array(\n\t'post_title' => 'Blockparty Modal',\n\t'post_name' => 'blockparty-modal-demo',\n\t'post_content' => $page_content,\n\t'post_status' => 'publish',\n\t'post_type' => 'page',\n) );\necho 'Page created with ID: ' . $page_id;\n?>"
3030
}
3131
]
3232
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blockparty-modal",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Add a modal block to the WordPress editor.",
55
"author": "Be API",
66
"license": "GPL-2.0-or-later",

readme.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove
4545

4646
== Changelog ==
4747

48+
= 1.0.6 =
49+
* Fix `blueprint.json` config.
50+
4851
= 1.0.5 =
4952
* Add `blueprint.json` to test the plugin on WordPress Playground.
5053
* Add `screen-reader-text` class to close button element when display icon only is selected.

src/blockparty-modal/block.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 3,
44
"name": "blockparty/modal",
5-
"version": "1.0.5",
5+
"version": "1.0.6",
66
"title": "Modal",
77
"category": "widgets",
88
"description": "Insert a modal dialog that opens on trigger. Configure content and behaviour in the editor; the modal is displayed on the frontend when activated.",
@@ -26,11 +26,7 @@
2626
"closedBy": {
2727
"type": "string",
2828
"default": "any",
29-
"enum": [
30-
"any",
31-
"closerequest",
32-
"none"
33-
]
29+
"enum": [ "any", "closerequest", "none" ]
3430
},
3531
"enableCloseButton": {
3632
"type": "boolean",
@@ -47,10 +43,7 @@
4743
},
4844
"example": {},
4945
"supports": {
50-
"align": [
51-
"wide",
52-
"full"
53-
],
46+
"align": [ "wide", "full" ],
5447
"dimensions": {
5548
"height": true,
5649
"minHeight": true

src/blockparty-modal/deprecated.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/blockparty-modal/edit.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,7 @@ export default function Edit( { clientId, attributes, setAttributes } ) {
209209
type="button"
210210
className="wp-block-blockparty-modal__close-button"
211211
>
212-
<span
213-
className={
214-
displayIconOnly
215-
? 'screen-reader-text sr-only'
216-
: ''
217-
}
218-
>
212+
<span className={ displayIconOnly ? 'sr-only' : '' }>
219213
{ __(
220214
'Close this dialog window',
221215
'blockparty-modal'

src/blockparty-modal/index.js

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import './style.scss';
1818

1919
import Edit from './edit';
2020
import save from './save';
21-
import deprecated from './deprecated';
2221
import metadata from './block.json';
2322

2423
import {
@@ -28,12 +27,11 @@ import {
2827
addLinkedModalAttribute,
2928
} from './utils';
3029

31-
registerBlockType( metadata.name, {
30+
registerBlockType(metadata.name, {
3231
icon: modal,
3332
edit: Edit,
3433
save,
35-
deprecated,
36-
} );
34+
});
3735

3836
/**
3937
* Returns the list of block names allowed as modal triggers (same as filter blockparty_modal_trigger_allowed_blocks).
@@ -43,99 +41,99 @@ registerBlockType( metadata.name, {
4341
*/
4442
function getModalTriggerAllowedBlocks() {
4543
try {
46-
const settings = select( 'core/block-editor' ).getSettings();
44+
const settings = select('core/block-editor').getSettings();
4745
const list = settings?.blockpartyModalTriggerAllowedBlocks;
48-
return Array.isArray( list ) ? list : [ 'core/button' ];
46+
return Array.isArray(list) ? list : ['core/button'];
4947
} catch {
50-
return [ 'core/button' ];
48+
return ['core/button'];
5149
}
5250
}
5351

5452
// Add linkedModalId attribute only to blocks allowed as modal triggers.
5553
addFilter(
5654
'blocks.registerBlockType',
5755
'blockparty-modal/add-linked-modal-attribute',
58-
( settings, blockName ) => {
56+
(settings, blockName) => {
5957
const allowedBlocks = getModalTriggerAllowedBlocks();
60-
if ( ! allowedBlocks.includes( blockName ) ) {
58+
if (!allowedBlocks.includes(blockName)) {
6159
return settings;
6260
}
63-
return addLinkedModalAttribute( settings );
61+
return addLinkedModalAttribute(settings);
6462
}
6563
);
6664

6765
// Blocks registered before our script loaded (e.g. core blocks) didn't get the
6866
// filter — re-register only allowed blocks so linkedModalId is persisted on save.
6967
const allowedBlocks = getModalTriggerAllowedBlocks();
7068
const blockTypes = getBlockTypes();
71-
blockTypes.forEach( ( blockType ) => {
69+
blockTypes.forEach((blockType) => {
7270
if (
73-
allowedBlocks.includes( blockType.name ) &&
74-
! blockType.attributes?.[ LINKED_MODAL_ATTR ]
71+
allowedBlocks.includes(blockType.name) &&
72+
!blockType.attributes?.[LINKED_MODAL_ATTR]
7573
) {
7674
registerBlockType(
7775
blockType.name,
78-
addLinkedModalAttribute( blockType )
76+
addLinkedModalAttribute(blockType)
7977
);
8078
}
81-
} );
79+
});
8280

8381
// Add "Attached modal" panel with Combobox only to blocks allowed as modal triggers (see filter blockparty_modal_trigger_allowed_blocks).
8482
addFilter(
8583
'editor.BlockEdit',
8684
'blockparty-modal/with-modal-trigger-control',
87-
( BlockEdit ) => ( props ) => {
85+
(BlockEdit) => (props) => {
8886
const { name, attributes, setAttributes } = props;
8987

90-
if ( name === MODAL_BLOCK_NAME ) {
91-
return <BlockEdit { ...props } />;
88+
if (name === MODAL_BLOCK_NAME) {
89+
return <BlockEdit {...props} />;
9290
}
9391

94-
const triggerAllowedBlocks = useSelect( ( storeSelect ) => {
95-
const settings = storeSelect( 'core/block-editor' ).getSettings();
92+
const triggerAllowedBlocks = useSelect((storeSelect) => {
93+
const settings = storeSelect('core/block-editor').getSettings();
9694
const list = settings?.blockpartyModalTriggerAllowedBlocks;
97-
return Array.isArray( list ) ? list : [ 'core/button' ];
98-
}, [] );
95+
return Array.isArray(list) ? list : ['core/button'];
96+
}, []);
9997

100-
if ( ! triggerAllowedBlocks.includes( name ) ) {
101-
return <BlockEdit { ...props } />;
98+
if (!triggerAllowedBlocks.includes(name)) {
99+
return <BlockEdit {...props} />;
102100
}
103101

104-
const modalOptions = useSelect( ( storeSelect ) => {
105-
return getModalOptionsFromEditor( storeSelect );
106-
}, [] );
102+
const modalOptions = useSelect((storeSelect) => {
103+
return getModalOptionsFromEditor(storeSelect);
104+
}, []);
107105

108106
const options = [
109-
{ value: '', label: __( 'None', 'blockparty-modal' ) },
107+
{ value: '', label: __('None', 'blockparty-modal') },
110108
...modalOptions,
111109
];
112110

113-
const value = attributes[ LINKED_MODAL_ATTR ] || '';
111+
const value = attributes[LINKED_MODAL_ATTR] || '';
114112

115113
return (
116114
<>
117-
<BlockEdit { ...props } />
115+
<BlockEdit {...props} />
118116
<InspectorControls key="blockparty-modal-trigger">
119117
<PanelBody
120-
title={ __( 'Attached modal', 'blockparty-modal' ) }
121-
initialOpen={ false }
118+
title={__('Attached modal', 'blockparty-modal')}
119+
initialOpen={false}
122120
>
123121
<ComboboxControl
124-
label={ __(
122+
label={__(
125123
'Modal to open when block is clicked',
126124
'blockparty-modal'
127-
) }
128-
value={ value }
129-
options={ options }
130-
onChange={ ( newValue ) =>
131-
setAttributes( {
132-
[ LINKED_MODAL_ATTR ]: newValue || '',
133-
} )
125+
)}
126+
value={value}
127+
options={options}
128+
onChange={(newValue) =>
129+
setAttributes({
130+
[LINKED_MODAL_ATTR]: newValue || '',
131+
})
134132
}
135-
placeholder={ __(
133+
placeholder={__(
136134
'Select a modal…',
137135
'blockparty-modal'
138-
) }
136+
)}
139137
/>
140138
</PanelBody>
141139
</InspectorControls>

0 commit comments

Comments
 (0)