diff --git a/.github/workflows/test-wp-next.yml b/.github/workflows/test-wp-next.yml
index 0c7a6a0f66d..aa9389b2a40 100644
--- a/.github/workflows/test-wp-next.yml
+++ b/.github/workflows/test-wp-next.yml
@@ -12,8 +12,8 @@ jobs:
name: Check if WP Next is released
uses: ./.github/workflows/date-checker.yml
with:
- # WP Next scheduled release date. Should be based on `https://make.wordpress.org/core/6-4/` or later.
- scheduled_release_date: "2024-04-02"
+ # WP Next scheduled release date. Should be based on `https://make.wordpress.org/core/7-0/` or later.
+ scheduled_release_date: "2026-04-09"
# Create WP NEXT Version Constant
set_constant:
@@ -22,8 +22,8 @@ jobs:
if: needs.check_if_released.outputs.should_run_workflow == 'true'
runs-on: ubuntu-latest
outputs:
- # Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-6.5-beta2.zip`
- wp_next: "https://wordpress.org/wordpress-6.8-RC2.zip"
+ # Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-7.0.zip`
+ wp_next: "https://wordpress.org/wordpress-7.0.zip"
steps:
- run: echo "Setting WP Next Constant"
@@ -35,7 +35,7 @@ jobs:
uses: ./.github/workflows/test-e2e-cypress.yml
with:
wpVersion: ${{ needs.set_constant.outputs.wp_next }}
- installPath: "tests-wordpress-6.8-RC2"
+ installPath: "tests-wordpress-7.0"
theme: "https://downloads.wordpress.org/theme/go.zip"
# PHP Unit testing
diff --git a/package.json b/package.json
index a1872c0e195..4c7c6bc8991 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"title": "CoBlocks",
"description": "CoBlocks is a suite of professional page building blocks for the WordPress Gutenberg block editor.",
"version": "3.1.17",
- "tested_up_to": "6.8",
+ "tested_up_to": "7.0",
"requires_at_least": "6.3",
"author": "GoDaddy",
"license": "GPL-2.0",
diff --git a/readme.txt b/readme.txt
index c67e6947633..59f2f505724 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Author URI: https://www.godaddy.com
Contributors: godaddy, richtabor, eherman24, jonathanbardo, jrtashjian, paranoia1906, fjarrett, olivierlafleur, jasonlemay, snovosel
Tags: page builder, Gutenberg blocks, WordPress blocks, gutenberg, blocks
Requires at least: 6.3
-Tested up to: 6.8
+Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 3.1.17
License: GPL-2.0
diff --git a/src/blocks/accordion/accordion-item/block.json b/src/blocks/accordion/accordion-item/block.json
index 0b04124f8cb..a4ccf55dfb0 100644
--- a/src/blocks/accordion/accordion-item/block.json
+++ b/src/blocks/accordion/accordion-item/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/accordion-item",
"category": "common",
"attributes": {
diff --git a/src/blocks/accordion/block.json b/src/blocks/accordion/block.json
index ef46fef1b78..a9180f3acd9 100644
--- a/src/blocks/accordion/block.json
+++ b/src/blocks/accordion/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/accordion",
"category": "common",
"attributes": {
diff --git a/src/blocks/alert/block.json b/src/blocks/alert/block.json
index bf000b5df39..18ae4e1ece9 100644
--- a/src/blocks/alert/block.json
+++ b/src/blocks/alert/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/alert",
"attributes": {
diff --git a/src/blocks/author/block.json b/src/blocks/author/block.json
index 9a14daf4116..ccf9c6adfa9 100644
--- a/src/blocks/author/block.json
+++ b/src/blocks/author/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/author",
"attributes": {
diff --git a/src/blocks/buttons/block.json b/src/blocks/buttons/block.json
index 259402f4121..654218aee35 100644
--- a/src/blocks/buttons/block.json
+++ b/src/blocks/buttons/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/buttons",
"category": "layout",
"attributes": {
diff --git a/src/blocks/click-to-tweet/block.json b/src/blocks/click-to-tweet/block.json
index fae31f9bbd0..4676ffb1e35 100644
--- a/src/blocks/click-to-tweet/block.json
+++ b/src/blocks/click-to-tweet/block.json
@@ -1,5 +1,5 @@
{
- "apiVersion": 2,
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/click-to-tweet",
"category": "formatting",
diff --git a/src/blocks/counter/block.json b/src/blocks/counter/block.json
index 73665efabe0..fdad4a981f4 100644
--- a/src/blocks/counter/block.json
+++ b/src/blocks/counter/block.json
@@ -1,5 +1,5 @@
{
- "apiVersion": 2,
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/counter",
"title": "Counter",
diff --git a/src/blocks/dynamic-separator/block.json b/src/blocks/dynamic-separator/block.json
index d945db143eb..2450615cb4c 100644
--- a/src/blocks/dynamic-separator/block.json
+++ b/src/blocks/dynamic-separator/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/dynamic-separator",
"category": "layout",
"attributes": {
diff --git a/src/blocks/events/block.json b/src/blocks/events/block.json
index 26ac850d73b..718dae37787 100644
--- a/src/blocks/events/block.json
+++ b/src/blocks/events/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/events",
"category": "layout",
"attributes": {
diff --git a/src/blocks/events/event-item/block.json b/src/blocks/events/event-item/block.json
index 12502c1bea2..dca45915730 100644
--- a/src/blocks/events/event-item/block.json
+++ b/src/blocks/events/event-item/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/event-item",
"category": "layout",
"attributes": {
diff --git a/src/blocks/faq/block.json b/src/blocks/faq/block.json
index ede600ea3db..05ad6eb1c6f 100644
--- a/src/blocks/faq/block.json
+++ b/src/blocks/faq/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/faq",
"category": "layout",
"attributes": {
diff --git a/src/blocks/faq/faq-item/block.json b/src/blocks/faq/faq-item/block.json
index 76d1613af9a..93aa28c04ff 100644
--- a/src/blocks/faq/faq-item/block.json
+++ b/src/blocks/faq/faq-item/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/faq-item",
"category": "layout",
"attributes": {
diff --git a/src/blocks/features/block.json b/src/blocks/features/block.json
index b31538606c3..915acea1377 100644
--- a/src/blocks/features/block.json
+++ b/src/blocks/features/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/features",
"category": "layout",
"attributes": {
diff --git a/src/blocks/features/feature/block.json b/src/blocks/features/feature/block.json
index ddd6c4cab62..ff96260a4d7 100644
--- a/src/blocks/features/feature/block.json
+++ b/src/blocks/features/feature/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/feature",
"category": "layout",
"attributes": {
diff --git a/src/blocks/food-and-drinks/block.json b/src/blocks/food-and-drinks/block.json
index d822c4dfa56..8cdd458bb43 100644
--- a/src/blocks/food-and-drinks/block.json
+++ b/src/blocks/food-and-drinks/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/food-and-drinks",
"category": "layout",
"attributes": {
diff --git a/src/blocks/food-and-drinks/food-item/block.json b/src/blocks/food-and-drinks/food-item/block.json
index 30ac978d3a6..f77b49ea3b4 100644
--- a/src/blocks/food-and-drinks/food-item/block.json
+++ b/src/blocks/food-and-drinks/food-item/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/food-item",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/block.json b/src/blocks/form/block.json
index d4c17fb0d2f..1b299754051 100644
--- a/src/blocks/form/block.json
+++ b/src/blocks/form/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"attributes": {
"subject": {
"default": null,
diff --git a/src/blocks/form/fields/field-checkbox/block.json b/src/blocks/form/fields/field-checkbox/block.json
index b385f0095b8..02df6b14ce4 100644
--- a/src/blocks/form/fields/field-checkbox/block.json
+++ b/src/blocks/form/fields/field-checkbox/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-checkbox",
"attributes": {
"label": {
diff --git a/src/blocks/form/fields/field-date/block.json b/src/blocks/form/fields/field-date/block.json
index 873b12b808e..ec2d35fa6f6 100644
--- a/src/blocks/form/fields/field-date/block.json
+++ b/src/blocks/form/fields/field-date/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-date",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-email/block.json b/src/blocks/form/fields/field-email/block.json
index 0461ea1516f..16ac45d9c6f 100644
--- a/src/blocks/form/fields/field-email/block.json
+++ b/src/blocks/form/fields/field-email/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-email",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-hidden/block.json b/src/blocks/form/fields/field-hidden/block.json
index 9d580323bba..373a042e2eb 100644
--- a/src/blocks/form/fields/field-hidden/block.json
+++ b/src/blocks/form/fields/field-hidden/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-hidden",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-name/block.json b/src/blocks/form/fields/field-name/block.json
index 0edd119bc44..5802f8b0730 100644
--- a/src/blocks/form/fields/field-name/block.json
+++ b/src/blocks/form/fields/field-name/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-name",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-phone/block.json b/src/blocks/form/fields/field-phone/block.json
index c4fe56ac42b..f101b18d7d1 100644
--- a/src/blocks/form/fields/field-phone/block.json
+++ b/src/blocks/form/fields/field-phone/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-phone",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-radio/block.json b/src/blocks/form/fields/field-radio/block.json
index 406ebee5f29..2546193e391 100644
--- a/src/blocks/form/fields/field-radio/block.json
+++ b/src/blocks/form/fields/field-radio/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-radio",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-select/block.json b/src/blocks/form/fields/field-select/block.json
index 3861b2eb8c3..253c0ea6d7e 100644
--- a/src/blocks/form/fields/field-select/block.json
+++ b/src/blocks/form/fields/field-select/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-select",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-submit-button/block.json b/src/blocks/form/fields/field-submit-button/block.json
index db13b7058f4..e072e4861b2 100644
--- a/src/blocks/form/fields/field-submit-button/block.json
+++ b/src/blocks/form/fields/field-submit-button/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-submit-button",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-text/block.json b/src/blocks/form/fields/field-text/block.json
index 73b10946502..2c36e709d3d 100644
--- a/src/blocks/form/fields/field-text/block.json
+++ b/src/blocks/form/fields/field-text/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-text",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-textarea/block.json b/src/blocks/form/fields/field-textarea/block.json
index 02665c0fce3..f1b36bbf62d 100644
--- a/src/blocks/form/fields/field-textarea/block.json
+++ b/src/blocks/form/fields/field-textarea/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-textarea",
"category": "layout",
"attributes": {
diff --git a/src/blocks/form/fields/field-website/block.json b/src/blocks/form/fields/field-website/block.json
index d8922ba98e7..cd193fe5a8b 100644
--- a/src/blocks/form/fields/field-website/block.json
+++ b/src/blocks/form/fields/field-website/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/field-website",
"category": "layout",
"attributes": {
diff --git a/src/blocks/gallery-carousel/block.json b/src/blocks/gallery-carousel/block.json
index 7fa4c03a01c..9cfd818c608 100644
--- a/src/blocks/gallery-carousel/block.json
+++ b/src/blocks/gallery-carousel/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/gallery-carousel",
"category": "media",
diff --git a/src/blocks/gallery-collage/block.json b/src/blocks/gallery-collage/block.json
index a981b3d25ff..39080165eaa 100644
--- a/src/blocks/gallery-collage/block.json
+++ b/src/blocks/gallery-collage/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/gallery-collage",
"category": "media",
"attributes": {
diff --git a/src/blocks/gallery-collage/test/__snapshots__/save.spec.js.snap b/src/blocks/gallery-collage/test/__snapshots__/save.spec.js.snap
index ca60869f165..76bc9e4f831 100644
--- a/src/blocks/gallery-collage/test/__snapshots__/save.spec.js.snap
+++ b/src/blocks/gallery-collage/test/__snapshots__/save.spec.js.snap
@@ -2,114 +2,114 @@
exports[`coblocks/gallery-collage should have attachment link when linkTo is set to "attachment" 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-caption-style-dark' with captionStyle set to 'dark'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-caption-style-light' with captionStyle set to 'light'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-filter-dim' with filter set to 'dim'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-filter-grayscale' with filter set to 'grayscale'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-filter-saturation' with filter set to 'saturation'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-filter-sepia' with filter set to 'sepia'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-filter-vintage' with filter set to 'vintage'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-large-gutter' with gutter set to 'large'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-lightbox' with lightbox enabled. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-medium-gutter' with gutter set to 'medium'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'has-small-gutter' with gutter set to 'small'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'is-style-layered'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have className 'is-style-tiled'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have custom link when linkTo is set to "custom" 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have figcaption element with captions enabled and caption text. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should have media link when linkTo is set to "media" 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should not render image if URL is not defined 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-collage should render with images 1`] = `
"
-
+
"
`;
diff --git a/src/blocks/gallery-masonry/block.json b/src/blocks/gallery-masonry/block.json
index 53f5027978b..d2b153bdf2f 100644
--- a/src/blocks/gallery-masonry/block.json
+++ b/src/blocks/gallery-masonry/block.json
@@ -1,5 +1,5 @@
{
- "apiVersion": 2,
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/gallery-masonry",
"title": "Masonry Gallery",
diff --git a/src/blocks/gallery-offset/block.json b/src/blocks/gallery-offset/block.json
index 7105dc3f879..73ca562f819 100644
--- a/src/blocks/gallery-offset/block.json
+++ b/src/blocks/gallery-offset/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/gallery-offset",
"category": "media",
"attributes": {
diff --git a/src/blocks/gallery-offset/test/__snapshots__/save.spec.js.snap b/src/blocks/gallery-offset/test/__snapshots__/save.spec.js.snap
index dfbef673129..13e6a24201b 100644
--- a/src/blocks/gallery-offset/test/__snapshots__/save.spec.js.snap
+++ b/src/blocks/gallery-offset/test/__snapshots__/save.spec.js.snap
@@ -2,120 +2,120 @@
exports[`coblocks/gallery-offset should have attachment link when linkTo is set to "attachment" 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-border-radius-10' with radius set to 10. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-caption-style-dark' with captionStyle set to 'dark'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-caption-style-light' with captionStyle set to 'light'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-filter-dim' with filter set to 'dim'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-filter-grayscale' with filter set to 'grayscale'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-filter-saturation' with filter set to 'saturation'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-filter-sepia' with filter set to 'sepia'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-filter-vintage' with filter set to 'vintage'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-large-gutter' with gutter set to 'large'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-lightbox' with lightbox enabled. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-medium-gutter' with gutter set to 'medium'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-medium-images' with gridSize set to 'medium'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-small-gutter' with gutter set to 'small'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-small-images' with gridSize set to 'small'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have className 'has-xlarge-gutter' with gutter set to 'xlarge'. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have custom link when linkTo is set to "custom" 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have figcaption element with captions enabled and caption text. 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should have media link when linkTo is set to "media" 1`] = `
"
-
+
"
`;
exports[`coblocks/gallery-offset should render with images 1`] = `
"
-
+
"
`;
diff --git a/src/blocks/gallery-stacked/block.json b/src/blocks/gallery-stacked/block.json
index 9888d0d6f0d..99dd17483cb 100644
--- a/src/blocks/gallery-stacked/block.json
+++ b/src/blocks/gallery-stacked/block.json
@@ -1,5 +1,5 @@
{
- "apiVersion": 2,
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/gallery-stacked",
"category": "media",
diff --git a/src/blocks/gif/block.json b/src/blocks/gif/block.json
index 79b3a0ecbb3..6db44071753 100644
--- a/src/blocks/gif/block.json
+++ b/src/blocks/gif/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/gif",
"category": "media",
"attributes": {
diff --git a/src/blocks/gist/block.json b/src/blocks/gist/block.json
index 7c1011780d8..a7615441b8a 100644
--- a/src/blocks/gist/block.json
+++ b/src/blocks/gist/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/gist",
"category": "embed",
"attributes": {
diff --git a/src/blocks/hero/block.json b/src/blocks/hero/block.json
index d501a5e6cad..fb14930f5fb 100644
--- a/src/blocks/hero/block.json
+++ b/src/blocks/hero/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/hero",
"category": "layout",
"attributes": {
diff --git a/src/blocks/hero/edit.js b/src/blocks/hero/edit.js
index 10a332568a5..fbd423279d5 100644
--- a/src/blocks/hero/edit.js
+++ b/src/blocks/hero/edit.js
@@ -20,7 +20,7 @@ import { InnerBlocks } from '@wordpress/block-editor';
import { isBlobURL } from '@wordpress/blob';
import { ResizableBox, Spinner } from '@wordpress/components';
import { useDispatch, withDispatch, withSelect } from '@wordpress/data';
-import { useEffect, useState } from '@wordpress/element';
+import { useEffect, useRef, useState } from '@wordpress/element';
/**
* Allowed blocks and template constant is passed to InnerBlocks precisely as specified here.
@@ -116,33 +116,34 @@ const Edit = ( props ) => {
const [ resizingInner ] = useState( false );
const [ resizing, setResizing ] = useState( false );
const [ innerWidth, setInnerWidth ] = useState( null );
+ const blockRef = useRef( null );
const { __unstableMarkAutomaticChange } = useDispatch( 'core/block-editor' );
+ // ponytail: useRef + iframe-resilient DOM access (WP 7.0 always iframes the editor).
+ const queryContent = () =>
+ blockRef.current?.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ];
+
useEffect( () => {
- const currentBlock = document.getElementById( 'block-' + clientId );
- if ( currentBlock ) {
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.width = 'auto';
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.maxWidth = attributes.maxWidth + 'px';
+ const content = queryContent();
+ if ( content ) {
+ content.style.width = 'auto';
+ content.style.maxWidth = attributes.maxWidth + 'px';
}
- const win = document.defaultView;
-
getBrowserWidth();
- win.addEventListener( 'resize', getBrowserWidth );
+ window.addEventListener( 'resize', getBrowserWidth );
__unstableMarkAutomaticChange();
return () => {
- win.removeEventListener( 'resize', getBrowserWidth );
+ window.removeEventListener( 'resize', getBrowserWidth );
};
}, [] );
const getBrowserWidth = () => {
- const win = document.defaultView;
-
- setInnerWidth( win.innerWidth );
- return win.innerWidth;
+ setInnerWidth( window.innerWidth );
+ return window.innerWidth;
};
const saveMeta = ( type ) => {
@@ -268,6 +269,7 @@ const Edit = ( props ) => {
) }
{ fullscreen
?
@@ -287,18 +289,22 @@ const Edit = ( props ) => {
minWidth="400"
onResizeStart={ () => {
setResizing( true );
- const currentBlock = document.getElementById( 'block-' + clientId );
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.maxWidth = '';
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.width = maxWidth + 'px';
+ const content = queryContent();
+ if ( content ) {
+ content.style.maxWidth = '';
+ content.style.width = maxWidth + 'px';
+ }
} }
onResizeStop={ ( _event, _direction, _elt, delta ) => {
setAttributes( {
maxWidth: parseInt( maxWidth + delta.width, 10 ),
} );
setResizing( false );
- const currentBlock = document.getElementById( 'block-' + clientId );
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.width = 'auto';
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.maxWidth = parseInt( maxWidth + delta.width, 10 ) + 'px';
+ const content = queryContent();
+ if ( content ) {
+ content.style.width = 'auto';
+ content.style.maxWidth = parseInt( maxWidth + delta.width, 10 ) + 'px';
+ }
} }
showHandle={ isSelected }
size={ { width: maxWidth } }
@@ -374,18 +380,22 @@ const Edit = ( props ) => {
minWidth="400"
onResizeStart={ () => {
setResizing( true );
- const currentBlock = document.getElementById( 'block-' + clientId );
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.maxWidth = '';
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.width = maxWidth + 'px';
+ const content = queryContent();
+ if ( content ) {
+ content.style.maxWidth = '';
+ content.style.width = maxWidth + 'px';
+ }
} }
onResizeStop={ ( _event, _direction, _elt, delta ) => {
setAttributes( {
maxWidth: parseInt( maxWidth + delta.width, 10 ),
} );
setResizing( false );
- const currentBlock = document.getElementById( 'block-' + clientId );
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.width = 'auto';
- currentBlock.getElementsByClassName( 'wp-block-coblocks-hero__content' )[ 0 ].style.maxWidth = parseInt( maxWidth + delta.width, 10 ) + 'px';
+ const content = queryContent();
+ if ( content ) {
+ content.style.width = 'auto';
+ content.style.maxWidth = parseInt( maxWidth + delta.width, 10 ) + 'px';
+ }
} }
showHandle={ isSelected }
size={ { width: maxWidth } }
diff --git a/src/blocks/highlight/block.json b/src/blocks/highlight/block.json
index 3c692825aef..1ff0c50e3ce 100644
--- a/src/blocks/highlight/block.json
+++ b/src/blocks/highlight/block.json
@@ -1,5 +1,5 @@
{
- "apiVersion": 2,
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/highlight",
"category": "formatting",
diff --git a/src/blocks/icon/block.json b/src/blocks/icon/block.json
index 5d0634651d3..6315ca2d0e0 100644
--- a/src/blocks/icon/block.json
+++ b/src/blocks/icon/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/icon",
"category": "design",
"attributes": {
diff --git a/src/blocks/icon/inspector.js b/src/blocks/icon/inspector.js
index 9b3deff0fc2..bc40a216b5e 100644
--- a/src/blocks/icon/inspector.js
+++ b/src/blocks/icon/inspector.js
@@ -178,6 +178,7 @@ const Inspector = ( props ) => {
isSecondary
isSmall
onClick={ () => {
+ // ponytail: same-document DOM lookup. Safe in WP 7.0 editor iframe.
document.getElementById( 'block-' + clientId ).getElementsByClassName( 'wp-block-coblocks-icon__inner' )[ 0 ].style.height = 'auto';
onChangeSize( 'medium', DEFAULT_ICON_SIZE );
} }
@@ -190,6 +191,7 @@ const Inspector = ( props ) => {
max={ MAX_ICON_SIZE }
min={ padding ? MIN_ICON_SIZE + 28 : MIN_ICON_SIZE }
onChange={ ( nextWidth ) => {
+ // ponytail: same-document DOM lookup. Safe in WP 7.0 editor iframe.
document.getElementById( 'block-' + clientId ).getElementsByClassName( 'wp-block-coblocks-icon__inner' )[ 0 ].style.height = 'auto';
setAttributes( {
height: nextWidth,
diff --git a/src/blocks/logos/block.json b/src/blocks/logos/block.json
index 88fecb78b13..b7a46b87bfe 100644
--- a/src/blocks/logos/block.json
+++ b/src/blocks/logos/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/logos",
"category": "layout",
"attributes": {
diff --git a/src/blocks/map/block.json b/src/blocks/map/block.json
index e5de12141c4..ea56a87e1e1 100644
--- a/src/blocks/map/block.json
+++ b/src/blocks/map/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/map",
"category": "layout",
"attributes": {
diff --git a/src/blocks/media-card/block.json b/src/blocks/media-card/block.json
index cc23ef47170..458a38f73aa 100644
--- a/src/blocks/media-card/block.json
+++ b/src/blocks/media-card/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/media-card",
"category": "layout",
"attributes": {
diff --git a/src/blocks/opentable/block.json b/src/blocks/opentable/block.json
index 0bc04e9525f..14f36eff919 100644
--- a/src/blocks/opentable/block.json
+++ b/src/blocks/opentable/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/opentable",
"category": "layout",
"attributes": {
diff --git a/src/blocks/post-carousel/block.json b/src/blocks/post-carousel/block.json
index a8248e4bf7e..8ffe6a55213 100644
--- a/src/blocks/post-carousel/block.json
+++ b/src/blocks/post-carousel/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/post-carousel",
"category": "layout",
"attributes": {
diff --git a/src/blocks/post-carousel/edit.js b/src/blocks/post-carousel/edit.js
index 4be1f7ccc87..eb2799f9bbd 100755
--- a/src/blocks/post-carousel/edit.js
+++ b/src/blocks/post-carousel/edit.js
@@ -105,7 +105,8 @@ const PostCarousel = ( props ) => {
useEffect( () => {
if ( postFeedType === 'external' ) {
setTimeout( () => {
- const postCarouselContainer = document.querySelector( `.wp-block-coblocks-post-carousel-external-container-${ carouselUuid }` );
+ // ponytail: same-document DOM lookup. Container rendered in iframe editor, scoped by unique uuid class.
+ const postCarouselContainer = document.querySelector( `.wp-block-coblocks-post-carousel-external-container-${ carouselUuid }` );
// remove the swiper classes so that the external feed does not display within carousel in editor
const swiperWrapper = postCarouselContainer.querySelector( '.swiper-wrapper' );
diff --git a/src/blocks/post-carousel/post-item.js b/src/blocks/post-carousel/post-item.js
index aeca2fe43c8..1dab3d06650 100644
--- a/src/blocks/post-carousel/post-item.js
+++ b/src/blocks/post-carousel/post-item.js
@@ -40,6 +40,7 @@ const PostItem = ( {
if ( post.excerpt.raw === '' ) {
excerpt = post.content.raw;
}
+ // ponytail: offscreen element, document scope is irrelevant to parsing, works in iframe.
const excerptElement = document.createElement( 'div' );
excerptElement.innerHTML = excerpt;
diff --git a/src/blocks/posts/block.json b/src/blocks/posts/block.json
index a1c51830e4b..89516f8341c 100644
--- a/src/blocks/posts/block.json
+++ b/src/blocks/posts/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/posts",
"category": "layout",
"attributes": {
diff --git a/src/blocks/posts/edit.js b/src/blocks/posts/edit.js
index abf08c9691e..91e9e0d8c22 100755
--- a/src/blocks/posts/edit.js
+++ b/src/blocks/posts/edit.js
@@ -396,6 +396,7 @@ const PostsEdit = ( props ) => {
if ( post.excerpt.raw === '' ) {
excerpt = post.content.raw;
}
+ // ponytail: offscreen element, document scope is irrelevant to parsing, works in iframe.
const excerptElement = document.createElement( 'div' );
excerptElement.innerHTML = excerpt;
excerpt = excerptElement.textContent || excerptElement.innerText || '';
diff --git a/src/blocks/pricing-table/block.json b/src/blocks/pricing-table/block.json
index d1e2ec782a4..fc463fe7996 100644
--- a/src/blocks/pricing-table/block.json
+++ b/src/blocks/pricing-table/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/pricing-table",
"category": "layout",
"attributes": {
diff --git a/src/blocks/pricing-table/pricing-table-item/block.json b/src/blocks/pricing-table/pricing-table-item/block.json
index 09d0d9ef56b..742c549728f 100644
--- a/src/blocks/pricing-table/pricing-table-item/block.json
+++ b/src/blocks/pricing-table/pricing-table-item/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/pricing-table-item",
"category": "layout",
"attributes": {
diff --git a/src/blocks/row/block.json b/src/blocks/row/block.json
index 602d00e2524..0633e25520b 100644
--- a/src/blocks/row/block.json
+++ b/src/blocks/row/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/row",
"category": "layout",
"attributes": {
diff --git a/src/blocks/row/column/block.json b/src/blocks/row/column/block.json
index a45f9d7a7f0..19c55895f7d 100644
--- a/src/blocks/row/column/block.json
+++ b/src/blocks/row/column/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/column",
"category": "layout",
"attributes": {
diff --git a/src/blocks/row/column/edit.js b/src/blocks/row/column/edit.js
index 9035a7e478b..a14e3e55e5b 100644
--- a/src/blocks/row/column/edit.js
+++ b/src/blocks/row/column/edit.js
@@ -206,6 +206,7 @@ const Edit = ( props ) => {
topLeft: false,
} }
onResizeStop={ () => {
+ // ponytail: same-document DOM lookup. Safe in WP 7.0 editor iframe.
const currentBlock = document.getElementById(
'block-' + clientId
);
@@ -247,6 +248,7 @@ const Edit = ( props ) => {
} );
}
} }
+ // ponytail: same-document DOM lookup. Safe in WP 7.0 editor iframe.
onResizeStart={ () => {
const currentBlock = document.getElementById(
'block-' + clientId
diff --git a/src/blocks/services/block.json b/src/blocks/services/block.json
index f1520d0a0ae..60f040e1a87 100644
--- a/src/blocks/services/block.json
+++ b/src/blocks/services/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/services",
"category": "layout",
"attributes": {
diff --git a/src/blocks/services/service/block.json b/src/blocks/services/service/block.json
index d53b31fd4b0..072b9743c67 100644
--- a/src/blocks/services/service/block.json
+++ b/src/blocks/services/service/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/service",
"category": "layout",
"attributes": {
diff --git a/src/blocks/shape-divider/block.json b/src/blocks/shape-divider/block.json
index 10bd6e29611..1d5e9c4e411 100644
--- a/src/blocks/shape-divider/block.json
+++ b/src/blocks/shape-divider/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/shape-divider",
"category": "layout",
"attributes": {
diff --git a/src/blocks/share/block.json b/src/blocks/share/block.json
index 07906eac42c..70cc428df3a 100644
--- a/src/blocks/share/block.json
+++ b/src/blocks/share/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/social",
"category": "widgets",
"attributes": {
diff --git a/src/blocks/social-profiles/block.json b/src/blocks/social-profiles/block.json
index 9788656f89f..4d3997777b7 100644
--- a/src/blocks/social-profiles/block.json
+++ b/src/blocks/social-profiles/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"name": "coblocks/social-profiles",
"category": "widgets",
"attributes": {
diff --git a/src/blocks/testimonials/block.json b/src/blocks/testimonials/block.json
index 0da1e523d2f..f66f51b57a9 100644
--- a/src/blocks/testimonials/block.json
+++ b/src/blocks/testimonials/block.json
@@ -1,4 +1,5 @@
{
+ "apiVersion": 3,
"$schema": "https://schemas.wp.org/trunk/block.json",
"name": "coblocks/testimonials",
"title": "Testimonials",
diff --git a/src/blocks/testimonials/testimonial/block.json b/src/blocks/testimonials/testimonial/block.json
index 5f5207f2ae3..cd4f7b12b7f 100644
--- a/src/blocks/testimonials/testimonial/block.json
+++ b/src/blocks/testimonials/testimonial/block.json
@@ -1,6 +1,6 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
- "apiVersion": 2,
+ "apiVersion": 3,
"name": "coblocks/testimonial",
"parent": [ "coblocks/testimonials" ],
"title": "Testimonial",
diff --git a/src/blocks/testimonials/testimonial/inspector.js b/src/blocks/testimonials/testimonial/inspector.js
index e9475d3e06a..6f39f87c76c 100644
--- a/src/blocks/testimonials/testimonial/inspector.js
+++ b/src/blocks/testimonials/testimonial/inspector.js
@@ -76,6 +76,7 @@ const Inspector = ( props ) => {
isSecondary
isSmall
onClick={ () => {
+ // ponytail: same-document DOM lookup. Safe in WP 7.0 editor iframe.
document.getElementById( 'block-' + clientId ).getElementsByClassName( 'wp-block-coblocks-testimonial__image' )[ 0 ].style.height = 'auto';
onChangeSize( 'medium', DEFAULT_IMAGE_SIZE );
} }
@@ -87,6 +88,7 @@ const Inspector = ( props ) => {
label={ __( 'Size', 'coblocks' ) }
max={ MAX_IMAGE_SIZE }
min={ MIN_IMAGE_SIZE }
+ // ponytail: same-document DOM lookup. Safe in WP 7.0 editor iframe.
onChange={ ( nextWidth ) => {
document.getElementById( 'block-' + clientId ).getElementsByClassName( 'wp-block-coblocks-testimonial__image' )[ 0 ].style.height = 'auto';
setAttributes( {