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
6 changes: 3 additions & 3 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"pluginData": {
"resource": "git:directory",
"url": "https://github.com/BeAPI/blockparty-modal",
"ref": "main",
"refType": "branch"
"ref": "1.0.7",
"refType": "tag"
},
"options": {
"activate": true,
Expand All @@ -30,7 +30,7 @@
},
{
"step": "runPHP",
"code": "<?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_name' => 'blockparty-modal-demo', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page' ) ); echo 'Page created with ID: ' . $page_id; ?>"
"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; ?>"
}
]
}
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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.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
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