Skip to content

Commit 468f285

Browse files
wpgauravclaude
andcommitted
v1.4.7: block-editor font fixes, weight normalization & housekeeping
- Fonts: render custom @font-face inside the block editor canvas via the editor styles channel (WP 6.3+/7.x iframe); when body/heading assignment is enabled, inject .editor-styles-wrapper font-family CSS with a system fallback so the canvas matches the front end - Fonts: normalize out-of-range variable weight axes (1 900 -> 100 900) in build_css() and theme.json so WordPress no longer silently drops the face and its font-picker entry - Components: route editor CSS through block_editor_settings_all, removing the iframe-fragile src-less inline fallback - Remove dead admin_head font print; document a single source-of-truth font-loading matrix in the class header - Drop stale per-file @Version docblocks across feature classes - readme.txt: 1.4.7 changelog + Stable tag bump; README.md version Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 00223a7 commit 468f285

12 files changed

Lines changed: 232 additions & 57 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ yarn-error.log*
2626
/build/
2727
/dist/
2828

29-
# AI assistant guidelines (keep local)
29+
# AI assistant guidelines / working notes (keep local)
3030
CLAUDE.md
31+
IMPROVEMENTS.md
3132

3233
# Local release builds
3334
releases/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All-in-one WordPress optimization toolkit with 15+ modules for performance, security, SEO, and content management. Built with modern WordPress coding standards and a clean module-based dashboard. Optimized for performance with lazy-loading, static property caching, and intelligent transients.
44

5-
**Version:** 1.4.5
5+
**Version:** 1.4.7
66
**License:** GPL-2.0-or-later
77
**Text Domain:** `functionalities`
88
**Pricing:** Free

functionalities.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Dynamic Functionalities
44
* Plugin URI: https://functionalities.dev
55
* Description: All-in-one WordPress optimization toolkit. 15+ modules for performance, security, SEO, and content management.
6-
* Version: 1.4.6
6+
* Version: 1.4.7
77
* Author: Gaurav Tiwari
88
* Author URI: https://gauravtiwari.org
99
* License: GPL-2.0-or-later
@@ -19,7 +19,7 @@
1919

2020
// Define constants.
2121
if (!defined('FUNCTIONALITIES_VERSION')) {
22-
define('FUNCTIONALITIES_VERSION', '1.4.6');
22+
define('FUNCTIONALITIES_VERSION', '1.4.7');
2323
}
2424
if (!defined('FUNCTIONALITIES_FILE')) {
2525
define('FUNCTIONALITIES_FILE', __FILE__);

includes/features/class-assumption-detection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
* @package Functionalities\Features
2020
* @since 0.9.0
21-
* @version 0.9.5
2221
*/
2322

2423
namespace Functionalities\Features;

includes/features/class-block-cleanup.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @package Functionalities
99
* @subpackage Features
1010
* @since 0.2.0
11-
* @version 0.9.2
1211
*/
1312

1413
namespace Functionalities\Features;

includes/features/class-components.php

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @package Functionalities
99
* @subpackage Features
1010
* @since 0.3.0
11-
* @version 0.8.0
1211
*/
1312

1413
namespace Functionalities\Features;
@@ -108,7 +107,10 @@ public static function init() : void {
108107
// Output CSS in footer (both frontend and admin).
109108
\add_action( 'wp_footer', array( __CLASS__, 'print_footer_link' ), 90 );
110109
\add_action( 'admin_footer', array( __CLASS__, 'print_footer_link' ), 90 );
111-
\add_action( 'enqueue_block_assets', array( __CLASS__, 'enqueue_editor_components' ) );
110+
111+
// Serve the block editor canvas (an iframe) via the editor `styles`
112+
// setting — the only channel guaranteed to reach the iframe.
113+
\add_filter( 'block_editor_settings_all', array( __CLASS__, 'add_editor_settings_components' ) );
112114

113115
// Regenerate CSS file when settings are updated.
114116
\add_action( 'update_option_functionalities_components', array( __CLASS__, 'on_option_update' ), 10, 2 );
@@ -156,38 +158,49 @@ protected static function get_options() : array {
156158
}
157159

158160
/**
159-
* Enqueue components CSS in the block editor iframe for WP 7 compatibility.
161+
* Inject component CSS into the block editor's style settings.
160162
*
161-
* @since 1.3.0
162-
* @return void
163+
* The editor canvas is iframed (WP 6.3+/7.x). Feeding CSS through the editor
164+
* `styles` setting — the channel add_editor_style() and the Font Library use —
165+
* is the reliable way into that iframe: WordPress copies it in verbatim and
166+
* scopes the selectors to the content wrapper.
167+
*
168+
* This replaces an enqueue_block_assets path that only reached the iframe when
169+
* a generated CSS file existed; its inline fallback used a src-less style handle
170+
* (wp_register_style( $h, false ) + wp_add_inline_style) that does NOT cross
171+
* into the iframe, so component CSS silently vanished in the editor whenever the
172+
* uploads file could not be written.
173+
*
174+
* @since 1.4.7
175+
*
176+
* @param array $settings Block editor settings (from block_editor_settings_all).
177+
* @return array Modified settings.
163178
*/
164-
public static function enqueue_editor_components() : void {
165-
if ( ! \is_admin() ) {
166-
return;
167-
}
168-
179+
public static function add_editor_settings_components( $settings ) {
169180
$opts = self::get_options();
170181

171182
if ( ! \apply_filters( 'functionalities_components_enabled', ! empty( $opts['enabled'] ) ) ) {
172-
return;
183+
return $settings;
173184
}
174185

175186
if ( empty( $opts['items'] ) || ! is_array( $opts['items'] ) ) {
176-
return;
187+
return $settings;
177188
}
178189

179190
$items = \apply_filters( 'functionalities_components_items', $opts['items'] );
180-
$css = self::build_css( $items );
181-
$file = self::ensure_css_file( $css );
191+
$css = self::sanitize_css( self::build_css( $items ) );
182192

183-
if ( $file && isset( $file['url'], $file['ver'] ) ) {
184-
\wp_enqueue_style( 'functionalities-components', $file['url'], array(), $file['ver'] );
185-
return;
193+
if ( $css === '' ) {
194+
return $settings;
186195
}
187196

188-
\wp_register_style( 'functionalities-components', false, array(), FUNCTIONALITIES_VERSION );
189-
\wp_enqueue_style( 'functionalities-components' );
190-
\wp_add_inline_style( 'functionalities-components', self::sanitize_css( $css ) );
197+
if ( empty( $settings['styles'] ) || ! is_array( $settings['styles'] ) ) {
198+
$settings['styles'] = array();
199+
}
200+
201+
$settings['styles'][] = array( 'css' => $css );
202+
203+
return $settings;
191204
}
192205

193206
/**

includes/features/class-editor-links.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* @package Functionalities
99
* @subpackage Features
1010
* @since 0.2.0
11-
* @version 0.8.0
1211
*/
1312

1413
namespace Functionalities\Features;

0 commit comments

Comments
 (0)