From af1b0dd2eeeb4df25c2bf0afd4c46960b0fe54da Mon Sep 17 00:00:00 2001 From: Genyus Date: Sun, 10 May 2026 22:55:52 -0400 Subject: [PATCH 1/2] chore: replace ternary operator - Change to use nullish operator for consistency --- config/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.php b/config/application.php index f035327cd..7ce2ee84b 100644 --- a/config/application.php +++ b/config/application.php @@ -112,7 +112,7 @@ * Custom Settings */ Config::define( 'AUTOMATIC_UPDATER_DISABLED', true ); -Config::define( 'DISABLE_WP_CRON', env( 'DISABLE_WP_CRON' ) ?: false ); +Config::define( 'DISABLE_WP_CRON', env( 'DISABLE_WP_CRON' ) ?? false ); // Disable the plugin and theme file editor in the admin Config::define( 'DISALLOW_FILE_EDIT', true ); From adcd42d53aa1434da7a86632c1f002a6d97c3416 Mon Sep 17 00:00:00 2001 From: Genyus Date: Sun, 10 May 2026 23:30:37 -0400 Subject: [PATCH 2/2] feat: implement code styling - Add code block highlighting plugin - Improve styling for code blocks in both light and dark mode - Add figure as wrapper element option in group block, for better semantics - Implement styling for code annotation lists --- composer.json | 1 + composer.lock | 33 +++- .../assets/js/admin/group-block-figure.js | 155 ++++++++++++++++++ .../assets/js/frontend/cbf-multisite.js | 47 ++---- .../cbf-multisite/includes/Admin/Assets.php | 23 +++ .../themes/cbf-academy/assets/css/custom.css | 54 ++++++ 6 files changed, 281 insertions(+), 32 deletions(-) create mode 100644 web/app/plugins/cbf-multisite/assets/js/admin/group-block-figure.js diff --git a/composer.json b/composer.json index 922194588..ef1e2f00f 100644 --- a/composer.json +++ b/composer.json @@ -94,6 +94,7 @@ "wp-plugin/query-monitor": "^3.20.2", "wp-plugin/redis-cache": "^2.7", "wp-plugin/remove-dashboard-access-for-non-admins": "^1.2.1", + "wp-plugin/webberzone-code-block-highlighting": "^1.0", "wp-plugin/woocommerce": "^10.5.0", "wp-plugin/woocommerce-gateway-stripe": "^10.3.1", "wp-plugin/woocommerce-paypal-payments": "^3.3.2", diff --git a/composer.lock b/composer.lock index 36b280578..5bbb7bc62 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0138df2bd02f57736c2b5ad2843a6222", + "content-hash": "6bfdbd6fb48c5b8769c6a91bbfa258d9", "packages": [ { "name": "aws/aws-crt-php", @@ -6957,6 +6957,37 @@ }, "time": "2026-03-23T19:23:21+00:00" }, + { + "name": "wp-plugin/webberzone-code-block-highlighting", + "version": "1.0.0", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/webberzone-code-block-highlighting/", + "reference": "tags/1.0.0" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/webberzone-code-block-highlighting.1.0.0.zip" + }, + "require": { + "composer/installers": "~1.0|~2.0" + }, + "type": "wordpress-plugin", + "notification-url": "https://wp-packages.org/downloads", + "authors": [ + { + "name": "Ajay" + } + ], + "description": "Add beautiful syntax highlighting to the Gutenberg Code block — powered by Prism.js with 21 themes and 40 languages, zero configuration required.", + "homepage": "https://webberzone.com/webberzone-code-block-highlighting-page/", + "support": { + "changelog": "https://wordpress.org/plugins/webberzone-code-block-highlighting/#developers", + "issues": "https://wordpress.org/support/plugin/webberzone-code-block-highlighting", + "source": "https://plugins.svn.wordpress.org/webberzone-code-block-highlighting" + }, + "time": "2026-05-03T12:32:00+00:00" + }, { "name": "wp-plugin/woocommerce", "version": "10.7.0", diff --git a/web/app/plugins/cbf-multisite/assets/js/admin/group-block-figure.js b/web/app/plugins/cbf-multisite/assets/js/admin/group-block-figure.js new file mode 100644 index 000000000..06e9196af --- /dev/null +++ b/web/app/plugins/cbf-multisite/assets/js/admin/group-block-figure.js @@ -0,0 +1,155 @@ +/* global window */ +/* eslint-disable prettier/prettier */ +(function (wp) { + "use strict"; + + console.log("group-block-figure.js loaded"); + + if (!wp || !wp.hooks || !wp.blocks) { + return; + } + + console.log("wp.hooks", wp.hooks); + + // --- Part 1: extend tagName attribute enum for serialisation/validation --- + // NOTE: the Group block's HTML element dropdown is hardcoded in its edit + // component and does NOT read from tagName.enum, so this alone won't change + // the dropdown UI — Part 2 handles that via editor.BlockEdit. + wp.hooks.addFilter( + "blocks.registerBlockType", + "cbf-multisite/group-block-figure", + function (settings, name) { + if (name !== "core/group") { + return settings; + } + + var attributes = + settings && settings.attributes ? settings.attributes : {}; + var tagName = attributes.tagName; + var existingEnum = + tagName && Array.isArray(tagName.enum) ? tagName.enum : []; + var fallbackEnum = [ + "div", + "section", + "main", + "article", + "aside", + "header", + "footer", + ]; + var baseEnum = existingEnum.length ? existingEnum : fallbackEnum; + + console.log("tagName", tagName); + console.log("existingEnum", existingEnum); + console.log("baseEnum", baseEnum); + console.log("settings", settings); + + if (baseEnum.indexOf("figure") !== -1) { + return settings; + } + + var extendedSettings = Object.assign({}, settings, { + attributes: Object.assign({}, attributes, { + tagName: Object.assign( + { type: "string", default: "div", enum: fallbackEnum }, + tagName || {}, + { enum: baseEnum.concat("figure") } + // eslint-disable-next-line + ), + }), + }); + + console.log("extendedTagName", extendedSettings.attributes.tagName); + + return extendedSettings; + } + // eslint-disable-next-line + ); + + // --- Part 2: inject
into the editor UI via editor.BlockEdit HOC --- + // The Group block's HTML element SelectControl is hardcoded — it doesn't read + // from tagName.enum. We add our own SelectControl with the full list plus + //
. The original is hidden via CSS targeting the .cbf-html-element-control + // class added here as an adjacent-sibling marker (see Admin/Assets.php). + if (!wp.element || !wp.compose || !wp.blockEditor || !wp.components) { + console.log("group-block-figure: missing deps for BlockEdit HOC", { + element: !!wp.element, + compose: !!wp.compose, + blockEditor: !!wp.blockEditor, + components: !!wp.components, + }); + return; + } + + var HTML_ELEMENT_DESCRIPTIONS = { + div: "The
element should only be used if the block is a design element with no semantic meaning.", + header: + "The
element should represent introductory content, typically a group of introductory or navigational aids.", + main: "The
element should be used for the primary content of your document only.", + section: + "The
element should represent a standalone portion of the document that can't be better represented by another element.", + article: + "The
element should represent a self-contained, syndicatable portion of the document.", + aside: + "The