Skip to content

Commit

Permalink
Merge pull request #161 from t-hamano/wp6.3
Browse files Browse the repository at this point in the history
Version 3.0.0 (Release for WP6.3)
  • Loading branch information
t-hamano authored Jul 28, 2023
2 parents 080c915 + 453fe80 commit ae6da7f
Show file tree
Hide file tree
Showing 45 changed files with 22,918 additions and 25,888 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ module.exports = {
rules: {
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
'import/no-duplicates': [
'error',
{
considerQueryString: true,
'prefer-inline': true,
},
],
'@wordpress/no-unsafe-wp-apis': 'off',
'@typescript-eslint/no-duplicate-imports': 'off',
'jsdoc/require-param-type': 0,
'prettier/prettier': [
'error',
Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/run-test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [
'7.3',
'7.4',
'8.0'
]
wp-versions: [
'WordPress#5.9.5',
'WordPress#6.0.3',
'WordPress#6.1.1',
'WordPress'
]
name: PHP ${{ matrix.php-versions }} / ${{ matrix.wp-versions }} Test
include:
- php: '7.4'
wp: WordPress
- php: '7.4'
wp: WordPress#6.2.2
- php: '7.4'
wp: WordPress#6.1.3
- php: '8.0'
wp: WordPress
- php: '8.0'
wp: WordPress#6.2.2
- php: '8.0'
wp: WordPress#6.1.3
- php: '8.2'
wp: WordPress
- php: '8.2'
wp: WordPress#6.2.2
name: PHP ${{ matrix.php }} / ${{ matrix.wp }} Test

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -51,7 +57,7 @@ jobs:

- name: Install WordPress
run: |
WP_ENV_CORE=WordPress/${{ matrix.wp-versions }} WP_ENV_PHP_VERSION=${{ matrix.php-versions }} npm run wp-env start
WP_ENV_CORE=WordPress/${{ matrix.wp }} WP_ENV_PHP_VERSION=${{ matrix.php }} npm run wp-env start
npm run wp-env run cli wp core version
npm run wp-env run cli wp cli info
Expand Down
39 changes: 26 additions & 13 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [
'7.3',
'7.4',
'8.0'
]
wp-versions: [
'WordPress#5.9.5',
'WordPress#6.0.3',
'WordPress#6.1.1',
'WordPress'
]
name: PHP ${{ matrix.php-versions }} / ${{ matrix.wp-versions }} Test
include:
- php: '7.4'
wp: WordPress
- php: '7.4'
wp: WordPress#6.2.2
- php: '7.4'
wp: WordPress#6.1.3
- php: '8.0'
wp: WordPress
- php: '8.0'
wp: WordPress#6.2.2
- php: '8.0'
wp: WordPress#6.1.3
- php: '8.2'
wp: WordPress
- php: '8.2'
wp: WordPress#6.2.2
name: PHP ${{ matrix.php }} / ${{ matrix.wp }} Test

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -54,10 +60,17 @@ jobs:

- name: Install WordPress
run: |
WP_ENV_CORE=WordPress/${{ matrix.wp-versions }} WP_ENV_PHP_VERSION=${{ matrix.php-versions }} npm run wp-env start
WP_ENV_CORE=WordPress/${{ matrix.wp }} WP_ENV_PHP_VERSION=${{ matrix.php }} npm run wp-env start
npm run wp-env run cli wp core version
npm run wp-env run cli wp cli info
- name: Running e2e tests
run: npm run test:e2e

- name: Archive debug artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: failures-artifacts
path: artifacts
if-no-files-found: ignore
8 changes: 8 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
"config": {
"WP_DEBUG": true,
"SCRIPT_DEBUG": true
},
"env": {
"tests": {
"config": {
"WP_DEBUG": true,
"SCRIPT_DEBUG": true
}
}
}
}
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
[![Tests](https://github.com/t-hamano/flexible-table-block/actions/workflows/run-test.yml/badge.svg)](https://github.com/t-hamano/flexible-table-block/actions/workflows/run-test.yml)
[![Tests and Deploy](https://github.com/t-hamano/flexible-table-block/actions/workflows/run-test-and-deploy.yml/badge.svg)](https://github.com/t-hamano/flexible-table-block/actions/workflows/run-test-and-deploy.yml)

![Flexible Table Block](https://github.com/t-hamano/flexible-table-block/wiki/images/screenshot.png)
![Flexible Table Block](https://raw.githubusercontent.com/t-hamano/flexible-table-block/main/.wordpress-org/banner-1544x500.png)

"Flexible Table Block" is a custom block plugin for the WordPress block editor that allows you to create tables in any configuration.

- [English Manual](https://github.com/t-hamano/flexible-table-block/wiki/English-Manual)
- [日本語マニュアル](https://github.com/t-hamano/flexible-table-block/wiki/%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB)
Flexible Table Block is a custom block plugin for the WordPress block editor that allows you to create tables in any configuration.
27 changes: 20 additions & 7 deletions classes/class-enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,29 @@ class Enqueue {
* Constructor
*/
function __construct() {
// Register block & scripts.
// Register block.
add_action( 'init', array( $this, 'register_block' ) );

// Enqueue front-end inline style.
// Enqueue front-end scripts.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

// Enqueue block-editor inline style.
// Enqueue block-editor scripts.
// TODO: Once the minimum WordPress version supported by the plugin is 6.3 or higher,
// Use enqueue_block_assets instead of enqueue_block_editor_assets.
// See: https://github.com/t-hamano/flexible-table-block/pull/161/commits/c2ce9851eb0812e7a2a3e660555ab553c5c3e8e3
// See: https://github.com/t-hamano/flexible-table-block/pull/161/commits/0019f8c961f04ba95a7447149eb8dab61fbcd0ee
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
}

/**
* Register block & scripts
* Register block
*/
public function register_block() {
register_block_type( FTB_PATH . '/build' );
}

/**
* Enqueue front-end inline style
* Enqueue front-end scripts
*/
public function enqueue_scripts() {
wp_register_style(
Expand All @@ -44,14 +48,14 @@ public function enqueue_scripts() {
$responsive_css = Helper::get_responsive_css();
$block_css = Helper::get_block_css( '.' . FTB_BLOCK_CLASS );
$css = Helper::minify_css( $block_css . $responsive_css );

wp_add_inline_style( 'flexible-table-block', $css );
}

/**
* Enqueue block-editor inline style
* Enqueue block-editor scripts
*/
public function enqueue_block_editor_assets() {

$asset_file = include( FTB_PATH . '/build/index.asset.php' );

wp_register_script(
Expand All @@ -61,6 +65,14 @@ public function enqueue_block_editor_assets() {
filemtime( FTB_PATH . '/build/index.js' ),
);

wp_localize_script(
'flexible-table-block-editor',
'ftbObj',
array(
'useOnFocus' => is_wp_version_compatible( '6.3' ),
)
);

wp_set_script_translations( 'flexible-table-block-editor', FTB_NAMESPACE );

wp_register_style(
Expand All @@ -72,6 +84,7 @@ public function enqueue_block_editor_assets() {

$block_css = Helper::get_block_css( '.editor-styles-wrapper ' );
$css = Helper::minify_css( $block_css );

wp_add_inline_style( 'flexible-table-block-editor', $css );
}
}
Expand Down
12 changes: 6 additions & 6 deletions classes/class-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Helper {
* @return string
*/
public static function get_block_css( $prefix = '' ) {
$selector = "${prefix}." . FTB_BLOCK_CLASS;
$selector = "{$prefix}." . FTB_BLOCK_CLASS;

// CSS selectors.
$styles = array(
Expand All @@ -32,7 +32,7 @@ public static function get_block_css( $prefix = '' ) {

$option = get_option( FTB_OPTION_PREFIX . '_block_style', Settings::OPTIONS['block_style']['default'] );

// Genelate styles based on global setting.
// Genelate styles based on Global setting.
foreach ( $option as $key => $value ) {
if ( '' === $value || null === $value ) {
continue;
Expand Down Expand Up @@ -109,7 +109,7 @@ public static function get_block_css( $prefix = '' ) {
* @return string
*/
public static function get_responsive_css( $prefix = '' ) {
$selector = "${prefix}." . FTB_BLOCK_CLASS;
$selector = "{$prefix}." . FTB_BLOCK_CLASS;
$breakpoint = get_option( FTB_OPTION_PREFIX . '_breakpoint', Settings::OPTIONS['breakpoint']['default'] );
$max_width = $breakpoint;
$min_width = $max_width + 1;
Expand Down Expand Up @@ -212,13 +212,13 @@ public static function get_shorhand_css_value( $top, $right, $bottom, $left ) {
}

if ( $top === $bottom && $left === $right ) {
return "${top} ${left}";
return "{$top} {$left}";
}

if ( $left === $right ) {
return "${top} ${left} ${bottom}";
return "{$top} {$left} {$bottom}";
}

return "${top} ${right} ${bottom} ${left}";
return "{$top} {$right} {$bottom} {$left}";
}
}
2 changes: 1 addition & 1 deletion classes/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Settings {
'type' => 'boolean',
'default' => false,
),
// Show global setting link to non-administrative users.
// Show Global setting button to non-administrative users.
'show_global_setting' => array(
'type' => 'boolean',
'default' => false,
Expand Down
6 changes: 3 additions & 3 deletions flexible-table-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/**
* Plugin Name: Flexible Table Block
* Description: Easily create flexible configuration tables.
* Requires at least: 5.9
* Requires PHP: 7.3
* Version: 2.9.1
* Requires at least: 6.1
* Requires PHP: 7.4
* Version: 3.0.0
* Author: Aki Hamano
* Author URI: https://github.com/t-hamano
* License: GPL2 or later
Expand Down
Loading

0 comments on commit ae6da7f

Please sign in to comment.