Skip to content

Commit ae6da7f

Browse files
authored
Merge pull request #161 from t-hamano/wp6.3
Version 3.0.0 (Release for WP6.3)
2 parents 080c915 + 453fe80 commit ae6da7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+22918
-25888
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ module.exports = {
88
rules: {
99
'import/no-extraneous-dependencies': 'off',
1010
'import/no-unresolved': 'off',
11+
'import/no-duplicates': [
12+
'error',
13+
{
14+
considerQueryString: true,
15+
'prefer-inline': true,
16+
},
17+
],
1118
'@wordpress/no-unsafe-wp-apis': 'off',
19+
'@typescript-eslint/no-duplicate-imports': 'off',
1220
'jsdoc/require-param-type': 0,
1321
'prettier/prettier': [
1422
'error',

.github/workflows/run-test-and-deploy.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,24 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-versions: [
16-
'7.3',
17-
'7.4',
18-
'8.0'
19-
]
20-
wp-versions: [
21-
'WordPress#5.9.5',
22-
'WordPress#6.0.3',
23-
'WordPress#6.1.1',
24-
'WordPress'
25-
]
26-
name: PHP ${{ matrix.php-versions }} / ${{ matrix.wp-versions }} Test
15+
include:
16+
- php: '7.4'
17+
wp: WordPress
18+
- php: '7.4'
19+
wp: WordPress#6.2.2
20+
- php: '7.4'
21+
wp: WordPress#6.1.3
22+
- php: '8.0'
23+
wp: WordPress
24+
- php: '8.0'
25+
wp: WordPress#6.2.2
26+
- php: '8.0'
27+
wp: WordPress#6.1.3
28+
- php: '8.2'
29+
wp: WordPress
30+
- php: '8.2'
31+
wp: WordPress#6.2.2
32+
name: PHP ${{ matrix.php }} / ${{ matrix.wp }} Test
2733

2834
steps:
2935
- uses: actions/checkout@v3
@@ -51,7 +57,7 @@ jobs:
5157

5258
- name: Install WordPress
5359
run: |
54-
WP_ENV_CORE=WordPress/${{ matrix.wp-versions }} WP_ENV_PHP_VERSION=${{ matrix.php-versions }} npm run wp-env start
60+
WP_ENV_CORE=WordPress/${{ matrix.wp }} WP_ENV_PHP_VERSION=${{ matrix.php }} npm run wp-env start
5561
npm run wp-env run cli wp core version
5662
npm run wp-env run cli wp cli info
5763

.github/workflows/run-test.yml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,24 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
php-versions: [
19-
'7.3',
20-
'7.4',
21-
'8.0'
22-
]
23-
wp-versions: [
24-
'WordPress#5.9.5',
25-
'WordPress#6.0.3',
26-
'WordPress#6.1.1',
27-
'WordPress'
28-
]
29-
name: PHP ${{ matrix.php-versions }} / ${{ matrix.wp-versions }} Test
18+
include:
19+
- php: '7.4'
20+
wp: WordPress
21+
- php: '7.4'
22+
wp: WordPress#6.2.2
23+
- php: '7.4'
24+
wp: WordPress#6.1.3
25+
- php: '8.0'
26+
wp: WordPress
27+
- php: '8.0'
28+
wp: WordPress#6.2.2
29+
- php: '8.0'
30+
wp: WordPress#6.1.3
31+
- php: '8.2'
32+
wp: WordPress
33+
- php: '8.2'
34+
wp: WordPress#6.2.2
35+
name: PHP ${{ matrix.php }} / ${{ matrix.wp }} Test
3036

3137
steps:
3238
- uses: actions/checkout@v3
@@ -54,10 +60,17 @@ jobs:
5460

5561
- name: Install WordPress
5662
run: |
57-
WP_ENV_CORE=WordPress/${{ matrix.wp-versions }} WP_ENV_PHP_VERSION=${{ matrix.php-versions }} npm run wp-env start
63+
WP_ENV_CORE=WordPress/${{ matrix.wp }} WP_ENV_PHP_VERSION=${{ matrix.php }} npm run wp-env start
5864
npm run wp-env run cli wp core version
5965
npm run wp-env run cli wp cli info
6066
6167
- name: Running e2e tests
6268
run: npm run test:e2e
6369

70+
- name: Archive debug artifacts
71+
uses: actions/upload-artifact@v3
72+
if: always()
73+
with:
74+
name: failures-artifacts
75+
path: artifacts
76+
if-no-files-found: ignore

.wp-env.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
"config": {
44
"WP_DEBUG": true,
55
"SCRIPT_DEBUG": true
6+
},
7+
"env": {
8+
"tests": {
9+
"config": {
10+
"WP_DEBUG": true,
11+
"SCRIPT_DEBUG": true
12+
}
13+
}
614
}
715
}

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
[![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)
44
[![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)
55

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

8-
"Flexible Table Block" is a custom block plugin for the WordPress block editor that allows you to create tables in any configuration.
9-
10-
- [English Manual](https://github.com/t-hamano/flexible-table-block/wiki/English-Manual)
11-
- [日本語マニュアル](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)
8+
Flexible Table Block is a custom block plugin for the WordPress block editor that allows you to create tables in any configuration.

classes/class-enqueue.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,29 @@ class Enqueue {
1313
* Constructor
1414
*/
1515
function __construct() {
16-
// Register block & scripts.
16+
// Register block.
1717
add_action( 'init', array( $this, 'register_block' ) );
1818

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

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

2630
/**
27-
* Register block & scripts
31+
* Register block
2832
*/
2933
public function register_block() {
3034
register_block_type( FTB_PATH . '/build' );
3135
}
3236

3337
/**
34-
* Enqueue front-end inline style
38+
* Enqueue front-end scripts
3539
*/
3640
public function enqueue_scripts() {
3741
wp_register_style(
@@ -44,14 +48,14 @@ public function enqueue_scripts() {
4448
$responsive_css = Helper::get_responsive_css();
4549
$block_css = Helper::get_block_css( '.' . FTB_BLOCK_CLASS );
4650
$css = Helper::minify_css( $block_css . $responsive_css );
51+
4752
wp_add_inline_style( 'flexible-table-block', $css );
4853
}
4954

5055
/**
51-
* Enqueue block-editor inline style
56+
* Enqueue block-editor scripts
5257
*/
5358
public function enqueue_block_editor_assets() {
54-
5559
$asset_file = include( FTB_PATH . '/build/index.asset.php' );
5660

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

68+
wp_localize_script(
69+
'flexible-table-block-editor',
70+
'ftbObj',
71+
array(
72+
'useOnFocus' => is_wp_version_compatible( '6.3' ),
73+
)
74+
);
75+
6476
wp_set_script_translations( 'flexible-table-block-editor', FTB_NAMESPACE );
6577

6678
wp_register_style(
@@ -72,6 +84,7 @@ public function enqueue_block_editor_assets() {
7284

7385
$block_css = Helper::get_block_css( '.editor-styles-wrapper ' );
7486
$css = Helper::minify_css( $block_css );
87+
7588
wp_add_inline_style( 'flexible-table-block-editor', $css );
7689
}
7790
}

classes/class-helper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Helper {
1515
* @return string
1616
*/
1717
public static function get_block_css( $prefix = '' ) {
18-
$selector = "${prefix}." . FTB_BLOCK_CLASS;
18+
$selector = "{$prefix}." . FTB_BLOCK_CLASS;
1919

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

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

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

214214
if ( $top === $bottom && $left === $right ) {
215-
return "${top} ${left}";
215+
return "{$top} {$left}";
216216
}
217217

218218
if ( $left === $right ) {
219-
return "${top} ${left} ${bottom}";
219+
return "{$top} {$left} {$bottom}";
220220
}
221221

222-
return "${top} ${right} ${bottom} ${left}";
222+
return "{$top} {$right} {$bottom} {$left}";
223223
}
224224
}

classes/class-settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Settings {
4242
'type' => 'boolean',
4343
'default' => false,
4444
),
45-
// Show global setting link to non-administrative users.
45+
// Show Global setting button to non-administrative users.
4646
'show_global_setting' => array(
4747
'type' => 'boolean',
4848
'default' => false,

flexible-table-block.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/**
33
* Plugin Name: Flexible Table Block
44
* Description: Easily create flexible configuration tables.
5-
* Requires at least: 5.9
6-
* Requires PHP: 7.3
7-
* Version: 2.9.1
5+
* Requires at least: 6.1
6+
* Requires PHP: 7.4
7+
* Version: 3.0.0
88
* Author: Aki Hamano
99
* Author URI: https://github.com/t-hamano
1010
* License: GPL2 or later

0 commit comments

Comments
 (0)