@elementor/editor-components 3.35.0-439 → 3.35.0-441
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 +24 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/hooks/cleanup-overridable-props-on-delete.ts +9 -7
- package/src/hooks/use-canvas-document.ts +5 -2
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/init.ts
|
|
38
38
|
var import_editor = require("@elementor/editor");
|
|
39
|
-
var
|
|
39
|
+
var import_editor_canvas8 = require("@elementor/editor-canvas");
|
|
40
40
|
var import_editor_documents13 = require("@elementor/editor-documents");
|
|
41
41
|
var import_editor_editing_panel8 = require("@elementor/editor-editing-panel");
|
|
42
42
|
var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
@@ -3151,10 +3151,9 @@ var import_react_dom = require("react-dom");
|
|
|
3151
3151
|
var import_i18n23 = require("@wordpress/i18n");
|
|
3152
3152
|
|
|
3153
3153
|
// src/hooks/use-canvas-document.ts
|
|
3154
|
-
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
3155
3154
|
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3156
3155
|
function useCanvasDocument() {
|
|
3157
|
-
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => (0,
|
|
3156
|
+
return (0, import_editor_v1_adapters6.__privateUseListenTo)((0, import_editor_v1_adapters6.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters6.getCanvasIframeDocument)());
|
|
3158
3157
|
}
|
|
3159
3158
|
|
|
3160
3159
|
// src/hooks/use-element-rect.ts
|
|
@@ -4209,30 +4208,30 @@ var import_editor_elements17 = require("@elementor/editor-elements");
|
|
|
4209
4208
|
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
4210
4209
|
var import_store63 = require("@elementor/store");
|
|
4211
4210
|
function initCleanupOverridablePropsOnDelete() {
|
|
4212
|
-
(0, import_editor_v1_adapters8.registerDataHook)("
|
|
4211
|
+
(0, import_editor_v1_adapters8.registerDataHook)("dependency", "document/elements/delete", (args) => {
|
|
4213
4212
|
const state = (0, import_store63.__getState)();
|
|
4214
4213
|
if (!state) {
|
|
4215
|
-
return;
|
|
4214
|
+
return true;
|
|
4216
4215
|
}
|
|
4217
4216
|
const currentComponentId = selectCurrentComponentId(state);
|
|
4218
4217
|
if (!currentComponentId) {
|
|
4219
|
-
return;
|
|
4218
|
+
return true;
|
|
4220
4219
|
}
|
|
4221
4220
|
const overridableProps = selectOverridableProps(state, currentComponentId);
|
|
4222
4221
|
if (!overridableProps || Object.keys(overridableProps.props).length === 0) {
|
|
4223
|
-
return;
|
|
4222
|
+
return true;
|
|
4224
4223
|
}
|
|
4225
4224
|
const containers = args.containers ?? (args.container ? [args.container] : []);
|
|
4226
4225
|
if (containers.length === 0) {
|
|
4227
|
-
return;
|
|
4226
|
+
return true;
|
|
4228
4227
|
}
|
|
4229
4228
|
const deletedElementIds = collectDeletedElementIds(containers);
|
|
4230
4229
|
if (deletedElementIds.length === 0) {
|
|
4231
|
-
return;
|
|
4230
|
+
return true;
|
|
4232
4231
|
}
|
|
4233
4232
|
const propKeysToDelete = Object.entries(overridableProps.props).filter(([, prop]) => deletedElementIds.includes(prop.elementId)).map(([propKey]) => propKey);
|
|
4234
4233
|
if (propKeysToDelete.length === 0) {
|
|
4235
|
-
return;
|
|
4234
|
+
return true;
|
|
4236
4235
|
}
|
|
4237
4236
|
const remainingProps = Object.fromEntries(
|
|
4238
4237
|
Object.entries(overridableProps.props).filter(([propKey]) => !propKeysToDelete.includes(propKey))
|
|
@@ -4251,6 +4250,7 @@ function initCleanupOverridablePropsOnDelete() {
|
|
|
4251
4250
|
}
|
|
4252
4251
|
})
|
|
4253
4252
|
);
|
|
4253
|
+
return true;
|
|
4254
4254
|
});
|
|
4255
4255
|
}
|
|
4256
4256
|
function collectDeletedElementIds(containers) {
|
|
@@ -4341,7 +4341,7 @@ function hasOverrides(settings) {
|
|
|
4341
4341
|
var import_editor_mcp3 = require("@elementor/editor-mcp");
|
|
4342
4342
|
|
|
4343
4343
|
// src/mcp/save-as-component-tool.ts
|
|
4344
|
-
var
|
|
4344
|
+
var import_editor_canvas7 = require("@elementor/editor-canvas");
|
|
4345
4345
|
var import_editor_elements19 = require("@elementor/editor-elements");
|
|
4346
4346
|
var import_editor_mcp2 = require("@elementor/editor-mcp");
|
|
4347
4347
|
var import_http_client2 = require("@elementor/http-client");
|
|
@@ -4526,17 +4526,17 @@ Use this tool when the user wants to:
|
|
|
4526
4526
|
- Element elType is a 'widget'
|
|
4527
4527
|
|
|
4528
4528
|
# **CRITICAL - REQUIRED RESOURCES (Must read before using this tool)**
|
|
4529
|
-
1. [${
|
|
4529
|
+
1. [${import_editor_canvas7.DOCUMENT_STRUCTURE_URI}]
|
|
4530
4530
|
**MANDATORY** - Required to understand the document structure and identify child elements for overridable properties.
|
|
4531
4531
|
Use this resource to find element IDs and understand the element hierarchy.
|
|
4532
4532
|
|
|
4533
|
-
2. [${
|
|
4533
|
+
2. [${import_editor_canvas7.WIDGET_SCHEMA_URI}]
|
|
4534
4534
|
**MANDATORY** - Required to understand which properties are available for each widget type.
|
|
4535
4535
|
Use this to identify available propKeys in the atomic_props_schema for child elements.
|
|
4536
4536
|
|
|
4537
4537
|
# Instructions - MUST FOLLOW IN ORDER
|
|
4538
4538
|
## Step 1: Identify the Target Element
|
|
4539
|
-
1. Read the [${
|
|
4539
|
+
1. Read the [${import_editor_canvas7.DOCUMENT_STRUCTURE_URI}] resource to understand the document structure
|
|
4540
4540
|
2. Locate the element you want to save as a component by its element_id
|
|
4541
4541
|
3. Verify the element type is a valid element type
|
|
4542
4542
|
4. Ensure the element is not locked and is not already a component
|
|
@@ -4546,11 +4546,11 @@ Do this step to make child element properties customizable.
|
|
|
4546
4546
|
Skip that step ONLY if the user explicitly requests to not make any properties customizable.
|
|
4547
4547
|
|
|
4548
4548
|
1. **Identify Child Elements**
|
|
4549
|
-
- Use the [${
|
|
4549
|
+
- Use the [${import_editor_canvas7.DOCUMENT_STRUCTURE_URI}] resource to find all child elements
|
|
4550
4550
|
- Note the elementId and widgetType/elType of each child element you want to customize
|
|
4551
4551
|
|
|
4552
4552
|
2. **Find Available Properties**
|
|
4553
|
-
- Use the [${
|
|
4553
|
+
- Use the [${import_editor_canvas7.WIDGET_SCHEMA_URI}] resource to find the child element's widget type schema
|
|
4554
4554
|
- Review the atomic_props_schema to find available propKeys (ONLY use top-level props)
|
|
4555
4555
|
- Common propKeys include: "text", "url", "tag", "size", etc.
|
|
4556
4556
|
- Use only the top level properties, do not use nested properties.
|
|
@@ -4569,7 +4569,7 @@ Call the tool with:
|
|
|
4569
4569
|
|
|
4570
4570
|
# CONSTRAINTS
|
|
4571
4571
|
- NEVER try to override properties of the parent element itself - ONLY child elements
|
|
4572
|
-
- NEVER use invalid propKeys - always verify against the widget's atomic_props_schema in [${
|
|
4572
|
+
- NEVER use invalid propKeys - always verify against the widget's atomic_props_schema in [${import_editor_canvas7.WIDGET_SCHEMA_URI}]
|
|
4573
4573
|
- Property keys must exist in the child element's atomic_props_schema
|
|
4574
4574
|
- Element IDs must exist within the target element's children
|
|
4575
4575
|
- When tool execution fails, read the error message and adjust accordingly
|
|
@@ -4578,7 +4578,7 @@ Call the tool with:
|
|
|
4578
4578
|
saveAsComponentPrompt.parameter(
|
|
4579
4579
|
"element_id",
|
|
4580
4580
|
`**MANDATORY** The unique identifier of the element to save as a component.
|
|
4581
|
-
Use the [${
|
|
4581
|
+
Use the [${import_editor_canvas7.DOCUMENT_STRUCTURE_URI}] resource to find available element IDs.`
|
|
4582
4582
|
);
|
|
4583
4583
|
saveAsComponentPrompt.parameter(
|
|
4584
4584
|
"component_name",
|
|
@@ -4603,8 +4603,8 @@ Structure:
|
|
|
4603
4603
|
\`\`\`
|
|
4604
4604
|
|
|
4605
4605
|
To populate this correctly:
|
|
4606
|
-
1. Use [${
|
|
4607
|
-
2. Use [${
|
|
4606
|
+
1. Use [${import_editor_canvas7.DOCUMENT_STRUCTURE_URI}] to find child element IDs and their widgetType
|
|
4607
|
+
2. Use [${import_editor_canvas7.WIDGET_SCHEMA_URI}] to find the atomic_props_schema for each child element's widgetType
|
|
4608
4608
|
3. Only include properties you want to be customizable in component instances
|
|
4609
4609
|
4. Provide a unique, user-friendly label for each property (e.g., "Hero Headline", "CTA Button Text")`
|
|
4610
4610
|
);
|
|
@@ -5008,7 +5008,7 @@ function init() {
|
|
|
5008
5008
|
import_editor_styles_repository2.stylesRepository.register(componentsStylesProvider);
|
|
5009
5009
|
(0, import_store80.__registerSlice)(slice);
|
|
5010
5010
|
(0, import_editor_panels4.__registerPanel)(panel);
|
|
5011
|
-
(0,
|
|
5011
|
+
(0, import_editor_canvas8.registerElementType)(
|
|
5012
5012
|
COMPONENT_WIDGET_TYPE,
|
|
5013
5013
|
(options) => createComponentType({ ...options, showLockedByModal: openEditModeDialog })
|
|
5014
5014
|
);
|
|
@@ -5066,9 +5066,9 @@ function init() {
|
|
|
5066
5066
|
condition: (_, elementType) => elementType.key === "e-component",
|
|
5067
5067
|
component: InstanceEditingPanel
|
|
5068
5068
|
});
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5069
|
+
import_editor_canvas8.settingsTransformersRegistry.register("component-instance", componentInstanceTransformer);
|
|
5070
|
+
import_editor_canvas8.settingsTransformersRegistry.register("overridable", componentOverridableTransformer);
|
|
5071
|
+
import_editor_canvas8.settingsTransformersRegistry.register("override", componentOverrideTransformer);
|
|
5072
5072
|
initRegenerateOverrideKeys();
|
|
5073
5073
|
initCleanupOverridablePropsOnDelete();
|
|
5074
5074
|
initMcp();
|