@elementor/editor-canvas 4.4.0-1111 → 4.4.0-1113

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
@@ -3081,10 +3081,12 @@ function buildEditorAttributes(model) {
3081
3081
  const id = model.get("id");
3082
3082
  const originId = model.get("originId");
3083
3083
  const cid = model.cid ?? "";
3084
+ const isDecorative = model.get("editor_settings")?.decorative === true;
3084
3085
  const attrs = {
3085
3086
  "data-model-cid": cid,
3086
3087
  "data-interaction-id": originId ?? id,
3087
- "x-ignore": "true"
3088
+ "x-ignore": "true",
3089
+ ...isDecorative ? { "data-e-decorative": "true" } : {}
3088
3090
  };
3089
3091
  return Object.entries(attrs).map(([key, value]) => `${key}="${value}"`).join(" ");
3090
3092
  }
package/dist/index.mjs CHANGED
@@ -3043,10 +3043,12 @@ function buildEditorAttributes(model) {
3043
3043
  const id = model.get("id");
3044
3044
  const originId = model.get("originId");
3045
3045
  const cid = model.cid ?? "";
3046
+ const isDecorative = model.get("editor_settings")?.decorative === true;
3046
3047
  const attrs = {
3047
3048
  "data-model-cid": cid,
3048
3049
  "data-interaction-id": originId ?? id,
3049
- "x-ignore": "true"
3050
+ "x-ignore": "true",
3051
+ ...isDecorative ? { "data-e-decorative": "true" } : {}
3050
3052
  };
3051
3053
  return Object.entries(attrs).map(([key, value]) => `${key}="${value}"`).join(" ");
3052
3054
  }
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-1111",
4
+ "version": "4.4.0-1113",
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-1111",
41
- "@elementor/editor-controls": "4.4.0-1111",
42
- "@elementor/editor-documents": "4.4.0-1111",
43
- "@elementor/editor-elements": "4.4.0-1111",
44
- "@elementor/editor-interactions": "4.4.0-1111",
45
- "@elementor/editor-mcp": "4.4.0-1111",
46
- "@elementor/editor-notifications": "4.4.0-1111",
47
- "@elementor/editor-props": "4.4.0-1111",
48
- "@elementor/editor-responsive": "4.4.0-1111",
49
- "@elementor/editor-styles": "4.4.0-1111",
50
- "@elementor/editor-styles-repository": "4.4.0-1111",
51
- "@elementor/editor-ui": "4.4.0-1111",
52
- "@elementor/editor-v1-adapters": "4.4.0-1111",
53
- "@elementor/events": "4.4.0-1111",
54
- "@elementor/http-client": "4.4.0-1111",
55
- "@elementor/schema": "4.4.0-1111",
56
- "@elementor/twing": "4.4.0-1111",
40
+ "@elementor/editor": "4.4.0-1113",
41
+ "@elementor/editor-controls": "4.4.0-1113",
42
+ "@elementor/editor-documents": "4.4.0-1113",
43
+ "@elementor/editor-elements": "4.4.0-1113",
44
+ "@elementor/editor-interactions": "4.4.0-1113",
45
+ "@elementor/editor-mcp": "4.4.0-1113",
46
+ "@elementor/editor-notifications": "4.4.0-1113",
47
+ "@elementor/editor-props": "4.4.0-1113",
48
+ "@elementor/editor-responsive": "4.4.0-1113",
49
+ "@elementor/editor-styles": "4.4.0-1113",
50
+ "@elementor/editor-styles-repository": "4.4.0-1113",
51
+ "@elementor/editor-ui": "4.4.0-1113",
52
+ "@elementor/editor-v1-adapters": "4.4.0-1113",
53
+ "@elementor/events": "4.4.0-1113",
54
+ "@elementor/http-client": "4.4.0-1113",
55
+ "@elementor/schema": "4.4.0-1113",
56
+ "@elementor/twing": "4.4.0-1113",
57
57
  "@elementor/ui": "1.37.5",
58
- "@elementor/utils": "4.4.0-1111",
59
- "@elementor/wp-media": "4.4.0-1111",
58
+ "@elementor/utils": "4.4.0-1113",
59
+ "@elementor/wp-media": "4.4.0-1113",
60
60
  "@floating-ui/react": "^0.27.5",
61
61
  "@wordpress/i18n": "^5.13.0",
62
62
  "dompurify": "^3.2.6"
@@ -0,0 +1,41 @@
1
+ import { buildEditorAttributes } from '../create-nested-templated-element-type';
2
+ import { type ElementView } from '../types';
3
+
4
+ const createModel = ( editorSettings?: Record< string, unknown > ) =>
5
+ ( {
6
+ cid: 'c1',
7
+ get: ( key: string ) =>
8
+ ( {
9
+ id: 'abc123',
10
+ editor_settings: editorSettings,
11
+ } )[ key ],
12
+ } ) as unknown as ElementView[ 'model' ];
13
+
14
+ describe( 'buildEditorAttributes', () => {
15
+ it( 'should mark decorative elements', () => {
16
+ // Arrange
17
+ const model = createModel( { decorative: true } );
18
+
19
+ // Act
20
+ const attributes = buildEditorAttributes( model );
21
+
22
+ // Assert
23
+ expect( attributes ).toContain( 'data-e-decorative="true"' );
24
+ } );
25
+
26
+ it.each( [
27
+ [ 'no editor settings', undefined ],
28
+ [ 'decorative disabled', { decorative: false } ],
29
+ [ 'other editor settings only', { title: 'Hero' } ],
30
+ ] )( 'should not mark the element when it has %s', ( _, editorSettings ) => {
31
+ // Arrange
32
+ const model = createModel( editorSettings );
33
+
34
+ // Act
35
+ const attributes = buildEditorAttributes( model );
36
+
37
+ // Assert
38
+ expect( attributes ).not.toContain( 'data-e-decorative' );
39
+ expect( attributes ).toContain( 'data-interaction-id="abc123"' );
40
+ } );
41
+ } );
@@ -71,15 +71,17 @@ export function createNestedTemplatedElementType( {
71
71
  };
72
72
  }
73
73
 
74
- function buildEditorAttributes( model: ElementView[ 'model' ] ): string {
74
+ export function buildEditorAttributes( model: ElementView[ 'model' ] ): string {
75
75
  const id = model.get( 'id' );
76
76
  const originId = model.get( 'originId' );
77
77
  const cid = model.cid ?? '';
78
+ const isDecorative = model.get( 'editor_settings' )?.decorative === true;
78
79
 
79
80
  const attrs: Record< string, string > = {
80
81
  'data-model-cid': cid,
81
82
  'data-interaction-id': originId ?? id,
82
83
  'x-ignore': 'true',
84
+ ...( isDecorative ? { 'data-e-decorative': 'true' } : {} ),
83
85
  };
84
86
 
85
87
  return Object.entries( attrs )