@elementor/editor-canvas 4.2.0-858 → 4.2.0-860
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
|
@@ -121,6 +121,9 @@ function isWidgetAvailableForLLM(config) {
|
|
|
121
121
|
if (config.meta?.llm_support === false) {
|
|
122
122
|
return false;
|
|
123
123
|
}
|
|
124
|
+
if (config.title === "Component") {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
124
127
|
if (config.atomic_props_schema) {
|
|
125
128
|
return true;
|
|
126
129
|
}
|
|
@@ -4087,6 +4090,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4087
4090
|
rootContainers = [];
|
|
4088
4091
|
api = {
|
|
4089
4092
|
createElement: import_editor_elements13.createElement,
|
|
4093
|
+
deleteElement: import_editor_elements13.deleteElement,
|
|
4090
4094
|
getWidgetsCache: import_editor_elements13.getWidgetsCache,
|
|
4091
4095
|
generateElementId: import_editor_elements13.generateElementId,
|
|
4092
4096
|
getContainer: import_editor_elements13.getContainer,
|
|
@@ -4137,7 +4141,8 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4137
4141
|
elements: children,
|
|
4138
4142
|
editor_settings: {
|
|
4139
4143
|
title: node.getAttribute("configuration-id") ?? void 0
|
|
4140
|
-
}
|
|
4144
|
+
},
|
|
4145
|
+
elType: "widget"
|
|
4141
4146
|
};
|
|
4142
4147
|
if (isWidget) {
|
|
4143
4148
|
return { ...base, elType: "widget", widgetType: elementTag };
|
|
@@ -4169,12 +4174,6 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4169
4174
|
}
|
|
4170
4175
|
return errors;
|
|
4171
4176
|
}
|
|
4172
|
-
findSchemaForNode(node) {
|
|
4173
|
-
const widgetsCache = this.api.getWidgetsCache() || {};
|
|
4174
|
-
const widgetType = node.tagName;
|
|
4175
|
-
const widgetData = widgetsCache[widgetType]?.atomic_props_schema;
|
|
4176
|
-
return widgetData || null;
|
|
4177
|
-
}
|
|
4178
4177
|
matchNodeByConfigId(configId) {
|
|
4179
4178
|
const node = this.xml.querySelector(`[configuration-id="${configId}"]`);
|
|
4180
4179
|
if (!node) {
|
|
@@ -4296,13 +4295,21 @@ ${childTypeErrors.join("\n")}`);
|
|
|
4296
4295
|
const children = Array.from(this.xml.children);
|
|
4297
4296
|
for (const childNode of children) {
|
|
4298
4297
|
const modelTree = this.buildModelTree(childNode, widgetsCache);
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4298
|
+
try {
|
|
4299
|
+
const newElement = this.api.createElement({
|
|
4300
|
+
container: rootContainer,
|
|
4301
|
+
model: modelTree,
|
|
4302
|
+
options: { useHistory: false }
|
|
4303
|
+
});
|
|
4304
|
+
this.rootContainers.push(newElement);
|
|
4305
|
+
await this.awaitViewRender(newElement);
|
|
4306
|
+
} catch (e) {
|
|
4307
|
+
const attempToRestoreInvalidContainer = this.api.getContainer(modelTree.id);
|
|
4308
|
+
if (attempToRestoreInvalidContainer) {
|
|
4309
|
+
this.api.deleteElement({ container: attempToRestoreInvalidContainer });
|
|
4310
|
+
}
|
|
4311
|
+
throw e;
|
|
4312
|
+
}
|
|
4306
4313
|
}
|
|
4307
4314
|
const { configErrors, styleErrors, invalidStyles } = await this.applyProperties();
|
|
4308
4315
|
return {
|
|
@@ -4547,6 +4554,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
4547
4554
|
try {
|
|
4548
4555
|
const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
|
|
4549
4556
|
createElement: import_editor_elements14.createElement,
|
|
4557
|
+
deleteElement: import_editor_elements14.deleteElement,
|
|
4550
4558
|
getWidgetsCache: import_editor_elements14.getWidgetsCache
|
|
4551
4559
|
});
|
|
4552
4560
|
compositionBuilder.setElementConfig(elementConfig);
|
package/dist/index.mjs
CHANGED
|
@@ -64,6 +64,9 @@ function isWidgetAvailableForLLM(config) {
|
|
|
64
64
|
if (config.meta?.llm_support === false) {
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
67
|
+
if (config.title === "Component") {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
67
70
|
if (config.atomic_props_schema) {
|
|
68
71
|
return true;
|
|
69
72
|
}
|
|
@@ -3853,7 +3856,7 @@ function getElementDisplayName(container) {
|
|
|
3853
3856
|
import { getCurrentDocument } from "@elementor/editor-documents";
|
|
3854
3857
|
import {
|
|
3855
3858
|
createElement as createElement8,
|
|
3856
|
-
deleteElement,
|
|
3859
|
+
deleteElement as deleteElement2,
|
|
3857
3860
|
getContainer as getContainer5,
|
|
3858
3861
|
getWidgetsCache as getWidgetsCache9
|
|
3859
3862
|
} from "@elementor/editor-elements";
|
|
@@ -3861,6 +3864,7 @@ import {
|
|
|
3861
3864
|
// src/composition-builder/composition-builder.ts
|
|
3862
3865
|
import {
|
|
3863
3866
|
createElement as createElement7,
|
|
3867
|
+
deleteElement,
|
|
3864
3868
|
generateElementId as generateElementId2,
|
|
3865
3869
|
getContainer as getContainer4,
|
|
3866
3870
|
getWidgetsCache as getWidgetsCache8
|
|
@@ -4081,6 +4085,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4081
4085
|
rootContainers = [];
|
|
4082
4086
|
api = {
|
|
4083
4087
|
createElement: createElement7,
|
|
4088
|
+
deleteElement,
|
|
4084
4089
|
getWidgetsCache: getWidgetsCache8,
|
|
4085
4090
|
generateElementId: generateElementId2,
|
|
4086
4091
|
getContainer: getContainer4,
|
|
@@ -4131,7 +4136,8 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4131
4136
|
elements: children,
|
|
4132
4137
|
editor_settings: {
|
|
4133
4138
|
title: node.getAttribute("configuration-id") ?? void 0
|
|
4134
|
-
}
|
|
4139
|
+
},
|
|
4140
|
+
elType: "widget"
|
|
4135
4141
|
};
|
|
4136
4142
|
if (isWidget) {
|
|
4137
4143
|
return { ...base, elType: "widget", widgetType: elementTag };
|
|
@@ -4163,12 +4169,6 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
4163
4169
|
}
|
|
4164
4170
|
return errors;
|
|
4165
4171
|
}
|
|
4166
|
-
findSchemaForNode(node) {
|
|
4167
|
-
const widgetsCache = this.api.getWidgetsCache() || {};
|
|
4168
|
-
const widgetType = node.tagName;
|
|
4169
|
-
const widgetData = widgetsCache[widgetType]?.atomic_props_schema;
|
|
4170
|
-
return widgetData || null;
|
|
4171
|
-
}
|
|
4172
4172
|
matchNodeByConfigId(configId) {
|
|
4173
4173
|
const node = this.xml.querySelector(`[configuration-id="${configId}"]`);
|
|
4174
4174
|
if (!node) {
|
|
@@ -4290,13 +4290,21 @@ ${childTypeErrors.join("\n")}`);
|
|
|
4290
4290
|
const children = Array.from(this.xml.children);
|
|
4291
4291
|
for (const childNode of children) {
|
|
4292
4292
|
const modelTree = this.buildModelTree(childNode, widgetsCache);
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4293
|
+
try {
|
|
4294
|
+
const newElement = this.api.createElement({
|
|
4295
|
+
container: rootContainer,
|
|
4296
|
+
model: modelTree,
|
|
4297
|
+
options: { useHistory: false }
|
|
4298
|
+
});
|
|
4299
|
+
this.rootContainers.push(newElement);
|
|
4300
|
+
await this.awaitViewRender(newElement);
|
|
4301
|
+
} catch (e) {
|
|
4302
|
+
const attempToRestoreInvalidContainer = this.api.getContainer(modelTree.id);
|
|
4303
|
+
if (attempToRestoreInvalidContainer) {
|
|
4304
|
+
this.api.deleteElement({ container: attempToRestoreInvalidContainer });
|
|
4305
|
+
}
|
|
4306
|
+
throw e;
|
|
4307
|
+
}
|
|
4300
4308
|
}
|
|
4301
4309
|
const { configErrors, styleErrors, invalidStyles } = await this.applyProperties();
|
|
4302
4310
|
return {
|
|
@@ -4541,6 +4549,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
4541
4549
|
try {
|
|
4542
4550
|
const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
|
|
4543
4551
|
createElement: createElement8,
|
|
4552
|
+
deleteElement: deleteElement2,
|
|
4544
4553
|
getWidgetsCache: getWidgetsCache9
|
|
4545
4554
|
});
|
|
4546
4555
|
compositionBuilder.setElementConfig(elementConfig);
|
|
@@ -4569,7 +4578,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
4569
4578
|
}
|
|
4570
4579
|
if (errors.length) {
|
|
4571
4580
|
rootContainers.forEach((rootContainer) => {
|
|
4572
|
-
|
|
4581
|
+
deleteElement2({
|
|
4573
4582
|
container: rootContainer,
|
|
4574
4583
|
options: { useHistory: false }
|
|
4575
4584
|
});
|
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-
|
|
4
|
+
"version": "4.2.0-860",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.2.0-
|
|
40
|
+
"@elementor/editor": "4.2.0-860",
|
|
41
41
|
"dompurify": "^3.2.6",
|
|
42
|
-
"@elementor/editor-controls": "4.2.0-
|
|
43
|
-
"@elementor/editor-documents": "4.2.0-
|
|
44
|
-
"@elementor/editor-elements": "4.2.0-
|
|
45
|
-
"@elementor/editor-interactions": "4.2.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.2.0-
|
|
47
|
-
"@elementor/editor-notifications": "4.2.0-
|
|
48
|
-
"@elementor/editor-props": "4.2.0-
|
|
49
|
-
"@elementor/editor-responsive": "4.2.0-
|
|
50
|
-
"@elementor/editor-styles": "4.2.0-
|
|
51
|
-
"@elementor/editor-styles-repository": "4.2.0-
|
|
52
|
-
"@elementor/editor-ui": "4.2.0-
|
|
53
|
-
"@elementor/editor-v1-adapters": "4.2.0-
|
|
54
|
-
"@elementor/schema": "4.2.0-
|
|
55
|
-
"@elementor/twing": "4.2.0-
|
|
42
|
+
"@elementor/editor-controls": "4.2.0-860",
|
|
43
|
+
"@elementor/editor-documents": "4.2.0-860",
|
|
44
|
+
"@elementor/editor-elements": "4.2.0-860",
|
|
45
|
+
"@elementor/editor-interactions": "4.2.0-860",
|
|
46
|
+
"@elementor/editor-mcp": "4.2.0-860",
|
|
47
|
+
"@elementor/editor-notifications": "4.2.0-860",
|
|
48
|
+
"@elementor/editor-props": "4.2.0-860",
|
|
49
|
+
"@elementor/editor-responsive": "4.2.0-860",
|
|
50
|
+
"@elementor/editor-styles": "4.2.0-860",
|
|
51
|
+
"@elementor/editor-styles-repository": "4.2.0-860",
|
|
52
|
+
"@elementor/editor-ui": "4.2.0-860",
|
|
53
|
+
"@elementor/editor-v1-adapters": "4.2.0-860",
|
|
54
|
+
"@elementor/schema": "4.2.0-860",
|
|
55
|
+
"@elementor/twing": "4.2.0-860",
|
|
56
56
|
"@elementor/ui": "1.37.5",
|
|
57
|
-
"@elementor/utils": "4.2.0-
|
|
58
|
-
"@elementor/wp-media": "4.2.0-
|
|
57
|
+
"@elementor/utils": "4.2.0-860",
|
|
58
|
+
"@elementor/wp-media": "4.2.0-860",
|
|
59
59
|
"@floating-ui/react": "^0.27.5",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createElement,
|
|
3
3
|
type CreateElementParams,
|
|
4
|
+
deleteElement,
|
|
4
5
|
generateElementId,
|
|
5
6
|
getContainer,
|
|
6
7
|
getWidgetsCache,
|
|
7
8
|
type V1Element,
|
|
8
9
|
type V1ElementConfig,
|
|
10
|
+
type V1ElementModelProps,
|
|
9
11
|
} from '@elementor/editor-elements';
|
|
10
12
|
import { type z } from '@elementor/schema';
|
|
11
13
|
|
|
@@ -17,6 +19,7 @@ type AnyConfig = Record< string, Record< string, AnyValue > >;
|
|
|
17
19
|
|
|
18
20
|
type API = {
|
|
19
21
|
createElement: typeof createElement;
|
|
22
|
+
deleteElement: typeof deleteElement;
|
|
20
23
|
getWidgetsCache: typeof getWidgetsCache;
|
|
21
24
|
generateElementId: typeof generateElementId;
|
|
22
25
|
getContainer: typeof getContainer;
|
|
@@ -38,6 +41,7 @@ export class CompositionBuilder {
|
|
|
38
41
|
private rootContainers: V1Element[] = [];
|
|
39
42
|
private api: API = {
|
|
40
43
|
createElement,
|
|
44
|
+
deleteElement,
|
|
41
45
|
getWidgetsCache,
|
|
42
46
|
generateElementId,
|
|
43
47
|
getContainer,
|
|
@@ -94,15 +98,26 @@ export class CompositionBuilder {
|
|
|
94
98
|
|
|
95
99
|
node.setAttribute( 'id', id );
|
|
96
100
|
|
|
97
|
-
const base = {
|
|
101
|
+
const base: V1ElementModelProps = {
|
|
98
102
|
id,
|
|
99
103
|
skipDefaultChildren: true,
|
|
100
|
-
elements: children,
|
|
104
|
+
elements: children as V1ElementModelProps[ 'elements' ],
|
|
101
105
|
editor_settings: {
|
|
102
106
|
title: node.getAttribute( 'configuration-id' ) ?? undefined,
|
|
103
107
|
},
|
|
108
|
+
elType: 'widget',
|
|
104
109
|
};
|
|
105
110
|
|
|
111
|
+
// TODO: Restore this code once components are working in compositions
|
|
112
|
+
// if ( elementTag === 'e-component' ) {
|
|
113
|
+
// // apply component id before applying values
|
|
114
|
+
// const elementConfig = this.elementConfig[ String( node.getAttribute( 'configuration-id' ) ) ];
|
|
115
|
+
// if ( elementConfig ) {
|
|
116
|
+
// base.settings = base.settings || {};
|
|
117
|
+
// base.settings.component_instance = elementConfig.component_instance;
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
120
|
+
|
|
106
121
|
if ( isWidget ) {
|
|
107
122
|
return { ...base, elType: 'widget' as const, widgetType: elementTag };
|
|
108
123
|
}
|
|
@@ -142,13 +157,6 @@ export class CompositionBuilder {
|
|
|
142
157
|
return errors;
|
|
143
158
|
}
|
|
144
159
|
|
|
145
|
-
private findSchemaForNode( node: Element ) {
|
|
146
|
-
const widgetsCache = this.api.getWidgetsCache() || {};
|
|
147
|
-
const widgetType = node.tagName;
|
|
148
|
-
const widgetData = widgetsCache[ widgetType ]?.atomic_props_schema;
|
|
149
|
-
return widgetData || null;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
160
|
private matchNodeByConfigId( configId: string ) {
|
|
153
161
|
const node = this.xml.querySelector( `[configuration-id="${ configId }"]` );
|
|
154
162
|
if ( ! node ) {
|
|
@@ -282,15 +290,21 @@ export class CompositionBuilder {
|
|
|
282
290
|
for ( const childNode of children ) {
|
|
283
291
|
const modelTree = this.buildModelTree( childNode, widgetsCache );
|
|
284
292
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
293
|
+
try {
|
|
294
|
+
const newElement = this.api.createElement( {
|
|
295
|
+
container: rootContainer,
|
|
296
|
+
model: modelTree as CreateElementParams[ 'model' ],
|
|
297
|
+
options: { useHistory: false },
|
|
298
|
+
} );
|
|
299
|
+
this.rootContainers.push( newElement );
|
|
300
|
+
await this.awaitViewRender( newElement );
|
|
301
|
+
} catch ( e: unknown ) {
|
|
302
|
+
const attempToRestoreInvalidContainer = this.api.getContainer( modelTree.id as string );
|
|
303
|
+
if ( attempToRestoreInvalidContainer ) {
|
|
304
|
+
this.api.deleteElement( { container: attempToRestoreInvalidContainer } );
|
|
305
|
+
}
|
|
306
|
+
throw e;
|
|
307
|
+
}
|
|
294
308
|
}
|
|
295
309
|
|
|
296
310
|
const { configErrors, styleErrors, invalidStyles } = await this.applyProperties();
|
|
@@ -58,6 +58,7 @@ export const initBuildCompositionsTool = ( reg: MCPRegistryEntry ) => {
|
|
|
58
58
|
try {
|
|
59
59
|
const compositionBuilder = CompositionBuilder.fromXMLString( xmlStructure, {
|
|
60
60
|
createElement,
|
|
61
|
+
deleteElement,
|
|
61
62
|
getWidgetsCache,
|
|
62
63
|
} );
|
|
63
64
|
compositionBuilder.setElementConfig( elementConfig );
|
|
@@ -17,6 +17,10 @@ export function isWidgetAvailableForLLM( config: V1ElementConfig | undefined ):
|
|
|
17
17
|
if ( config.meta?.llm_support === false ) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
|
+
// TODO: Restore component once working in compositions
|
|
21
|
+
if ( config.title === 'Component' ) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
20
24
|
if ( config.atomic_props_schema ) {
|
|
21
25
|
return true;
|
|
22
26
|
}
|