Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/.github
/node_modules
/src
/tests

# Configuration files
.distignore
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/.github export-ignore
/node_modules export-ignore
/src export-ignore
/tests export-ignore

# Configuration files
/.distignore export-ignore
Expand Down
34 changes: 10 additions & 24 deletions .github/workflows/pull-request-version.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
name: "Check plugin version and tags"
name: "Check plugin version and release files"
on:
pull_request:
branches:
- main

jobs:
version-check:
name: "Check version doesn't not already exists."
name: "Version bump, tag, and file checks"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- id: set-vars
name: "Set variables from .plugin-data file"
run: |
# Get all data from .plugin-data file
content=`cat ./.plugin-data`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=pluginData::$content"
- name: Fetch tags
run: git fetch --tags --prune origin

- id: version-check
name: "Check version in .plugin-data is not existing"
run: |
# Check version from .plugin-data
VERSION=${{fromJson(steps.set-vars.outputs.pluginData).version}}

if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag aleady exists please update the .plugin-data file to good version";
exit 1;
fi
- name: Verify version bump and release files
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: tests/bin/check-release-version.sh
2 changes: 2 additions & 0 deletions .github/workflows/quality-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
pull_request:
paths:
- 'src/**'
- 'package.json'
push:
paths:
- 'src/**'
- 'package.json'
branches:
- main

Expand Down
2 changes: 1 addition & 1 deletion .plugin-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.0.7",
"version": "1.0.8",
"slug": "blockparty-modal"
}
36 changes: 36 additions & 0 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/blockparty-modal-demo/",
"preferredVersions": {
"php": "8.1",
"wp": "latest"
},
"steps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "git:directory",
"url": "https://github.com/BeAPI/blockparty-modal",
"ref": "1.0.8",
"refType": "tag"
},
"options": {
"activate": true,
"targetFolderName": "blockparty-modal"
}
},
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "runPHP",
"code": "<?php\nrequire_once 'wordpress/wp-load.php';\n$dir = WP_CONTENT_DIR . '/mu-plugins';\nif ( ! is_dir( $dir ) ) {\n\twp_mkdir_p( $dir );\n}\n$file = $dir . '/blockparty-modal-playground-svg-kses.php';\n$lines = array(\n\t'<?php',\n\t'add_filter( \\'wp_kses_allowed_html\\', function( $tags, $context ) {',\n\t'\tif ( \\'post\\' !== $context ) {',\n\t'\t\treturn $tags;',\n\t'\t}',\n\t'\t$tags[\\'dialog\\'] = array(',\n\t'\t\t\\'aria-modal\\' => true,',\n\t'\t\t\\'class\\' => true,',\n\t'\t\t\\'style\\' => true,',\n\t'\t\t\\'id\\' => true,',\n\t'\t\t\\'closedby\\' => true,',\n\t'\t);',\n\t'\t$tags[\\'svg\\'] = array(',\n\t'\t\t\\'xmlns\\' => true,',\n\t'\t\t\\'viewbox\\' => true,',\n\t'\t\t\\'width\\' => true,',\n\t'\t\t\\'height\\' => true,',\n\t'\t\t\\'fill\\' => true,',\n\t'\t\t\\'class\\' => true,',\n\t'\t\t\\'aria-hidden\\' => true,',\n\t'\t\t\\'role\\' => true,',\n\t'\t\t\\'focusable\\' => true,',\n\t'\t);',\n\t'\t$tags[\\'path\\'] = array(',\n\t'\t\t\\'d\\' => true,',\n\t'\t\t\\'fill\\' => true,',\n\t'\t\t\\'class\\' => true,',\n\t'\t);',\n\t'\treturn $tags;',\n\t'}, 10, 2 );',\n);\nfile_put_contents( $file, implode( \"\\n\", $lines ) . \"\\n\" );\necho file_exists( $file ) ? 'mu-plugin installed' : 'mu-plugin failed';\n?>"
},
{
"step": "runPHP",
"code": "<?php require_once 'wordpress/wp-load.php'; $page_content = '<!-- wp:group {\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\",\"bottom\":\"0\"},\"blockGap\":\"var:preset|spacing|40\"}},\"layout\":{\"type\":\"constrained\"}} -->\n<div class=\"wp-block-group\" style=\"margin-top:0;margin-bottom:0\"><!-- wp:paragraph -->\n<p>Click on the button below to reveal a dialog window.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:buttons {\"layout\":{\"type\":\"flex\",\"justifyContent\":\"center\"}} -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"linkedModalId\":\"m-4dc3f7ac0a14\"} -->\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\">About Gutenberg</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons --></div>\n<!-- /wp:group -->\n\n<!-- wp:blockparty/modal {\"title\":\"Johannes Gutenberg\",\"modalId\":\"m-4dc3f7ac0a14\",\"displayIconOnly\":true,\"style\":{\"spacing\":{\"padding\":{\"right\":\"var:preset|spacing|40\",\"left\":\"var:preset|spacing|40\",\"top\":\"var:preset|spacing|40\",\"bottom\":\"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-4dc3f7ac0a14\" aria-modal=\"true\" closedby=\"any\"><div class=\"wp-block-blockparty-modal__header\"><h2 class=\"wp-block-blockparty-modal__title\">Johannes Gutenberg</h2></div><div class=\"wp-block-blockparty-modal__content\"><!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><!-- wp:paragraph -->\n<p><em>\"Gutenberg\" redirects here. For the Bible, see </em><a href=\"https://en.wikipedia.org/wiki/Gutenberg_Bible\">Gutenberg Bible</a><em>. For other uses, see </em><a href=\"https://en.wikipedia.org/wiki/Gutenberg_(disambiguation)\">Gutenberg (disambiguation)</a><em>.</em></p>\n<!-- /wp:paragraph --></blockquote>\n<!-- /wp:quote -->\n\n<!-- wp:paragraph -->\n<p><strong>Johannes Gensfleisch zur Laden zum Gutenberg</strong> (c. 1393–1406 – 3 February 1468) was a German inventor and <a href=\"https://en.wikipedia.org/wiki/Artisan\">craftsman</a> who invented the movable-type <a href=\"https://en.wikipedia.org/wiki/Printing_press\">printing press</a>. Though <a href=\"https://en.wikipedia.org/wiki/Movable_type\">movable type</a> was already in use in East Asia, Gutenberg\\'s invention of the printing press enabled a much faster rate of <a href=\"https://en.wikipedia.org/wiki/Printing\">printing</a>. The printing press later <a href=\"https://en.wikipedia.org/wiki/Global_spread_of_the_printing_press\">spread across the world</a>, and led to an <a href=\"https://en.wikipedia.org/wiki/Information_revolution\">information revolution</a> and the unprecedented mass-spread of literature throughout Europe. It had a profound impact on the development of the <a href=\"https://en.wikipedia.org/wiki/Renaissance\">Renaissance</a>, <a href=\"https://en.wikipedia.org/wiki/Reformation\">Reformation</a>, and <a href=\"https://en.wikipedia.org/wiki/Humanist\">humanist</a> movements.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph {\"align\":\"right\",\"fontSize\":\"small\"} -->\n<p class=\"has-text-align-right has-small-font-size\">Source : <a href=\"https://en.wikipedia.org/wiki/Johannes_Gutenberg\">Wikipedia</a></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_name' => 'blockparty-modal-demo', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page' ) ); echo 'Page created with ID: ' . $page_id; ?>"
}
]
}
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.8]

* Add GitHub Actions check and `tests/bin/check-release-version.sh` to validate that release version bumps are consistent across all versioned files.
* Add this changelog file (Keep a Changelog format).
* Update WordPress Playground `blueprint.json` demo page content.
* Run the JavaScript quality workflow when `package.json` changes.
* Exclude the `tests/` directory from plugin distribution archives.
* Remove Psalm from development dependencies and GrumPHP.

## [1.0.7]

* Add block setting for the close button label.

## [1.0.6]

* Fix `blueprint.json` config.

## [1.0.5]

* Add `blueprint.json` to test the plugin on WordPress Playground.
* Add `screen-reader-text` class to close button element when display icon only is selected.

## [1.0.4]

* Filter `blockparty_modal_inner_allowed_blocks` to control allowed blocks in the modal.

## [1.0.3]

* Fix: prevent adding linkedModalId attribute to non allowed blocks.
* Set min required PHP version to 8.1

## [1.0.2]

* Filter `blockparty_modal_trigger_allowed_blocks` to control which blocks can be modal triggers; dialog margin and InnerBlocks fixes.
* Crawl Modal blocks from patterns
* Style issues

## [1.0.1]

* Fix margin style for dialog element; set to auto by default instead of 0.
* Remove dupplicated InnerBlocks.Content

## [1.0.0]

* Initial release
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Blockparty — Modal

[![Test with WordPress Playground](https://img.shields.io/badge/Test%20with-WordPress%20Playground-0073aa?style=for-the-badge&logo=wordpress&logoColor=white)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/beapi/blockparty-modal/refs/heads/main/blueprint.json)
[![Test with WordPress Playground](https://img.shields.io/badge/Test%20with-WordPress%20Playground-0073aa?style=for-the-badge&logo=wordpress&logoColor=white)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/beapi/blockparty-modal/refs/heads/main/.wordpress-org/blueprints/blueprint.json)

[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/gpl-2.0)
[![WordPress: 6.8+](https://img.shields.io/badge/WordPress-6.8+-green.svg)](https://wordpress.org/)
Expand Down
4 changes: 2 additions & 2 deletions blockparty-modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Blockparty Modal
* Description: Modal block for WordPress editor.
* Version: 1.0.7
* Version: 1.0.8
* Requires at least: 6.8
* Requires PHP: 8.1
* Author: Be API Technical Team
Expand All @@ -19,7 +19,7 @@
exit; // Exit if accessed directly.
}

define( 'BLOCKPARTY_MODAL_VERSION', '1.0.7' );
define( 'BLOCKPARTY_MODAL_VERSION', '1.0.8' );
define( 'BLOCKPARTY_MODAL_URL', plugin_dir_url( __FILE__ ) );
define( 'BLOCKPARTY_MODAL_DIR', plugin_dir_path( __FILE__ ) );

Expand Down
36 changes: 0 additions & 36 deletions blueprint.json

This file was deleted.

20 changes: 11 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
"name": "beapi/blockparty-modal",
"description": "Add a block to display an embedded frame in the WordPress editor.",
"type": "wordpress-plugin",
"keywords": ["wordpress", "plugin", "block", "modal", "dialog", "editor"],
"keywords": [
"wordpress",
"plugin",
"block",
"modal",
"dialog",
"editor"
],
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "BeAPI",
"email": "technical@beapi.fr",
"homepage":"https://beapi.fr",
"role":"Company"
"homepage": "https://beapi.fr",
"role": "Company"
}
],
"config": {
Expand All @@ -32,29 +39,24 @@
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"humanmade/psalm-plugin-wordpress": "3.1.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpro/grumphp-shim": "^1.5",
"roave/security-advisories": "dev-latest",
"roots/wordpress-no-content": "^6.0",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "6.15.1",
"wp-cli/wp-cli": "^2.6",
"wp-coding-standards/wpcs": "^3.0"
},
"autoload-dev": {
},
"autoload-dev": {},
"scripts": {
"cs": "./vendor/bin/phpcs",
"cb": "./vendor/bin/phpcbf",
"psalm": "./vendor/bin/psalm",
"phpunit": "phpunit"
},
"scripts-descriptions": {
"cs": "Run PHP CodeSniffer on codebase using custom ruleset.",
"cb": "Run PHP Code Beautifier and Fixer on codebase using custom ruleset.",
"psalm": "Run psalm on codebase using custom ruleset.",
"phpunit": "Run PHP unit tests."
}
}
Loading
Loading