@elementor/editor-components 3.35.0-399 → 3.35.0-400
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 +259 -131
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -22
- package/src/components/create-component-form/create-component-form.tsx +16 -0
- package/src/init.ts +3 -0
- package/src/prevent-non-atomic-nesting.ts +209 -0
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { __registerPanel as registerPanel } from "@elementor/editor-panels";
|
|
|
17
17
|
import { stylesRepository } from "@elementor/editor-styles-repository";
|
|
18
18
|
import { registerDataHook as registerDataHook2 } from "@elementor/editor-v1-adapters";
|
|
19
19
|
import { __registerSlice as registerSlice } from "@elementor/store";
|
|
20
|
-
import { __ as
|
|
20
|
+
import { __ as __26 } from "@wordpress/i18n";
|
|
21
21
|
|
|
22
22
|
// src/component-instance-transformer.ts
|
|
23
23
|
import { createTransformer, RenderContext } from "@elementor/editor-canvas";
|
|
@@ -2272,10 +2272,125 @@ var COMPONENT_DOCUMENT_TYPE = "elementor_component";
|
|
|
2272
2272
|
import * as React17 from "react";
|
|
2273
2273
|
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef4, useState as useState7 } from "react";
|
|
2274
2274
|
import { getElementLabel } from "@elementor/editor-elements";
|
|
2275
|
+
import { notify as notify2 } from "@elementor/editor-notifications";
|
|
2275
2276
|
import { Form as FormElement, ThemeProvider as ThemeProvider3 } from "@elementor/editor-ui";
|
|
2276
2277
|
import { StarIcon } from "@elementor/icons";
|
|
2277
2278
|
import { Alert as Alert2, Button as Button3, FormLabel as FormLabel2, Grid as Grid2, Popover as Popover3, Snackbar, Stack as Stack11, TextField as TextField3, Typography as Typography9 } from "@elementor/ui";
|
|
2278
|
-
import { __ as
|
|
2279
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
2280
|
+
|
|
2281
|
+
// src/prevent-non-atomic-nesting.ts
|
|
2282
|
+
import { isAtomicWidget } from "@elementor/editor-canvas";
|
|
2283
|
+
import { getAllDescendants, getElementType } from "@elementor/editor-elements";
|
|
2284
|
+
import { notify } from "@elementor/editor-notifications";
|
|
2285
|
+
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
2286
|
+
import { __getStore as getStore2 } from "@elementor/store";
|
|
2287
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2288
|
+
var NON_ATOMIC_ELEMENT_ALERT = {
|
|
2289
|
+
type: "default",
|
|
2290
|
+
message: __16("Cannot add this element here - only atomic elements are allowed inside components.", "elementor"),
|
|
2291
|
+
id: "non-atomic-element-blocked"
|
|
2292
|
+
};
|
|
2293
|
+
function initNonAtomicNestingPrevention() {
|
|
2294
|
+
blockCommand({
|
|
2295
|
+
command: "document/elements/create",
|
|
2296
|
+
condition: blockNonAtomicCreate
|
|
2297
|
+
});
|
|
2298
|
+
blockCommand({
|
|
2299
|
+
command: "document/elements/move",
|
|
2300
|
+
condition: blockNonAtomicMove
|
|
2301
|
+
});
|
|
2302
|
+
blockCommand({
|
|
2303
|
+
command: "document/elements/paste",
|
|
2304
|
+
condition: blockNonAtomicPaste
|
|
2305
|
+
});
|
|
2306
|
+
}
|
|
2307
|
+
function isEditingComponent() {
|
|
2308
|
+
const state = getStore2()?.getState();
|
|
2309
|
+
if (!state) {
|
|
2310
|
+
return false;
|
|
2311
|
+
}
|
|
2312
|
+
return selectCurrentComponentId(state) !== null;
|
|
2313
|
+
}
|
|
2314
|
+
function isElementAtomic(elementType) {
|
|
2315
|
+
return getElementType(elementType) !== null;
|
|
2316
|
+
}
|
|
2317
|
+
function blockNonAtomicCreate(args) {
|
|
2318
|
+
if (!isEditingComponent()) {
|
|
2319
|
+
return false;
|
|
2320
|
+
}
|
|
2321
|
+
const { model } = args;
|
|
2322
|
+
const elementType = model?.widgetType || model?.elType;
|
|
2323
|
+
if (!elementType) {
|
|
2324
|
+
return false;
|
|
2325
|
+
}
|
|
2326
|
+
if (isElementAtomic(elementType)) {
|
|
2327
|
+
return false;
|
|
2328
|
+
}
|
|
2329
|
+
notify(NON_ATOMIC_ELEMENT_ALERT);
|
|
2330
|
+
return true;
|
|
2331
|
+
}
|
|
2332
|
+
function blockNonAtomicMove(args) {
|
|
2333
|
+
if (!isEditingComponent()) {
|
|
2334
|
+
return false;
|
|
2335
|
+
}
|
|
2336
|
+
const { containers = [args.container] } = args;
|
|
2337
|
+
const hasNonAtomicElement = containers.some((container) => {
|
|
2338
|
+
if (!container) {
|
|
2339
|
+
return false;
|
|
2340
|
+
}
|
|
2341
|
+
const allElements = getAllDescendants(container);
|
|
2342
|
+
return allElements.some((element) => !isAtomicWidget(element));
|
|
2343
|
+
});
|
|
2344
|
+
if (hasNonAtomicElement) {
|
|
2345
|
+
notify(NON_ATOMIC_ELEMENT_ALERT);
|
|
2346
|
+
}
|
|
2347
|
+
return hasNonAtomicElement;
|
|
2348
|
+
}
|
|
2349
|
+
function blockNonAtomicPaste(args) {
|
|
2350
|
+
if (!isEditingComponent()) {
|
|
2351
|
+
return false;
|
|
2352
|
+
}
|
|
2353
|
+
const { storageType } = args;
|
|
2354
|
+
if (storageType !== "localstorage") {
|
|
2355
|
+
return false;
|
|
2356
|
+
}
|
|
2357
|
+
const data = window?.elementorCommon?.storage?.get();
|
|
2358
|
+
if (!data?.clipboard?.elements) {
|
|
2359
|
+
return false;
|
|
2360
|
+
}
|
|
2361
|
+
const hasNonAtomicElement = hasNonAtomicElementsInTree(data.clipboard.elements);
|
|
2362
|
+
if (hasNonAtomicElement) {
|
|
2363
|
+
notify(NON_ATOMIC_ELEMENT_ALERT);
|
|
2364
|
+
}
|
|
2365
|
+
return hasNonAtomicElement;
|
|
2366
|
+
}
|
|
2367
|
+
function hasNonAtomicElementsInTree(elements) {
|
|
2368
|
+
for (const element of elements) {
|
|
2369
|
+
const elementType = element.widgetType || element.elType;
|
|
2370
|
+
if (elementType && !isElementAtomic(elementType)) {
|
|
2371
|
+
return true;
|
|
2372
|
+
}
|
|
2373
|
+
if (element.elements?.length) {
|
|
2374
|
+
if (hasNonAtomicElementsInTree(element.elements)) {
|
|
2375
|
+
return true;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
return false;
|
|
2380
|
+
}
|
|
2381
|
+
function findNonAtomicElementsInElement(element) {
|
|
2382
|
+
const nonAtomicElements = [];
|
|
2383
|
+
const elementType = element.widgetType || element.elType;
|
|
2384
|
+
if (elementType && !isElementAtomic(elementType)) {
|
|
2385
|
+
nonAtomicElements.push(elementType);
|
|
2386
|
+
}
|
|
2387
|
+
if (element.elements?.length) {
|
|
2388
|
+
for (const child of element.elements) {
|
|
2389
|
+
nonAtomicElements.push(...findNonAtomicElementsInElement(child));
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
return [...new Set(nonAtomicElements)];
|
|
2393
|
+
}
|
|
2279
2394
|
|
|
2280
2395
|
// src/store/actions/create-unpublished-component.ts
|
|
2281
2396
|
import { __privateRunCommand as runCommand2 } from "@elementor/editor-v1-adapters";
|
|
@@ -2353,16 +2468,16 @@ var validateForm = (values, schema) => {
|
|
|
2353
2468
|
|
|
2354
2469
|
// src/components/create-component-form/utils/component-form-schema.ts
|
|
2355
2470
|
import { z } from "@elementor/schema";
|
|
2356
|
-
import { __ as
|
|
2471
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
2357
2472
|
var MIN_NAME_LENGTH = 2;
|
|
2358
2473
|
var MAX_NAME_LENGTH = 50;
|
|
2359
2474
|
var createBaseComponentSchema = (existingNames) => {
|
|
2360
2475
|
return z.object({
|
|
2361
2476
|
componentName: z.string().trim().max(
|
|
2362
2477
|
MAX_NAME_LENGTH,
|
|
2363
|
-
|
|
2478
|
+
__17("Component name is too long. Please keep it under 50 characters.", "elementor")
|
|
2364
2479
|
).refine((value) => !existingNames.includes(value), {
|
|
2365
|
-
message:
|
|
2480
|
+
message: __17("Component name already exists", "elementor")
|
|
2366
2481
|
})
|
|
2367
2482
|
});
|
|
2368
2483
|
};
|
|
@@ -2370,9 +2485,9 @@ var createSubmitComponentSchema = (existingNames) => {
|
|
|
2370
2485
|
const baseSchema = createBaseComponentSchema(existingNames);
|
|
2371
2486
|
return baseSchema.extend({
|
|
2372
2487
|
componentName: baseSchema.shape.componentName.refine((value) => value.length > 0, {
|
|
2373
|
-
message:
|
|
2488
|
+
message: __17("Component name is required.", "elementor")
|
|
2374
2489
|
}).refine((value) => value.length >= MIN_NAME_LENGTH, {
|
|
2375
|
-
message:
|
|
2490
|
+
message: __17("Component name is too short. Please enter at least 2 characters.", "elementor")
|
|
2376
2491
|
})
|
|
2377
2492
|
});
|
|
2378
2493
|
};
|
|
@@ -2415,6 +2530,18 @@ function CreateComponentForm() {
|
|
|
2415
2530
|
useEffect2(() => {
|
|
2416
2531
|
const OPEN_SAVE_AS_COMPONENT_FORM_EVENT = "elementor/editor/open-save-as-component-form";
|
|
2417
2532
|
const openPopup = (event) => {
|
|
2533
|
+
const nonAtomicElements = findNonAtomicElementsInElement(event.detail.element);
|
|
2534
|
+
if (nonAtomicElements.length > 0) {
|
|
2535
|
+
notify2({
|
|
2536
|
+
type: "default",
|
|
2537
|
+
message: __18(
|
|
2538
|
+
"Cannot save as component - contains non-supported elements. Only atomic elements are allowed inside components.",
|
|
2539
|
+
"elementor"
|
|
2540
|
+
),
|
|
2541
|
+
id: "non-atomic-element-save-blocked"
|
|
2542
|
+
});
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2418
2545
|
setElement({ element: event.detail.element, elementLabel: getElementLabel(event.detail.element.id) });
|
|
2419
2546
|
setAnchorPosition(event.detail.anchorPosition);
|
|
2420
2547
|
eventData.current = getComponentEventData(event.detail.element, event.detail.options);
|
|
@@ -2437,12 +2564,12 @@ function CreateComponentForm() {
|
|
|
2437
2564
|
setResultNotification({
|
|
2438
2565
|
show: true,
|
|
2439
2566
|
// Translators: %1$s: Component name, %2$s: Component UID
|
|
2440
|
-
message:
|
|
2567
|
+
message: __18("Component saved successfully as: %1$s (UID: %2$s)", "elementor").replace("%1$s", values.componentName).replace("%2$s", uid),
|
|
2441
2568
|
type: "success"
|
|
2442
2569
|
});
|
|
2443
2570
|
resetAndClosePopup();
|
|
2444
2571
|
} catch {
|
|
2445
|
-
const errorMessage =
|
|
2572
|
+
const errorMessage = __18("Failed to save component. Please try again.", "elementor");
|
|
2446
2573
|
setResultNotification({
|
|
2447
2574
|
show: true,
|
|
2448
2575
|
message: errorMessage,
|
|
@@ -2513,10 +2640,10 @@ var Form2 = ({
|
|
|
2513
2640
|
}
|
|
2514
2641
|
};
|
|
2515
2642
|
const texts = {
|
|
2516
|
-
heading:
|
|
2517
|
-
name:
|
|
2518
|
-
cancel:
|
|
2519
|
-
create:
|
|
2643
|
+
heading: __18("Save as a component", "elementor"),
|
|
2644
|
+
name: __18("Name", "elementor"),
|
|
2645
|
+
cancel: __18("Cancel", "elementor"),
|
|
2646
|
+
create: __18("Create", "elementor")
|
|
2520
2647
|
};
|
|
2521
2648
|
const nameInputId = "component-name";
|
|
2522
2649
|
return /* @__PURE__ */ React17.createElement(FormElement, { onSubmit: handleSubmit }, /* @__PURE__ */ React17.createElement(Stack11, { alignItems: "start", width: "268px" }, /* @__PURE__ */ React17.createElement(
|
|
@@ -2555,12 +2682,12 @@ import { throttle as throttle2 } from "@elementor/utils";
|
|
|
2555
2682
|
|
|
2556
2683
|
// src/store/actions/update-current-component.ts
|
|
2557
2684
|
import { setDocumentModifiedStatus as setDocumentModifiedStatus5 } from "@elementor/editor-documents";
|
|
2558
|
-
import { __getStore as
|
|
2685
|
+
import { __getStore as getStore3 } from "@elementor/store";
|
|
2559
2686
|
function updateCurrentComponent({
|
|
2560
2687
|
path,
|
|
2561
2688
|
currentComponentId
|
|
2562
2689
|
}) {
|
|
2563
|
-
const dispatch16 =
|
|
2690
|
+
const dispatch16 = getStore3()?.dispatch;
|
|
2564
2691
|
if (!dispatch16) {
|
|
2565
2692
|
return;
|
|
2566
2693
|
}
|
|
@@ -2572,7 +2699,7 @@ function updateCurrentComponent({
|
|
|
2572
2699
|
import * as React18 from "react";
|
|
2573
2700
|
import { useEffect as useEffect4 } from "react";
|
|
2574
2701
|
import { createPortal } from "react-dom";
|
|
2575
|
-
import { __ as
|
|
2702
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
2576
2703
|
|
|
2577
2704
|
// src/hooks/use-canvas-document.ts
|
|
2578
2705
|
import { getCanvasIframeDocument } from "@elementor/editor-canvas";
|
|
@@ -2694,7 +2821,7 @@ function Backdrop({ canvas, element, onClose }) {
|
|
|
2694
2821
|
onKeyDown: handleKeyDown,
|
|
2695
2822
|
role: "button",
|
|
2696
2823
|
tabIndex: 0,
|
|
2697
|
-
"aria-label":
|
|
2824
|
+
"aria-label": __19("Exit component editing mode", "elementor")
|
|
2698
2825
|
}
|
|
2699
2826
|
);
|
|
2700
2827
|
}
|
|
@@ -2814,18 +2941,18 @@ import * as React20 from "react";
|
|
|
2814
2941
|
import { closeDialog, openDialog } from "@elementor/editor-ui";
|
|
2815
2942
|
import { InfoCircleFilledIcon } from "@elementor/icons";
|
|
2816
2943
|
import { Box as Box12, Button as Button4, DialogActions, DialogContent, DialogHeader, Icon as Icon2, Stack as Stack12, Typography as Typography10 } from "@elementor/ui";
|
|
2817
|
-
import { __ as
|
|
2944
|
+
import { __ as __20 } from "@wordpress/i18n";
|
|
2818
2945
|
var openEditModeDialog = (lockedBy) => {
|
|
2819
2946
|
openDialog({
|
|
2820
2947
|
component: /* @__PURE__ */ React20.createElement(EditModeDialog, { lockedBy })
|
|
2821
2948
|
});
|
|
2822
2949
|
};
|
|
2823
2950
|
var EditModeDialog = ({ lockedBy }) => {
|
|
2824
|
-
const content =
|
|
2825
|
-
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React20.createElement(Box12, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React20.createElement(Icon2, { color: "secondary" }, /* @__PURE__ */ React20.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React20.createElement(Typography10, { variant: "subtitle1" }, content))), /* @__PURE__ */ React20.createElement(DialogContent, null, /* @__PURE__ */ React20.createElement(Stack12, { spacing: 2, direction: "column" }, /* @__PURE__ */ React20.createElement(Typography10, { variant: "body2" },
|
|
2951
|
+
const content = __20("%s is currently editing this document", "elementor").replace("%s", lockedBy);
|
|
2952
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React20.createElement(Box12, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React20.createElement(Icon2, { color: "secondary" }, /* @__PURE__ */ React20.createElement(InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React20.createElement(Typography10, { variant: "subtitle1" }, content))), /* @__PURE__ */ React20.createElement(DialogContent, null, /* @__PURE__ */ React20.createElement(Stack12, { spacing: 2, direction: "column" }, /* @__PURE__ */ React20.createElement(Typography10, { variant: "body2" }, __20(
|
|
2826
2953
|
"You can wait for them to finish or reach out to coordinate your changes together.",
|
|
2827
2954
|
"elementor"
|
|
2828
|
-
)), /* @__PURE__ */ React20.createElement(DialogActions, null, /* @__PURE__ */ React20.createElement(Button4, { color: "secondary", variant: "contained", onClick: closeDialog },
|
|
2955
|
+
)), /* @__PURE__ */ React20.createElement(DialogActions, null, /* @__PURE__ */ React20.createElement(Button4, { color: "secondary", variant: "contained", onClick: closeDialog }, __20("Close", "elementor"))))));
|
|
2829
2956
|
};
|
|
2830
2957
|
|
|
2831
2958
|
// src/components/instance-editing-panel/instance-editing-panel.tsx
|
|
@@ -2836,7 +2963,7 @@ import { useSelectedElement as useSelectedElement2 } from "@elementor/editor-ele
|
|
|
2836
2963
|
import { PanelBody as PanelBody2, PanelHeader as PanelHeader2, PanelHeaderTitle as PanelHeaderTitle2 } from "@elementor/editor-panels";
|
|
2837
2964
|
import { ComponentsIcon as ComponentsIcon3, PencilIcon as PencilIcon2 } from "@elementor/icons";
|
|
2838
2965
|
import { IconButton as IconButton6, Stack as Stack17, Tooltip as Tooltip4 } from "@elementor/ui";
|
|
2839
|
-
import { __ as
|
|
2966
|
+
import { __ as __22 } from "@wordpress/i18n";
|
|
2840
2967
|
|
|
2841
2968
|
// src/hooks/use-component-instance-settings.ts
|
|
2842
2969
|
import { useElement } from "@elementor/editor-editing-panel";
|
|
@@ -2905,7 +3032,7 @@ function useComponentInstanceSettings() {
|
|
|
2905
3032
|
import * as React21 from "react";
|
|
2906
3033
|
import { ComponentPropListIcon as ComponentPropListIcon4, PencilIcon } from "@elementor/icons";
|
|
2907
3034
|
import { Button as Button5, Stack as Stack13, Typography as Typography11 } from "@elementor/ui";
|
|
2908
|
-
import { __ as
|
|
3035
|
+
import { __ as __21 } from "@wordpress/i18n";
|
|
2909
3036
|
var EmptyState2 = ({ onEditComponent }) => {
|
|
2910
3037
|
return /* @__PURE__ */ React21.createElement(
|
|
2911
3038
|
Stack13,
|
|
@@ -2918,12 +3045,12 @@ var EmptyState2 = ({ onEditComponent }) => {
|
|
|
2918
3045
|
gap: 1.5
|
|
2919
3046
|
},
|
|
2920
3047
|
/* @__PURE__ */ React21.createElement(ComponentPropListIcon4, { fontSize: "large" }),
|
|
2921
|
-
/* @__PURE__ */ React21.createElement(Typography11, { align: "center", variant: "subtitle2" },
|
|
2922
|
-
/* @__PURE__ */ React21.createElement(Typography11, { align: "center", variant: "caption", maxWidth: "170px" },
|
|
3048
|
+
/* @__PURE__ */ React21.createElement(Typography11, { align: "center", variant: "subtitle2" }, __21("No properties yet", "elementor")),
|
|
3049
|
+
/* @__PURE__ */ React21.createElement(Typography11, { align: "center", variant: "caption", maxWidth: "170px" }, __21(
|
|
2923
3050
|
"Edit the component to add properties, manage them or update the design across all instances.",
|
|
2924
3051
|
"elementor"
|
|
2925
3052
|
)),
|
|
2926
|
-
/* @__PURE__ */ React21.createElement(Button5, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React21.createElement(PencilIcon, { fontSize: "small" }),
|
|
3053
|
+
/* @__PURE__ */ React21.createElement(Button5, { variant: "outlined", color: "secondary", size: "small", sx: { mt: 1 }, onClick: onEditComponent }, /* @__PURE__ */ React21.createElement(PencilIcon, { fontSize: "small" }), __21("Edit component", "elementor"))
|
|
2927
3054
|
);
|
|
2928
3055
|
};
|
|
2929
3056
|
|
|
@@ -2945,9 +3072,9 @@ import {
|
|
|
2945
3072
|
import { Stack as Stack15 } from "@elementor/ui";
|
|
2946
3073
|
|
|
2947
3074
|
// src/hooks/use-controls-by-widget-type.ts
|
|
2948
|
-
import { getElementType } from "@elementor/editor-elements";
|
|
3075
|
+
import { getElementType as getElementType2 } from "@elementor/editor-elements";
|
|
2949
3076
|
function useControlsByWidgetType(type) {
|
|
2950
|
-
const elementType =
|
|
3077
|
+
const elementType = getElementType2(type);
|
|
2951
3078
|
if (!elementType) {
|
|
2952
3079
|
return {};
|
|
2953
3080
|
}
|
|
@@ -3201,7 +3328,7 @@ function InstanceEditingPanel() {
|
|
|
3201
3328
|
if (!componentId || !overridableProps || !component) {
|
|
3202
3329
|
return null;
|
|
3203
3330
|
}
|
|
3204
|
-
const panelTitle =
|
|
3331
|
+
const panelTitle = __22("Edit %s", "elementor").replace("%s", component.name);
|
|
3205
3332
|
const handleEditComponent = () => switchToComponent(componentId, componentInstanceId);
|
|
3206
3333
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
3207
3334
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
@@ -3284,7 +3411,7 @@ import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
|
|
|
3284
3411
|
import { useElement as useElement3 } from "@elementor/editor-editing-panel";
|
|
3285
3412
|
import { getWidgetsCache as getWidgetsCache3 } from "@elementor/editor-elements";
|
|
3286
3413
|
import { bindPopover as bindPopover2, bindTrigger as bindTrigger4, Popover as Popover4, Tooltip as Tooltip5, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
3287
|
-
import { __ as
|
|
3414
|
+
import { __ as __24 } from "@wordpress/i18n";
|
|
3288
3415
|
|
|
3289
3416
|
// src/store/actions/set-overridable-prop.ts
|
|
3290
3417
|
import { __dispatch as dispatch12, __getState as getState13 } from "@elementor/store";
|
|
@@ -3355,7 +3482,7 @@ import * as React28 from "react";
|
|
|
3355
3482
|
import { forwardRef as forwardRef2 } from "react";
|
|
3356
3483
|
import { CheckIcon, PlusIcon } from "@elementor/icons";
|
|
3357
3484
|
import { Box as Box14, styled as styled3 } from "@elementor/ui";
|
|
3358
|
-
import { __ as
|
|
3485
|
+
import { __ as __23 } from "@wordpress/i18n";
|
|
3359
3486
|
var SIZE2 = "tiny";
|
|
3360
3487
|
var IconContainer = styled3(Box14)`
|
|
3361
3488
|
pointer-events: none;
|
|
@@ -3415,7 +3542,7 @@ var Indicator = forwardRef2(({ isOpen, isOverridable, ...props }, ref) => /* @__
|
|
|
3415
3542
|
IconContainer,
|
|
3416
3543
|
{
|
|
3417
3544
|
className: "icon",
|
|
3418
|
-
"aria-label": isOverridable ?
|
|
3545
|
+
"aria-label": isOverridable ? __23("Overridable property", "elementor") : __23("Make prop overridable", "elementor")
|
|
3419
3546
|
},
|
|
3420
3547
|
isOverridable ? /* @__PURE__ */ React28.createElement(CheckIcon, { fontSize: SIZE2 }) : /* @__PURE__ */ React28.createElement(PlusIcon, { fontSize: SIZE2 })
|
|
3421
3548
|
)));
|
|
@@ -3486,7 +3613,7 @@ function Content2({ componentId, overridableProps }) {
|
|
|
3486
3613
|
popupState.close();
|
|
3487
3614
|
};
|
|
3488
3615
|
const overridableConfig = overridableValue ? getOverridableProp({ componentId, overrideKey: overridableValue.override_key }) : void 0;
|
|
3489
|
-
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Tooltip5, { placement: "top", title:
|
|
3616
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Tooltip5, { placement: "top", title: __24("Override Property", "elementor") }, /* @__PURE__ */ React29.createElement(Indicator, { ...triggerProps, isOpen: !!popoverProps.open, isOverridable: !!overridableValue })), /* @__PURE__ */ React29.createElement(
|
|
3490
3617
|
Popover4,
|
|
3491
3618
|
{
|
|
3492
3619
|
disableScrollLock: true,
|
|
@@ -3521,7 +3648,7 @@ function isPropAllowed(bind) {
|
|
|
3521
3648
|
}
|
|
3522
3649
|
|
|
3523
3650
|
// src/hooks/regenerate-override-keys.ts
|
|
3524
|
-
import { getAllDescendants, getContainer as getContainer3, updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
|
|
3651
|
+
import { getAllDescendants as getAllDescendants2, getContainer as getContainer3, updateElementSettings as updateElementSettings2 } from "@elementor/editor-elements";
|
|
3525
3652
|
import { registerDataHook } from "@elementor/editor-v1-adapters";
|
|
3526
3653
|
import { generateUniqueId as generateUniqueId5 } from "@elementor/utils";
|
|
3527
3654
|
function initRegenerateOverrideKeys() {
|
|
@@ -3546,7 +3673,7 @@ function regenerateOverrideKeysRecursive(elementId) {
|
|
|
3546
3673
|
if (!container) {
|
|
3547
3674
|
return;
|
|
3548
3675
|
}
|
|
3549
|
-
|
|
3676
|
+
getAllDescendants2(container).forEach(regenerateOverrideKeys);
|
|
3550
3677
|
}
|
|
3551
3678
|
function regenerateOverrideKeys(element) {
|
|
3552
3679
|
if (!isComponentInstance(element.model.toJSON())) {
|
|
@@ -3604,7 +3731,7 @@ import { getMCPByDomain as getMCPByDomain2 } from "@elementor/editor-mcp";
|
|
|
3604
3731
|
|
|
3605
3732
|
// src/mcp/save-as-component-tool.ts
|
|
3606
3733
|
import { DOCUMENT_STRUCTURE_URI, WIDGET_SCHEMA_URI } from "@elementor/editor-canvas";
|
|
3607
|
-
import { getContainer as getContainer4, getElementType as
|
|
3734
|
+
import { getContainer as getContainer4, getElementType as getElementType3, getWidgetsCache as getWidgetsCache4 } from "@elementor/editor-elements";
|
|
3608
3735
|
import { getMCPByDomain, toolPrompts } from "@elementor/editor-mcp";
|
|
3609
3736
|
import { AxiosError } from "@elementor/http-client";
|
|
3610
3737
|
import { z as z6 } from "@elementor/schema";
|
|
@@ -3686,7 +3813,7 @@ function enrichOverridableProps(input, rootElement) {
|
|
|
3686
3813
|
}
|
|
3687
3814
|
const elType = element.elType;
|
|
3688
3815
|
const widgetType = element.widgetType || element.elType;
|
|
3689
|
-
const elementType =
|
|
3816
|
+
const elementType = getElementType3(widgetType);
|
|
3690
3817
|
if (!elementType) {
|
|
3691
3818
|
throw new Error(
|
|
3692
3819
|
`Element type "${widgetType}" is not atomic or does not have a settings schema. Cannot expose property "${propKey}" for element "${elementId}".`
|
|
@@ -3942,27 +4069,27 @@ function PopulateStore() {
|
|
|
3942
4069
|
}
|
|
3943
4070
|
|
|
3944
4071
|
// src/prevent-circular-nesting.ts
|
|
3945
|
-
import { getAllDescendants as
|
|
3946
|
-
import { notify } from "@elementor/editor-notifications";
|
|
3947
|
-
import { blockCommand } from "@elementor/editor-v1-adapters";
|
|
4072
|
+
import { getAllDescendants as getAllDescendants3 } from "@elementor/editor-elements";
|
|
4073
|
+
import { notify as notify3 } from "@elementor/editor-notifications";
|
|
4074
|
+
import { blockCommand as blockCommand2 } from "@elementor/editor-v1-adapters";
|
|
3948
4075
|
import { __getState as getState15 } from "@elementor/store";
|
|
3949
|
-
import { __ as
|
|
4076
|
+
import { __ as __25 } from "@wordpress/i18n";
|
|
3950
4077
|
var COMPONENT_TYPE = "e-component";
|
|
3951
4078
|
var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
3952
4079
|
type: "default",
|
|
3953
|
-
message:
|
|
4080
|
+
message: __25("Cannot add this component here - it would create a circular reference.", "elementor"),
|
|
3954
4081
|
id: "circular-component-nesting-blocked"
|
|
3955
4082
|
};
|
|
3956
4083
|
function initCircularNestingPrevention() {
|
|
3957
|
-
|
|
4084
|
+
blockCommand2({
|
|
3958
4085
|
command: "document/elements/create",
|
|
3959
4086
|
condition: blockCircularCreate
|
|
3960
4087
|
});
|
|
3961
|
-
|
|
4088
|
+
blockCommand2({
|
|
3962
4089
|
command: "document/elements/move",
|
|
3963
4090
|
condition: blockCircularMove
|
|
3964
4091
|
});
|
|
3965
|
-
|
|
4092
|
+
blockCommand2({
|
|
3966
4093
|
command: "document/elements/paste",
|
|
3967
4094
|
condition: blockCircularPaste
|
|
3968
4095
|
});
|
|
@@ -4027,7 +4154,7 @@ function blockCircularCreate(args) {
|
|
|
4027
4154
|
}
|
|
4028
4155
|
const isBlocked = wouldCreateCircularNesting(componentId);
|
|
4029
4156
|
if (isBlocked) {
|
|
4030
|
-
|
|
4157
|
+
notify3(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
4031
4158
|
}
|
|
4032
4159
|
return isBlocked;
|
|
4033
4160
|
}
|
|
@@ -4037,7 +4164,7 @@ function blockCircularMove(args) {
|
|
|
4037
4164
|
if (!container) {
|
|
4038
4165
|
return false;
|
|
4039
4166
|
}
|
|
4040
|
-
const allElements =
|
|
4167
|
+
const allElements = getAllDescendants3(container);
|
|
4041
4168
|
return allElements.some((element) => {
|
|
4042
4169
|
const componentId = extractComponentIdFromContainer(element);
|
|
4043
4170
|
if (componentId === null) {
|
|
@@ -4047,7 +4174,7 @@ function blockCircularMove(args) {
|
|
|
4047
4174
|
});
|
|
4048
4175
|
});
|
|
4049
4176
|
if (hasCircularComponent) {
|
|
4050
|
-
|
|
4177
|
+
notify3(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
4051
4178
|
}
|
|
4052
4179
|
return hasCircularComponent;
|
|
4053
4180
|
}
|
|
@@ -4063,7 +4190,7 @@ function blockCircularPaste(args) {
|
|
|
4063
4190
|
const allComponentIds = extractComponentIdsFromElements(data.clipboard.elements);
|
|
4064
4191
|
const hasCircularComponent = allComponentIds.some(wouldCreateCircularNesting);
|
|
4065
4192
|
if (hasCircularComponent) {
|
|
4066
|
-
|
|
4193
|
+
notify3(COMPONENT_CIRCULAR_NESTING_ALERT);
|
|
4067
4194
|
}
|
|
4068
4195
|
return hasCircularComponent;
|
|
4069
4196
|
}
|
|
@@ -4196,7 +4323,7 @@ var setComponentOverridablePropsSettingsBeforeSave = ({
|
|
|
4196
4323
|
};
|
|
4197
4324
|
|
|
4198
4325
|
// src/sync/update-archived-component-before-save.ts
|
|
4199
|
-
import { notify as
|
|
4326
|
+
import { notify as notify4 } from "@elementor/editor-notifications";
|
|
4200
4327
|
import { __getState as getState19 } from "@elementor/store";
|
|
4201
4328
|
var failedNotification = (message) => ({
|
|
4202
4329
|
type: "error",
|
|
@@ -4220,10 +4347,10 @@ var updateArchivedComponentBeforeSave = async () => {
|
|
|
4220
4347
|
const failedIds = result.failedIds.join(", ");
|
|
4221
4348
|
const successIds = result.successIds.join(", ");
|
|
4222
4349
|
if (failedIds) {
|
|
4223
|
-
|
|
4350
|
+
notify4(failedNotification(failedIds));
|
|
4224
4351
|
}
|
|
4225
4352
|
if (successIds) {
|
|
4226
|
-
|
|
4353
|
+
notify4(successNotification(successIds));
|
|
4227
4354
|
}
|
|
4228
4355
|
} catch (error) {
|
|
4229
4356
|
throw new Error(`Failed to update archived components: ${error}`);
|
|
@@ -4277,7 +4404,7 @@ function init() {
|
|
|
4277
4404
|
window.elementorCommon.__beforeSave = beforeSave;
|
|
4278
4405
|
injectTab({
|
|
4279
4406
|
id: "components",
|
|
4280
|
-
label:
|
|
4407
|
+
label: __26("Components", "elementor"),
|
|
4281
4408
|
component: Components
|
|
4282
4409
|
});
|
|
4283
4410
|
injectIntoTop({
|
|
@@ -4324,6 +4451,7 @@ function init() {
|
|
|
4324
4451
|
initRegenerateOverrideKeys();
|
|
4325
4452
|
initMcp();
|
|
4326
4453
|
initCircularNestingPrevention();
|
|
4454
|
+
initNonAtomicNestingPrevention();
|
|
4327
4455
|
}
|
|
4328
4456
|
export {
|
|
4329
4457
|
init
|