@elementor/editor-canvas 4.4.0-1145 → 4.4.0-1146
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/dist/index.js
CHANGED
|
@@ -2330,7 +2330,6 @@ var svgSrcTransformer = createTransformer(async (value, { signal }) => {
|
|
|
2330
2330
|
var EMPTY_ICON_RESULT = { html: null, url: null };
|
|
2331
2331
|
var ICON_SVG_SIZE = "100%";
|
|
2332
2332
|
var ICON_SVG_OVERFLOW = "visible";
|
|
2333
|
-
var FONT_AWESOME_LIBRARY_PREFIX = "fa-";
|
|
2334
2333
|
var EICONS_LIBRARY = "eicons";
|
|
2335
2334
|
var DEFAULT_SVG_RELATIVE_PATH = "images/default-svg.svg";
|
|
2336
2335
|
var iconTransformer = createTransformer(async (value, { signal }) => {
|
|
@@ -2343,7 +2342,7 @@ var iconTransformer = createTransformer(async (value, { signal }) => {
|
|
|
2343
2342
|
if (fontAwesomeHtml) {
|
|
2344
2343
|
return { html: fontAwesomeHtml, url: null };
|
|
2345
2344
|
}
|
|
2346
|
-
if (
|
|
2345
|
+
if (EICONS_LIBRARY === library) {
|
|
2347
2346
|
return EMPTY_ICON_RESULT;
|
|
2348
2347
|
}
|
|
2349
2348
|
const providerHtml = await resolveProviderSvg(library, iconValue, signal);
|
package/dist/index.mjs
CHANGED
|
@@ -2286,7 +2286,6 @@ var svgSrcTransformer = createTransformer(async (value, { signal }) => {
|
|
|
2286
2286
|
var EMPTY_ICON_RESULT = { html: null, url: null };
|
|
2287
2287
|
var ICON_SVG_SIZE = "100%";
|
|
2288
2288
|
var ICON_SVG_OVERFLOW = "visible";
|
|
2289
|
-
var FONT_AWESOME_LIBRARY_PREFIX = "fa-";
|
|
2290
2289
|
var EICONS_LIBRARY = "eicons";
|
|
2291
2290
|
var DEFAULT_SVG_RELATIVE_PATH = "images/default-svg.svg";
|
|
2292
2291
|
var iconTransformer = createTransformer(async (value, { signal }) => {
|
|
@@ -2299,7 +2298,7 @@ var iconTransformer = createTransformer(async (value, { signal }) => {
|
|
|
2299
2298
|
if (fontAwesomeHtml) {
|
|
2300
2299
|
return { html: fontAwesomeHtml, url: null };
|
|
2301
2300
|
}
|
|
2302
|
-
if (
|
|
2301
|
+
if (EICONS_LIBRARY === library) {
|
|
2303
2302
|
return EMPTY_ICON_RESULT;
|
|
2304
2303
|
}
|
|
2305
2304
|
const providerHtml = await resolveProviderSvg(library, iconValue, signal);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "4.4.0-
|
|
4
|
+
"version": "4.4.0-1146",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.4.0-
|
|
41
|
-
"@elementor/editor-controls": "4.4.0-
|
|
42
|
-
"@elementor/editor-documents": "4.4.0-
|
|
43
|
-
"@elementor/editor-elements": "4.4.0-
|
|
44
|
-
"@elementor/editor-interactions": "4.4.0-
|
|
45
|
-
"@elementor/editor-mcp": "4.4.0-
|
|
46
|
-
"@elementor/editor-notifications": "4.4.0-
|
|
47
|
-
"@elementor/editor-props": "4.4.0-
|
|
48
|
-
"@elementor/editor-responsive": "4.4.0-
|
|
49
|
-
"@elementor/editor-styles": "4.4.0-
|
|
50
|
-
"@elementor/editor-styles-repository": "4.4.0-
|
|
51
|
-
"@elementor/editor-ui": "4.4.0-
|
|
52
|
-
"@elementor/editor-v1-adapters": "4.4.0-
|
|
53
|
-
"@elementor/events": "4.4.0-
|
|
54
|
-
"@elementor/http-client": "4.4.0-
|
|
55
|
-
"@elementor/schema": "4.4.0-
|
|
56
|
-
"@elementor/twing": "4.4.0-
|
|
40
|
+
"@elementor/editor": "4.4.0-1146",
|
|
41
|
+
"@elementor/editor-controls": "4.4.0-1146",
|
|
42
|
+
"@elementor/editor-documents": "4.4.0-1146",
|
|
43
|
+
"@elementor/editor-elements": "4.4.0-1146",
|
|
44
|
+
"@elementor/editor-interactions": "4.4.0-1146",
|
|
45
|
+
"@elementor/editor-mcp": "4.4.0-1146",
|
|
46
|
+
"@elementor/editor-notifications": "4.4.0-1146",
|
|
47
|
+
"@elementor/editor-props": "4.4.0-1146",
|
|
48
|
+
"@elementor/editor-responsive": "4.4.0-1146",
|
|
49
|
+
"@elementor/editor-styles": "4.4.0-1146",
|
|
50
|
+
"@elementor/editor-styles-repository": "4.4.0-1146",
|
|
51
|
+
"@elementor/editor-ui": "4.4.0-1146",
|
|
52
|
+
"@elementor/editor-v1-adapters": "4.4.0-1146",
|
|
53
|
+
"@elementor/events": "4.4.0-1146",
|
|
54
|
+
"@elementor/http-client": "4.4.0-1146",
|
|
55
|
+
"@elementor/schema": "4.4.0-1146",
|
|
56
|
+
"@elementor/twing": "4.4.0-1146",
|
|
57
57
|
"@elementor/ui": "1.41.4",
|
|
58
|
-
"@elementor/utils": "4.4.0-
|
|
59
|
-
"@elementor/wp-media": "4.4.0-
|
|
58
|
+
"@elementor/utils": "4.4.0-1146",
|
|
59
|
+
"@elementor/wp-media": "4.4.0-1146",
|
|
60
60
|
"@floating-ui/react": "^0.27.5",
|
|
61
61
|
"@wordpress/i18n": "^5.13.0",
|
|
62
62
|
"dompurify": "^3.2.6"
|
|
@@ -133,7 +133,7 @@ describe( 'iconTransformer', () => {
|
|
|
133
133
|
expect( html ).toContain( 'M10 10' );
|
|
134
134
|
} );
|
|
135
135
|
|
|
136
|
-
it( '
|
|
136
|
+
it( 'falls back to the default svg when the icon cannot be resolved', async () => {
|
|
137
137
|
// Arrange.
|
|
138
138
|
mockFetch( { icons: {} } );
|
|
139
139
|
|
|
@@ -141,7 +141,7 @@ describe( 'iconTransformer', () => {
|
|
|
141
141
|
const result = await resolveSavedIcon( 'fas fa-missing', 'fa-solid' );
|
|
142
142
|
|
|
143
143
|
// Assert.
|
|
144
|
-
expect( result ).toEqual( { html: null, url:
|
|
144
|
+
expect( result ).toEqual( { html: null, url: 'https://example.com/assets/images/default-svg.svg' } );
|
|
145
145
|
} );
|
|
146
146
|
|
|
147
147
|
it( 'fetches json from the localized font awesome 7 base url', async () => {
|
|
@@ -180,8 +180,70 @@ describe( 'iconTransformer', () => {
|
|
|
180
180
|
const result = await resolveSavedIcon( 'fas fa-star', 'fa-../../wp-config' );
|
|
181
181
|
|
|
182
182
|
// Assert.
|
|
183
|
-
expect( global.fetch ).
|
|
184
|
-
|
|
183
|
+
expect( ( global.fetch as jest.Mock ).mock.calls.map( ( [ url ] ) => String( url ) ) ).toEqual( [
|
|
184
|
+
'https://example.com/assets/images/default-svg.svg',
|
|
185
|
+
] );
|
|
186
|
+
expect( result ).toEqual(
|
|
187
|
+
expect.objectContaining( { url: 'https://example.com/assets/images/default-svg.svg' } )
|
|
188
|
+
);
|
|
189
|
+
} );
|
|
190
|
+
|
|
191
|
+
it( 'asks providers for a font awesome icon missing from the free data', async () => {
|
|
192
|
+
// Arrange.
|
|
193
|
+
mockFetch( { icons: {} } );
|
|
194
|
+
const resolveSvg = jest
|
|
195
|
+
.fn()
|
|
196
|
+
.mockResolvedValue(
|
|
197
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M2 2h6v6H2z"></path></svg>'
|
|
198
|
+
);
|
|
199
|
+
registerIconLibraryProvider( {
|
|
200
|
+
id: 'test-provider',
|
|
201
|
+
useIcons: () => ( { data: [], isLoading: false } ),
|
|
202
|
+
resolveSvg,
|
|
203
|
+
} );
|
|
204
|
+
|
|
205
|
+
// Act.
|
|
206
|
+
const result = ( await resolveSavedIcon( 'fal fa-star', 'fa-light' ) ) as { html: string; url: string | null };
|
|
207
|
+
|
|
208
|
+
unregisterIconLibraryProvider( 'test-provider' );
|
|
209
|
+
|
|
210
|
+
// Assert.
|
|
211
|
+
expect( resolveSvg ).toHaveBeenCalledWith( 'fa-light', 'fal fa-star', undefined );
|
|
212
|
+
expect( result.html ).toContain( 'M2 2h6v6H2z' );
|
|
213
|
+
expect( result.url ).toBeNull();
|
|
214
|
+
} );
|
|
215
|
+
|
|
216
|
+
it( 'falls back to the default svg for a font awesome icon when no provider resolves it', async () => {
|
|
217
|
+
// Arrange.
|
|
218
|
+
registerIconLibraryProvider( {
|
|
219
|
+
id: 'test-provider',
|
|
220
|
+
useIcons: () => ( { data: [], isLoading: false } ),
|
|
221
|
+
resolveSvg: async () => null,
|
|
222
|
+
} );
|
|
223
|
+
const defaultSvg =
|
|
224
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M24.9999 4.31543"></path></svg>';
|
|
225
|
+
global.fetch = jest.fn( ( url: string ) =>
|
|
226
|
+
Promise.resolve(
|
|
227
|
+
String( url ).endsWith( '.svg' )
|
|
228
|
+
? {
|
|
229
|
+
ok: true,
|
|
230
|
+
headers: new Headers( { 'content-type': 'image/svg+xml' } ),
|
|
231
|
+
text: () => Promise.resolve( defaultSvg ),
|
|
232
|
+
}
|
|
233
|
+
: { ok: true, json: () => Promise.resolve( { icons: {} } ) }
|
|
234
|
+
)
|
|
235
|
+
) as never;
|
|
236
|
+
|
|
237
|
+
// Act.
|
|
238
|
+
const result = await resolveSavedIcon( 'fa-light fa-star', 'fa-light' );
|
|
239
|
+
|
|
240
|
+
unregisterIconLibraryProvider( 'test-provider' );
|
|
241
|
+
|
|
242
|
+
// Assert.
|
|
243
|
+
expect( result ).toEqual( {
|
|
244
|
+
html: expect.stringContaining( 'M24.9999 4.31543' ),
|
|
245
|
+
url: 'https://example.com/assets/images/default-svg.svg',
|
|
246
|
+
} );
|
|
185
247
|
} );
|
|
186
248
|
|
|
187
249
|
it( 'falls back to the default svg when no provider resolves a non-native library', async () => {
|
|
@@ -13,7 +13,6 @@ import { svgSrcTransformer } from './svg-src-transformer';
|
|
|
13
13
|
const EMPTY_ICON_RESULT = { html: null, url: null };
|
|
14
14
|
const ICON_SVG_SIZE = '100%';
|
|
15
15
|
const ICON_SVG_OVERFLOW = 'visible';
|
|
16
|
-
const FONT_AWESOME_LIBRARY_PREFIX = 'fa-';
|
|
17
16
|
const EICONS_LIBRARY = 'eicons';
|
|
18
17
|
const DEFAULT_SVG_RELATIVE_PATH = 'images/default-svg.svg';
|
|
19
18
|
|
|
@@ -36,7 +35,7 @@ export const iconTransformer = createTransformer( async ( value: IconValue, { si
|
|
|
36
35
|
return { html: fontAwesomeHtml, url: null };
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
if (
|
|
38
|
+
if ( EICONS_LIBRARY === library ) {
|
|
40
39
|
return EMPTY_ICON_RESULT;
|
|
41
40
|
}
|
|
42
41
|
|