@elementor/editor-variables 4.2.0-882 → 4.2.0-884

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-variables",
3
- "version": "4.2.0-882",
3
+ "version": "4.2.0-884",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,22 +39,22 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.2.0-882",
43
- "@elementor/editor-canvas": "4.2.0-882",
44
- "@elementor/editor-controls": "4.2.0-882",
45
- "@elementor/editor-current-user": "4.2.0-882",
46
- "@elementor/editor-mcp": "4.2.0-882",
47
- "@elementor/editor-panels": "4.2.0-882",
48
- "@elementor/editor-props": "4.2.0-882",
49
- "@elementor/editor-ui": "4.2.0-882",
50
- "@elementor/editor-v1-adapters": "4.2.0-882",
51
- "@elementor/menus": "4.2.0-882",
52
- "@elementor/http-client": "4.2.0-882",
42
+ "@elementor/editor": "4.2.0-884",
43
+ "@elementor/editor-canvas": "4.2.0-884",
44
+ "@elementor/editor-controls": "4.2.0-884",
45
+ "@elementor/editor-current-user": "4.2.0-884",
46
+ "@elementor/editor-mcp": "4.2.0-884",
47
+ "@elementor/editor-panels": "4.2.0-884",
48
+ "@elementor/editor-props": "4.2.0-884",
49
+ "@elementor/editor-ui": "4.2.0-884",
50
+ "@elementor/editor-v1-adapters": "4.2.0-884",
51
+ "@elementor/menus": "4.2.0-884",
52
+ "@elementor/http-client": "4.2.0-884",
53
53
  "@elementor/icons": "~1.75.1",
54
- "@elementor/events": "4.2.0-882",
55
- "@elementor/schema": "4.2.0-882",
54
+ "@elementor/events": "4.2.0-884",
55
+ "@elementor/schema": "4.2.0-884",
56
56
  "@elementor/ui": "1.37.5",
57
- "@elementor/utils": "4.2.0-882",
57
+ "@elementor/utils": "4.2.0-884",
58
58
  "@wordpress/i18n": "^5.13.0"
59
59
  },
60
60
  "peerDependencies": {
@@ -3,6 +3,7 @@ import { z } from '@elementor/schema';
3
3
  import { isProActive } from '@elementor/utils';
4
4
 
5
5
  import { service } from '../service';
6
+ import { getFontConfigs } from '../sync/get-font-configs';
6
7
  import { validateLabel } from '../utils/validations';
7
8
  import { generateVariablesPrompt, MANAGE_VARIABLES_GUIDE_URI } from './variable-tool-prompt';
8
9
  import { GLOBAL_VARIABLES_URI } from './variables-resource';
@@ -30,9 +31,20 @@ function validateValueForType( type: string, value: string ): string | null {
30
31
  return `Size variable value should include a CSS unit (e.g. "16px") or be "auto", got "${ value }".`;
31
32
  }
32
33
 
34
+ if ( type === VARIABLE_TYPES.FONT && ! isFontAvailable( value ) ) {
35
+ return `Font "${ value }" is not supported in WordPress. Please choose one of the available font families.`;
36
+ }
37
+
33
38
  return null;
34
39
  }
35
40
 
41
+ function isFontAvailable( font: string ) {
42
+ const fonts = getFontConfigs();
43
+ const key = font.trim();
44
+
45
+ return !! fonts?.[ key ];
46
+ }
47
+
36
48
  export const initManageVariableTool = ( reg: MCPRegistryEntry ) => {
37
49
  const { addTool, resource } = reg;
38
50
 
@@ -0,0 +1,3 @@
1
+ export const getFontConfigs = () => {
2
+ return window.elementor?.config?.controls?.font?.options ?? {};
3
+ };