@elementor/editor-canvas 4.2.0-933 → 4.2.0-935

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
@@ -5021,6 +5021,14 @@ ${childTypeErrors.join("\n")}`);
5021
5021
  }
5022
5022
  }
5023
5023
  const { configErrors, styleErrors } = await this.applyProperties();
5024
+ if (typeof window !== "undefined") {
5025
+ const targetWindow = window.top || window;
5026
+ targetWindow.dispatchEvent(
5027
+ new CustomEvent("elementor/composition/built", {
5028
+ detail: { rootContainers: this.rootContainers.map((c) => c.id) }
5029
+ })
5030
+ );
5031
+ }
5024
5032
  return {
5025
5033
  configErrors,
5026
5034
  styleErrors,
package/dist/index.mjs CHANGED
@@ -5007,6 +5007,14 @@ ${childTypeErrors.join("\n")}`);
5007
5007
  }
5008
5008
  }
5009
5009
  const { configErrors, styleErrors } = await this.applyProperties();
5010
+ if (typeof window !== "undefined") {
5011
+ const targetWindow = window.top || window;
5012
+ targetWindow.dispatchEvent(
5013
+ new CustomEvent("elementor/composition/built", {
5014
+ detail: { rootContainers: this.rootContainers.map((c) => c.id) }
5015
+ })
5016
+ );
5017
+ }
5010
5018
  return {
5011
5019
  configErrors,
5012
5020
  styleErrors,
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.2.0-933",
4
+ "version": "4.2.0-935",
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.2.0-933",
40
+ "@elementor/editor": "4.2.0-935",
41
41
  "dompurify": "^3.2.6",
42
- "@elementor/editor-controls": "4.2.0-933",
43
- "@elementor/editor-documents": "4.2.0-933",
44
- "@elementor/editor-elements": "4.2.0-933",
45
- "@elementor/editor-interactions": "4.2.0-933",
46
- "@elementor/editor-mcp": "4.2.0-933",
47
- "@elementor/editor-notifications": "4.2.0-933",
48
- "@elementor/editor-props": "4.2.0-933",
49
- "@elementor/editor-responsive": "4.2.0-933",
50
- "@elementor/editor-styles": "4.2.0-933",
51
- "@elementor/editor-styles-repository": "4.2.0-933",
52
- "@elementor/editor-ui": "4.2.0-933",
53
- "@elementor/editor-v1-adapters": "4.2.0-933",
54
- "@elementor/http-client": "4.2.0-933",
55
- "@elementor/schema": "4.2.0-933",
56
- "@elementor/twing": "4.2.0-933",
42
+ "@elementor/editor-controls": "4.2.0-935",
43
+ "@elementor/editor-documents": "4.2.0-935",
44
+ "@elementor/editor-elements": "4.2.0-935",
45
+ "@elementor/editor-interactions": "4.2.0-935",
46
+ "@elementor/editor-mcp": "4.2.0-935",
47
+ "@elementor/editor-notifications": "4.2.0-935",
48
+ "@elementor/editor-props": "4.2.0-935",
49
+ "@elementor/editor-responsive": "4.2.0-935",
50
+ "@elementor/editor-styles": "4.2.0-935",
51
+ "@elementor/editor-styles-repository": "4.2.0-935",
52
+ "@elementor/editor-ui": "4.2.0-935",
53
+ "@elementor/editor-v1-adapters": "4.2.0-935",
54
+ "@elementor/http-client": "4.2.0-935",
55
+ "@elementor/schema": "4.2.0-935",
56
+ "@elementor/twing": "4.2.0-935",
57
57
  "@elementor/ui": "1.37.5",
58
- "@elementor/utils": "4.2.0-933",
59
- "@elementor/wp-media": "4.2.0-933",
58
+ "@elementor/utils": "4.2.0-935",
59
+ "@elementor/wp-media": "4.2.0-935",
60
60
  "@floating-ui/react": "^0.27.5",
61
61
  "@wordpress/i18n": "^5.13.0"
62
62
  },
@@ -305,3 +305,48 @@ describe( 'CompositionBuilder.build required children', () => {
305
305
  expect( childElements.some( ( child ) => child.widgetType === 'e-form-input' ) ).toBe( true );
306
306
  } );
307
307
  } );
308
+
309
+ describe( 'CompositionBuilder.build final composition built event', () => {
310
+ let dispatchEventSpy: jest.SpyInstance;
311
+
312
+ beforeEach( () => {
313
+ dispatchEventSpy = jest.spyOn( window, 'dispatchEvent' );
314
+ } );
315
+
316
+ afterEach( () => {
317
+ dispatchEventSpy.mockRestore();
318
+ } );
319
+
320
+ it( 'dispatches elementor/composition/built event with root container IDs after applyProperties completes', async () => {
321
+ // Arrange
322
+ const createdElement = createMockPartialContainer( GENERATED_ELEMENT_ID );
323
+ const doUpdateElementProperty = jest.fn();
324
+ const createElement = jest.fn().mockReturnValue( createdElement );
325
+ const getContainer = jest
326
+ .fn()
327
+ .mockImplementation( ( id: string ) => ( id === GENERATED_ELEMENT_ID ? createdElement : undefined ) );
328
+ const builder = CompositionBuilder.fromXMLString( xmlStringWithConfiguration, {
329
+ createElement,
330
+ deleteElement: jest.fn(),
331
+ getContainer,
332
+ generateElementId: jest.fn().mockReturnValue( GENERATED_ELEMENT_ID ),
333
+ getWidgetsCache: jest.fn().mockReturnValue( createMinimalWidgetsCache() ),
334
+ doUpdateElementProperty,
335
+ } );
336
+ builder.setElementConfig( createElementConfigPayload() );
337
+
338
+ // Act
339
+ await builder.build( createMockRootContainer() );
340
+
341
+ // Assert
342
+ expect( doUpdateElementProperty ).toHaveBeenCalledTimes( 1 );
343
+ expect( dispatchEventSpy ).toHaveBeenCalledWith(
344
+ expect.objectContaining( {
345
+ type: 'elementor/composition/built',
346
+ detail: {
347
+ rootContainers: [ GENERATED_ELEMENT_ID ],
348
+ },
349
+ } )
350
+ );
351
+ } );
352
+ } );
@@ -320,6 +320,15 @@ export class CompositionBuilder {
320
320
 
321
321
  const { configErrors, styleErrors } = await this.applyProperties();
322
322
 
323
+ if ( typeof window !== 'undefined' ) {
324
+ const targetWindow = window.top || window;
325
+ targetWindow.dispatchEvent(
326
+ new CustomEvent( 'elementor/composition/built', {
327
+ detail: { rootContainers: this.rootContainers.map( ( c ) => c.id ) },
328
+ } )
329
+ );
330
+ }
331
+
323
332
  return {
324
333
  configErrors,
325
334
  styleErrors,